aboutsummaryrefslogtreecommitdiff
path: root/azalea-protocol
diff options
context:
space:
mode:
authormat <git@matdoes.dev>2025-05-06 22:35:17 -0630
committermat <git@matdoes.dev>2025-05-06 22:35:17 -0630
commit4a1fdf01217b27d48741bb13dea4f0b5b57d42ca (patch)
treee8f969b2bd722b7d692d4f31d678fe005209cfe7 /azalea-protocol
parentaa0256da102103eedc9897458dd81516962a80a3 (diff)
downloadazalea-drasl-4a1fdf01217b27d48741bb13dea4f0b5b57d42ca.tar.xz
fix incorrect chat parsing when legacy color codes are mixed in
Diffstat (limited to 'azalea-protocol')
-rw-r--r--azalea-protocol/src/packets/game/c_system_chat.rs14
1 files changed, 14 insertions, 0 deletions
diff --git a/azalea-protocol/src/packets/game/c_system_chat.rs b/azalea-protocol/src/packets/game/c_system_chat.rs
index 191f6ee4..356a31ff 100644
--- a/azalea-protocol/src/packets/game/c_system_chat.rs
+++ b/azalea-protocol/src/packets/game/c_system_chat.rs
@@ -56,4 +56,18 @@ mod tests {
"Position in queue: 328\nYou can purchase priority queue status to join the server faster, visit shop.2b2t.org".to_string()
);
}
+
+ #[test]
+ fn test_skyblock_net_message() {
+ #[rustfmt::skip]
+ let bytes = [
+ 10, 8, 0, 4, 116, 101, 120, 116, 0, 0, 8, 0, 9, 105, 110, 115, 101, 114, 116, 105, 111, 110, 0, 7, 109, 97, 116, 115, 99, 97, 110, 9, 0, 5, 101, 120, 116, 114, 97, 10, 0, 0, 0, 2, 8, 0, 4, 116, 101, 120, 116, 0, 15, 194, 167, 97, 109, 97, 116, 115, 99, 97, 110, 194, 167, 114, 58, 32, 10, 0, 11, 104, 111, 118, 101, 114, 95, 101, 118, 101, 110, 116, 8, 0, 6, 97, 99, 116, 105, 111, 110, 0, 9, 115, 104, 111, 119, 95, 116, 101, 120, 116, 10, 0, 5, 118, 97, 108, 117, 101, 8, 0, 4, 116, 101, 120, 116, 0, 0, 9, 0, 5, 101, 120, 116, 114, 97, 8, 0, 0, 0, 1, 0, 126, 194, 167, 97, 109, 97, 116, 115, 99, 97, 110, 10, 194, 167, 101, 82, 97, 110, 107, 58, 32, 194, 167, 102, 194, 167, 97, 83, 107, 121, 98, 108, 111, 99, 107, 101, 114, 10, 194, 167, 54, 76, 101, 118, 101, 108, 58, 32, 194, 167, 102, 48, 10, 194, 167, 97, 74, 111, 105, 110, 101, 100, 58, 32, 194, 167, 102, 52, 109, 32, 52, 51, 115, 32, 97, 103, 111, 10, 194, 167, 98, 80, 108, 97, 121, 116, 105, 109, 101, 58, 32, 194, 167, 102, 50, 51, 115, 10, 194, 167, 55, 194, 167, 111, 42, 67, 108, 105, 99, 107, 32, 116, 111, 32, 118, 105, 115, 105, 116, 32, 105, 115, 108, 97, 110, 100, 42, 0, 0, 0, 8, 0, 0, 0, 4, 109, 101, 111, 119, 0, 10, 0, 11, 99, 108, 105, 99, 107, 95, 101, 118, 101, 110, 116, 8, 0, 6, 97, 99, 116, 105, 111, 110, 0, 15, 115, 117, 103, 103, 101, 115, 116, 95, 99, 111, 109, 109, 97, 110, 100, 8, 0, 5, 118, 97, 108, 117, 101, 0, 14, 47, 118, 105, 115, 105, 116, 32, 109, 97, 116, 115, 99, 97, 110, 8, 0, 7, 99, 111, 109, 109, 97, 110, 100, 0, 14, 47, 118, 105, 115, 105, 116, 32, 109, 97, 116, 115, 99, 97, 110, 0, 0, 0
+ ];
+ let packet = ClientboundSystemChat::azalea_read(&mut Cursor::new(&bytes)).unwrap();
+
+ assert_eq!(
+ packet.content.to_ansi(),
+ "\u{1b}[38;2;85;255;85mmatscan\u{1b}[m\u{1b}[38;2;255;255;255m: meow\u{1b}[m"
+ )
+ }
}