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-chat/src/text_component.rs | 0 azalea-chat/src/translatable_component.rs | 6 +++--- 2 files changed, 3 insertions(+), 3 deletions(-) mode change 100755 => 100644 azalea-chat/src/text_component.rs mode change 100755 => 100644 azalea-chat/src/translatable_component.rs (limited to 'azalea-chat/src') diff --git a/azalea-chat/src/text_component.rs b/azalea-chat/src/text_component.rs old mode 100755 new mode 100644 diff --git a/azalea-chat/src/translatable_component.rs b/azalea-chat/src/translatable_component.rs old mode 100755 new mode 100644 index 750f65c4..918c2c42 --- a/azalea-chat/src/translatable_component.rs +++ b/azalea-chat/src/translatable_component.rs @@ -59,7 +59,7 @@ impl TranslatableComponent { .args .get(matched) .cloned() - .unwrap_or(StringOrComponent::String("".to_string())); + .unwrap_or_else(|| StringOrComponent::String("".to_string())); components.push(TextComponent::new(built_text.clone())); built_text.clear(); @@ -107,7 +107,7 @@ impl TranslatableComponent { Ok(TextComponent { base: BaseComponent { - siblings: components.into_iter().map(|c| Component::Text(c)).collect(), + siblings: components.into_iter().map(Component::Text).collect(), style: Style::default(), }, text: "".to_string(), @@ -135,7 +135,7 @@ impl Display for StringOrComponent { fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), fmt::Error> { match self { StringOrComponent::String(s) => write!(f, "{}", s), - StringOrComponent::Component(c) => write!(f, "{}", c.to_string()), + StringOrComponent::Component(c) => write!(f, "{}", c), } } } -- cgit v1.2.3