diff --git a/src/probe.rs b/src/probe.rs index c9d37db..739ba74 100644 --- a/src/probe.rs +++ b/src/probe.rs @@ -335,7 +335,7 @@ async fn wait_for_server_join_game_no_timeout( Ok(Some(packet)) => packet, Ok(None) => break, Err(_) => { - error!(target: "lazymc::lobby", "Closing connection, error occurred"); + error!(target: "lazymc::probe", "Closing connection, error occurred"); break; } }; @@ -344,15 +344,15 @@ async fn wait_for_server_join_game_no_timeout( if packets::play::join_game::is_packet(client_info, packet.id) { // Parse join game data let join_game_data = JoinGameData::from_packet(client_info, packet).map_err(|err| { - warn!(target: "lazymc::lobby", "Failed to parse join game packet: {:?}", err); + warn!(target: "lazymc::probe", "Failed to parse join game packet: {:?}", err); })?; return Ok(join_game_data); } // Show unhandled packet warning - debug!(target: "lazymc::lobby", "Got unhandled packet from server in wait_for_server_join_game:"); - debug!(target: "lazymc::lobby", "- Packet ID: 0x{:02X} ({})", packet.id, packet.id); + debug!(target: "lazymc::probe", "Got unhandled packet from server in wait_for_server_join_game:"); + debug!(target: "lazymc::probe", "- Packet ID: 0x{:02X} ({})", packet.id, packet.id); } // Gracefully close connection diff --git a/src/proto/packets/play/join_game.rs b/src/proto/packets/play/join_game.rs index 32131a4..1d7f444 100644 --- a/src/proto/packets/play/join_game.rs +++ b/src/proto/packets/play/join_game.rs @@ -33,7 +33,7 @@ impl JoinGameData { /// Extract join game data from given packet. pub fn from_packet(client_info: &ClientInfo, packet: RawPacket) -> Result { match client_info.protocol() { - Some(p) if p <= v1_16_3::PROTOCOL => { + Some(p) if p < v1_17::PROTOCOL => { Ok(v1_16_3::game::JoinGame::decode(&mut packet.data.as_slice())?.into()) } _ => Ok(v1_17::game::JoinGame::decode(&mut packet.data.as_slice())?.into()), @@ -74,7 +74,7 @@ impl From for JoinGameData { /// Check whether the packet ID matches. pub fn is_packet(client_info: &ClientInfo, packet_id: u8) -> bool { match client_info.protocol() { - Some(p) if p <= v1_16_3::PROTOCOL => packet_id == v1_16_3::game::JoinGame::PACKET_ID, + Some(p) if p < v1_17::PROTOCOL => packet_id == v1_16_3::game::JoinGame::PACKET_ID, _ => packet_id == v1_17::game::JoinGame::PACKET_ID, } } @@ -102,7 +102,7 @@ pub async fn lobby_send( let status = server.status().await; match client_info.protocol() { - Some(p) if p <= v1_16_3::PROTOCOL => { + Some(p) if p < v1_17::PROTOCOL => { packet::write_packet( v1_16_3::game::JoinGame { // Player ID must be unique, if it collides with another server entity ID the player gets diff --git a/src/proto/packets/play/keep_alive.rs b/src/proto/packets/play/keep_alive.rs index babd844..ba1adeb 100644 --- a/src/proto/packets/play/keep_alive.rs +++ b/src/proto/packets/play/keep_alive.rs @@ -21,7 +21,7 @@ pub async fn send( let id = KEEP_ALIVE_ID.fetch_add(1, Ordering::Relaxed); match client_info.protocol() { - Some(p) if p <= v1_16_3::PROTOCOL => { + Some(p) if p < v1_17::PROTOCOL => { packet::write_packet(v1_16_3::game::ClientBoundKeepAlive { id }, client, writer).await } _ => packet::write_packet(v1_17::game::ClientBoundKeepAlive { id }, client, writer).await, diff --git a/src/proto/packets/play/player_pos.rs b/src/proto/packets/play/player_pos.rs index 4bedb3b..3de160e 100644 --- a/src/proto/packets/play/player_pos.rs +++ b/src/proto/packets/play/player_pos.rs @@ -11,7 +11,7 @@ pub async fn send( writer: &mut WriteHalf<'_>, ) -> Result<(), ()> { match client_info.protocol() { - Some(p) if p <= v1_16_3::PROTOCOL => { + Some(p) if p < v1_17::PROTOCOL => { packet::write_packet( v1_16_3::game::PlayerPositionAndLook { x: 0.0, diff --git a/src/proto/packets/play/respawn.rs b/src/proto/packets/play/respawn.rs index 25ed908..ee21d9d 100644 --- a/src/proto/packets/play/respawn.rs +++ b/src/proto/packets/play/respawn.rs @@ -16,7 +16,7 @@ pub async fn lobby_send( data: JoinGameData, ) -> Result<(), ()> { match client_info.protocol() { - Some(p) if p <= v1_16_3::PROTOCOL => { + Some(p) if p < v1_17::PROTOCOL => { packet::write_packet( v1_16_3::game::Respawn { dimension: data.dimension.unwrap_or_else(|| { diff --git a/src/proto/packets/play/server_brand.rs b/src/proto/packets/play/server_brand.rs index 1f0391e..c5b25fe 100644 --- a/src/proto/packets/play/server_brand.rs +++ b/src/proto/packets/play/server_brand.rs @@ -19,7 +19,7 @@ pub async fn send( writer: &mut WriteHalf<'_>, ) -> Result<(), ()> { match client_info.protocol() { - Some(p) if p <= v1_16_3::PROTOCOL => { + Some(p) if p < v1_17::PROTOCOL => { packet::write_packet( v1_16_3::game::ClientBoundPluginMessage { channel: CHANNEL.into(), diff --git a/src/proto/packets/play/sound.rs b/src/proto/packets/play/sound.rs index 9366563..3002e04 100644 --- a/src/proto/packets/play/sound.rs +++ b/src/proto/packets/play/sound.rs @@ -12,7 +12,7 @@ pub async fn send( sound_name: &str, ) -> Result<(), ()> { match client_info.protocol() { - Some(p) if p <= v1_16_3::PROTOCOL => { + Some(p) if p < v1_17::PROTOCOL => { packet::write_packet( v1_16_3::game::NamedSoundEffect { sound_name: sound_name.into(), diff --git a/src/proto/packets/play/time_update.rs b/src/proto/packets/play/time_update.rs index e7cd5ec..5627c6e 100644 --- a/src/proto/packets/play/time_update.rs +++ b/src/proto/packets/play/time_update.rs @@ -15,7 +15,7 @@ pub async fn send( writer: &mut WriteHalf<'_>, ) -> Result<(), ()> { match client_info.protocol() { - Some(p) if p <= v1_16_3::PROTOCOL => { + Some(p) if p < v1_17::PROTOCOL => { packet::write_packet( v1_16_3::game::TimeUpdate { world_age: 0, diff --git a/src/proto/packets/play/title.rs b/src/proto/packets/play/title.rs index eae4125..af9a2ec 100644 --- a/src/proto/packets/play/title.rs +++ b/src/proto/packets/play/title.rs @@ -29,7 +29,7 @@ pub async fn send( let subtitle = text.lines().skip(1).collect::>().join("\n"); match client_info.protocol() { - Some(p) if p <= v1_16_3::PROTOCOL => send_v1_16_3(client, writer, title, &subtitle).await, + Some(p) if p < v1_17::PROTOCOL => send_v1_16_3(client, writer, title, &subtitle).await, _ => send_v1_17(client, writer, title, &subtitle).await, } }