From 9ca95194696f8e9ef3ca84420f5d3b5082ff70ca Mon Sep 17 00:00:00 2001 From: mat Date: Mon, 5 Sep 2022 01:04:16 -0500 Subject: .walk :) --- .../src/packets/game/clientbound_player_chat_packet.rs | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'azalea-protocol/src/packets') 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, } +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, -- cgit v1.2.3