aboutsummaryrefslogtreecommitdiff
path: root/azalea-protocol/src
diff options
context:
space:
mode:
authormat <github@matdoes.dev>2022-09-05 01:04:16 -0500
committermat <github@matdoes.dev>2022-09-05 01:04:16 -0500
commit9ca95194696f8e9ef3ca84420f5d3b5082ff70ca (patch)
tree4f65aec60b121bbd7ed4fa4b1436b98e301d43ba /azalea-protocol/src
parent4f00ddace08bd5ad17500a405f55554dff343be7 (diff)
downloadazalea-drasl-9ca95194696f8e9ef3ca84420f5d3b5082ff70ca.tar.xz
.walk :)
Diffstat (limited to 'azalea-protocol/src')
-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,