diff options
| author | mat <git@matdoes.dev> | 2025-10-12 23:01:54 +0300 |
|---|---|---|
| committer | mat <git@matdoes.dev> | 2025-10-12 23:01:54 +0300 |
| commit | ee2575794e91b9457a74a95daf1dcc707058cd58 (patch) | |
| tree | df725850ef18ded5ce3f6552e17095d0f704ae84 /azalea-client/src/plugins/chat/mod.rs | |
| parent | 1a1402954b07cd77615d0afc026c73b008787f51 (diff) | |
| download | azalea-drasl-ee2575794e91b9457a74a95daf1dcc707058cd58.tar.xz | |
upgrade deps and clean up lots of doc comments
Diffstat (limited to 'azalea-client/src/plugins/chat/mod.rs')
| -rw-r--r-- | azalea-client/src/plugins/chat/mod.rs | 35 |
1 files changed, 21 insertions, 14 deletions
diff --git a/azalea-client/src/plugins/chat/mod.rs b/azalea-client/src/plugins/chat/mod.rs index 098b6543..e0a41d49 100644 --- a/azalea-client/src/plugins/chat/mod.rs +++ b/azalea-client/src/plugins/chat/mod.rs @@ -131,9 +131,11 @@ impl ChatPacket { self.split_sender_and_content().0 } - /// Get the UUID of the sender of the message. If it's not a - /// player-sent chat message, this will be None (this is sometimes the case - /// when a server uses a plugin to modify chat messages). + /// Get the UUID of the sender of the message. + /// + /// If it's not a player-sent chat message, this will be None (this is + /// sometimes the case when a server uses a plugin to modify chat + /// messages). pub fn sender_uuid(&self) -> Option<Uuid> { match self { ChatPacket::System(_) => None, @@ -142,14 +144,16 @@ impl ChatPacket { } } - /// Get the content part of the message as a string. This does not preserve - /// formatting codes. If it's not a player-sent chat message or the sender - /// couldn't be determined, this will contain the entire message. + /// Get the content part of the message as a string. + /// + /// This does not preserve formatting codes. If it's not a player-sent chat + /// message or the sender couldn't be determined, this will contain the + /// entire message. pub fn content(&self) -> String { self.split_sender_and_content().1 } - /// Create a new Chat from a string. This is meant to be used as a + /// Create a new `ChatPacket` from a string. This is meant to be used as a /// convenience function for testing. pub fn new(message: &str) -> Self { ChatPacket::System(Arc::new(ClientboundSystemChat { @@ -159,8 +163,9 @@ impl ChatPacket { } /// Whether this message is an incoming whisper message (i.e. someone else - /// dm'd the bot with /msg). It works by checking the translation key, so it - /// won't work on servers that use their own whisper system. + /// messaged the bot with /msg). + /// + /// This is not guaranteed to work correctly on custom servers. pub fn is_whisper(&self) -> bool { match self { ChatPacket::System(p) => { @@ -183,11 +188,13 @@ impl ChatPacket { } impl Client { - /// Send a chat message to the server. This only sends the chat packet and - /// not the command packet, which means on some servers you can use this to - /// send chat messages that start with a `/`. The [`Client::chat`] function - /// handles checking whether the message is a command and using the - /// proper packet for you, so you should use that instead. + /// Send a chat message to the server. + /// + /// This only sends the chat packet and not the command packet, which means + /// on some servers you can use this to send chat messages that start + /// with a `/`. The [`Client::chat`] function handles checking whether + /// the message is a command and using the proper packet for you, so you + /// should use that instead. pub fn write_chat_packet(&self, message: &str) { self.ecs.lock().write_message(SendChatKindEvent { entity: self.entity, |
