From 2c37ade959c45e7db93ce4581f49902acbbb86b0 Mon Sep 17 00:00:00 2001 From: mat Date: Mon, 23 Dec 2024 02:01:58 +0000 Subject: [PATCH] add a test for 2b2t queue chat message --- azalea-protocol/src/packets/game/c_system_chat.rs | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/azalea-protocol/src/packets/game/c_system_chat.rs b/azalea-protocol/src/packets/game/c_system_chat.rs index 14dfdcbfc..191f6ee4a 100755 --- a/azalea-protocol/src/packets/game/c_system_chat.rs +++ b/azalea-protocol/src/packets/game/c_system_chat.rs @@ -42,4 +42,18 @@ mod tests { "Displaying particle minecraft:dust".to_string() ); } + + #[test] + fn test_2b2t_queue_message() { + #[rustfmt::skip] + let bytes = [ + 10, 9, 0, 5, 101, 120, 116, 114, 97, 10, 0, 0, 0, 1, 8, 0, 4, 116, 101, 120, 116, 0, 95, 80, 111, 115, 105, 116, 105, 111, 110, 32, 105, 110, 32, 113, 117, 101, 117, 101, 58, 32, 51, 50, 56, 10, 89, 111, 117, 32, 99, 97, 110, 32, 112, 117, 114, 99, 104, 97, 115, 101, 32, 112, 114, 105, 111, 114, 105, 116, 121, 32, 113, 117, 101, 117, 101, 32, 115, 116, 97, 116, 117, 115, 32, 116, 111, 32, 106, 111, 105, 110, 32, 116, 104, 101, 32, 115, 101, 114, 118, 101, 114, 32, 102, 97, 115, 116, 101, 114, 44, 32, 118, 105, 115, 105, 116, 32, 8, 0, 5, 99, 111, 108, 111, 114, 0, 4, 103, 111, 108, 100, 9, 0, 5, 101, 120, 116, 114, 97, 10, 0, 0, 0, 1, 10, 0, 10, 99, 108, 105, 99, 107, 69, 118, 101, 110, 116, 8, 0, 6, 97, 99, 116, 105, 111, 110, 0, 8, 111, 112, 101, 110, 95, 117, 114, 108, 8, 0, 5, 118, 97, 108, 117, 101, 0, 22, 104, 116, 116, 112, 115, 58, 47, 47, 115, 104, 111, 112, 46, 50, 98, 50, 116, 46, 111, 114, 103, 47, 0, 1, 0, 4, 98, 111, 108, 100, 1, 8, 0, 4, 116, 101, 120, 116, 0, 13, 115, 104, 111, 112, 46, 50, 98, 50, 116, 46, 111, 114, 103, 0, 0, 8, 0, 4, 116, 101, 120, 116, 0, 20, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 0, 0 + ]; + let packet = ClientboundSystemChat::azalea_read(&mut Cursor::new(&bytes)).unwrap(); + + assert_eq!( + packet.content.to_string().trim(), + "Position in queue: 328\nYou can purchase priority queue status to join the server faster, visit shop.2b2t.org".to_string() + ); + } }