From 2f1fe5f9f6fcb5ed1ed515793e383bcb37f587d9 Mon Sep 17 00:00:00 2001 From: mat Date: Wed, 25 Dec 2024 09:58:32 +0000 Subject: [PATCH] partial fix for sending Config packets during Game --- azalea-client/src/packet_handling/configuration.rs | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/azalea-client/src/packet_handling/configuration.rs b/azalea-client/src/packet_handling/configuration.rs index e427e36e..c3eedc8d 100644 --- a/azalea-client/src/packet_handling/configuration.rs +++ b/azalea-client/src/packet_handling/configuration.rs @@ -251,11 +251,18 @@ impl SendConfigurationEvent { pub fn handle_send_packet_event( mut send_packet_events: EventReader, - mut query: Query<&mut RawConnection>, + mut query: Query<(&mut RawConnection, Option<&InConfigurationState>)>, ) { for event in send_packet_events.read() { - if let Ok(raw_conn) = query.get_mut(event.sent_by) { - // debug!("Sending packet: {:?}", event.packet); + if let Ok((raw_conn, in_configuration_state)) = query.get_mut(event.sent_by) { + if in_configuration_state.is_none() { + error!( + "Tried to send a configuration packet {:?} while not in configuration state", + event.packet + ); + continue; + } + debug!("Sending packet: {:?}", event.packet); if let Err(e) = raw_conn.write_packet(event.packet.clone()) { error!("Failed to send packet: {e}"); }