diff options
| author | mat <27899617+mat-1@users.noreply.github.com> | 2022-10-23 19:00:24 -0500 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-10-23 19:00:24 -0500 |
| commit | 65da123631b0a2dc078786f60fa6b213e8b430ee (patch) | |
| tree | 8854f29c4240d36bec1710ebc2293a488c495d3d /azalea-chat/src | |
| parent | 587001724acf8a7c6de30927da31c1f5fd7fdb09 (diff) | |
| download | azalea-drasl-65da123631b0a2dc078786f60fa6b213e8b430ee.tar.xz | |
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`
Diffstat (limited to 'azalea-chat/src')
| -rw-r--r--[-rwxr-xr-x] | azalea-chat/src/text_component.rs | 0 | ||||
| -rw-r--r--[-rwxr-xr-x] | azalea-chat/src/translatable_component.rs | 6 |
2 files changed, 3 insertions, 3 deletions
diff --git a/azalea-chat/src/text_component.rs b/azalea-chat/src/text_component.rs index 96eef08e..96eef08e 100755..100644 --- a/azalea-chat/src/text_component.rs +++ b/azalea-chat/src/text_component.rs diff --git a/azalea-chat/src/translatable_component.rs b/azalea-chat/src/translatable_component.rs index 750f65c4..918c2c42 100755..100644 --- 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), } } } |
