aboutsummaryrefslogtreecommitdiff
path: root/azalea-protocol/src
diff options
context:
space:
mode:
Diffstat (limited to 'azalea-protocol/src')
-rw-r--r--azalea-protocol/src/packets/game/clientbound_player_chat_packet.rs14
1 files changed, 13 insertions, 1 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 7192f88a..5d3bdd23 100644
--- a/azalea-protocol/src/packets/game/clientbound_player_chat_packet.rs
+++ b/azalea-protocol/src/packets/game/clientbound_player_chat_packet.rs
@@ -14,7 +14,7 @@ pub struct ClientboundPlayerChatPacket {
pub chat_type: ChatTypeBound,
}
-#[derive(Copy, Clone, Debug, McBuf)]
+#[derive(Copy, Clone, Debug, McBuf, PartialEq, Eq)]
pub enum ChatType {
Chat = 0,
SayCommand = 1,
@@ -115,3 +115,15 @@ impl McBufWritable for FilterMask {
Ok(())
}
}
+
+#[cfg(test)]
+mod tests {
+ use super::*;
+
+ #[test]
+ fn test_chat_type() {
+ let chat_type_enum = ChatType::read_from(&mut &[0x06][..]).unwrap();
+ assert_eq!(chat_type_enum, ChatType::EmoteCommand);
+ assert!(ChatType::read_from(&mut &[0x07][..]).is_err());
+ }
+}