From 65da123631b0a2dc078786f60fa6b213e8b430ee Mon Sep 17 00:00:00 2001 From: mat <27899617+mat-1@users.noreply.github.com> Date: Sun, 23 Oct 2022 19:00:24 -0500 Subject: Add Client::set_client_information (#33) * start adding options * add default options * send options packet by default * mention set_options in Client::join doc * make TranslatableComponent::read return TextComponent * change set_options to set_client_information * clean up some code * Add `Initialize` event * fix some clippy warnings * change `Client::options` to `client_information` --- azalea-client/src/chat.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'azalea-client/src/chat.rs') diff --git a/azalea-client/src/chat.rs b/azalea-client/src/chat.rs index 335261e6..18fa4549 100644 --- a/azalea-client/src/chat.rs +++ b/azalea-client/src/chat.rs @@ -84,8 +84,8 @@ impl Client { /// # } /// ``` pub async fn chat(&self, message: &str) -> Result<(), std::io::Error> { - if message.starts_with('/') { - self.send_command_packet(&message[1..]).await + if let Some(command) = message.strip_prefix('/') { + self.send_command_packet(command).await } else { self.send_chat_packet(message).await } -- cgit v1.2.3