aboutsummaryrefslogtreecommitdiff
path: root/azalea-protocol/src/packets
diff options
context:
space:
mode:
Diffstat (limited to 'azalea-protocol/src/packets')
-rw-r--r--azalea-protocol/src/packets/game/clientbound_player_chat_packet.rs14
1 files changed, 14 insertions, 0 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 492f352f..6b4582ba 100644
--- a/azalea-protocol/src/packets/game/clientbound_player_chat_packet.rs
+++ b/azalea-protocol/src/packets/game/clientbound_player_chat_packet.rs
@@ -49,6 +49,20 @@ pub struct SignedMessageBody {
pub last_seen: Vec<LastSeenMessagesEntry>,
}
+impl PlayerChatMessage {
+ pub fn message(&self, only_secure_chat: bool) -> Component {
+ if only_secure_chat {
+ return self
+ .signed_body
+ .content
+ .decorated
+ .clone()
+ .unwrap_or(Component::from(self.signed_body.content.plain.clone()));
+ }
+ self.unsigned_content.clone().unwrap_or(self.message(true))
+ }
+}
+
#[derive(Clone, Debug, McBuf)]
pub struct LastSeenMessagesEntry {
pub profile_id: Uuid,