diff options
| author | mat <git@matdoes.dev> | 2025-08-12 17:39:05 +1200 |
|---|---|---|
| committer | mat <git@matdoes.dev> | 2025-08-12 17:39:05 +1200 |
| commit | 12aeae07d2667cd188acf88190ed5c3f7983926a (patch) | |
| tree | 4f4549b8e37d76f098d4164398517813bb0dfcc6 /azalea-protocol/src | |
| parent | fa1050d6eedf80bbc20e91163b99c0306414e627 (diff) | |
| download | azalea-drasl-12aeae07d2667cd188acf88190ed5c3f7983926a.tar.xz | |
fix wrong chat styling sometimes when 'extra' field is used
Diffstat (limited to 'azalea-protocol/src')
| -rw-r--r-- | azalea-protocol/src/packets/game/c_system_chat.rs | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/azalea-protocol/src/packets/game/c_system_chat.rs b/azalea-protocol/src/packets/game/c_system_chat.rs index 356a31ff..b47fc5bd 100644 --- a/azalea-protocol/src/packets/game/c_system_chat.rs +++ b/azalea-protocol/src/packets/game/c_system_chat.rs @@ -67,7 +67,21 @@ mod tests { 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" + "\u{1b}[38;2;85;255;85mmatscan\u{1b}[38;2;255;255;255m: meow\u{1b}[m" ) } + + #[test] + fn test_ticket_message() { + #[rustfmt::skip] + let bytes = [ + 10, 9, 0, 5, 101, 120, 116, 114, 97, 10, 0, 0, 0, 11, 8, 0, 5, 99, 111, 108, 111, 114, 0, 6, 121, 101, 108, 108, 111, 119, 1, 0, 10, 117, 110, 100, 101, 114, 108, 105, 110, 101, 100, 0, 8, 0, 4, 116, 101, 120, 116, 0, 1, 91, 1, 0, 4, 98, 111, 108, 100, 0, 1, 0, 13, 115, 116, 114, 105, 107, 101, 116, 104, 114, 111, 117, 103, 104, 0, 1, 0, 10, 111, 98, 102, 117, 115, 99, 97, 116, 101, 100, 0, 1, 0, 6, 105, 116, 97, 108, 105, 99, 0, 0, 8, 0, 5, 99, 111, 108, 111, 114, 0, 5, 103, 114, 101, 101, 110, 8, 0, 4, 116, 101, 120, 116, 0, 2, 83, 66, 1, 0, 6, 105, 116, 97, 108, 105, 99, 0, 0, 8, 0, 5, 99, 111, 108, 111, 114, 0, 4, 97, 113, 117, 97, 8, 0, 4, 116, 101, 120, 116, 0, 6, 82, 97, 102, 102, 108, 101, 1, 0, 6, 105, 116, 97, 108, 105, 99, 0, 0, 8, 0, 5, 99, 111, 108, 111, 114, 0, 6, 121, 101, 108, 108, 111, 119, 8, 0, 4, 116, 101, 120, 116, 0, 1, 93, 1, 0, 6, 105, 116, 97, 108, 105, 99, 0, 0, 8, 0, 4, 116, 101, 120, 116, 0, 1, 32, 1, 0, 6, 105, 116, 97, 108, 105, 99, 0, 0, 8, 0, 5, 99, 111, 108, 111, 114, 0, 5, 119, 104, 105, 116, 101, 8, 0, 4, 116, 101, 120, 116, 0, 1, 91, 1, 0, 6, 105, 116, 97, 108, 105, 99, 0, 0, 8, 0, 5, 99, 111, 108, 111, 114, 0, 6, 121, 101, 108, 108, 111, 119, 8, 0, 4, 116, 101, 120, 116, 0, 10, 72, 105, 103, 104, 114, 111, 108, 108, 101, 114, 1, 0, 6, 105, 116, 97, 108, 105, 99, 0, 0, 8, 0, 5, 99, 111, 108, 111, 114, 0, 5, 119, 104, 105, 116, 101, 8, 0, 4, 116, 101, 120, 116, 0, 1, 93, 1, 0, 6, 105, 116, 97, 108, 105, 99, 0, 0, 8, 0, 5, 99, 111, 108, 111, 114, 0, 6, 121, 101, 108, 108, 111, 119, 8, 0, 4, 116, 101, 120, 116, 0, 10, 32, 115, 107, 121, 108, 97, 110, 100, 105, 97, 1, 0, 6, 105, 116, 97, 108, 105, 99, 0, 0, 8, 0, 4, 116, 101, 120, 116, 0, 1, 32, 1, 0, 6, 105, 116, 97, 108, 105, 99, 0, 0, 8, 0, 4, 116, 101, 120, 116, 0, 21, 106, 117, 115, 116, 32, 98, 111, 117, 103, 104, 116, 32, 49, 32, 116, 105, 99, 107, 101, 116, 33, 1, 0, 6, 105, 116, 97, 108, 105, 99, 0, 0, 8, 0, 4, 116, 101, 120, 116, 0, 0, 0, 0 + ]; + let packet = ClientboundSystemChat::azalea_read(&mut Cursor::new(&bytes)).unwrap(); + + assert_eq!( + packet.content.to_ansi(), + "\u{1b}[38;2;255;255;85m[\u{1b}[38;2;85;255;85mSB\u{1b}[38;2;85;255;255mRaffle\u{1b}[38;2;255;255;85m]\u{1b}[38;2;255;255;255m [\u{1b}[38;2;255;255;85mHighroller\u{1b}[38;2;255;255;255m]\u{1b}[38;2;255;255;85m skylandia\u{1b}[38;2;255;255;255m just bought 1 ticket!\u{1b}[m" + ); + } } |
