diff options
| author | EightFactorial <murphkev000@gmail.com> | 2023-01-30 16:18:14 -0800 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-01-30 18:18:14 -0600 |
| commit | 6e818852d868eea963dd2b8489ba75b65c56fb1c (patch) | |
| tree | e786e919de7d4a1777d91e8e2fa890482970972d /azalea-protocol/src/packets/game/clientbound_player_chat_packet.rs | |
| parent | 2539f948c7a88a86b27b1878f6c28976285f348c (diff) | |
| download | azalea-drasl-6e818852d868eea963dd2b8489ba75b65c56fb1c.tar.xz | |
More packet fixes, tests, handle error (#61)
* Fix packet, fix tests, fixedbitsets
* Clippy: Nightmare Mode
* Fix mistake
* simplify impl Display and make thing pub
---------
Co-authored-by: mat <github@matdoes.dev>
Diffstat (limited to 'azalea-protocol/src/packets/game/clientbound_player_chat_packet.rs')
| -rw-r--r-- | azalea-protocol/src/packets/game/clientbound_player_chat_packet.rs | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/azalea-protocol/src/packets/game/clientbound_player_chat_packet.rs b/azalea-protocol/src/packets/game/clientbound_player_chat_packet.rs index a735c907..098ffa03 100644 --- a/azalea-protocol/src/packets/game/clientbound_player_chat_packet.rs +++ b/azalea-protocol/src/packets/game/clientbound_player_chat_packet.rs @@ -90,6 +90,7 @@ impl ClientboundPlayerChatPacket { /// Returns the content of the message. If you want to get the Component /// for the whole message including the sender part, use /// [`ClientboundPlayerChatPacket::message`]. + #[must_use] pub fn content(&self) -> Component { self.unsigned_content .clone() @@ -97,6 +98,7 @@ impl ClientboundPlayerChatPacket { } /// Get the full message, including the sender part. + #[must_use] pub fn message(&self) -> Component { let sender = self.chat_type.name.clone(); let content = self.content(); @@ -119,6 +121,7 @@ impl ClientboundPlayerChatPacket { } impl ChatType { + #[must_use] pub fn chat_translation_key(&self) -> &'static str { match self { ChatType::Chat => "chat.type.text", @@ -131,15 +134,11 @@ impl ChatType { } } + #[must_use] pub fn narrator_translation_key(&self) -> &'static str { match self { - ChatType::Chat => "chat.type.text.narrate", - ChatType::SayCommand => "chat.type.text.narrate", - ChatType::MsgCommandIncoming => "chat.type.text.narrate", - ChatType::MsgCommandOutgoing => "chat.type.text.narrate", - ChatType::TeamMsgCommandIncoming => "chat.type.text.narrate", - ChatType::TeamMsgCommandOutgoing => "chat.type.text.narrate", ChatType::EmoteCommand => "chat.type.emote", + _ => "chat.type.text.narrate", } } } |
