Skip to content

Commit 2f1fe5f

Browse files
committed
partial fix for sending Config packets during Game
1 parent 8f0d0d9 commit 2f1fe5f

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

azalea-client/src/packet_handling/configuration.rs

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -251,11 +251,18 @@ impl SendConfigurationEvent {
251251

252252
pub fn handle_send_packet_event(
253253
mut send_packet_events: EventReader<SendConfigurationEvent>,
254-
mut query: Query<&mut RawConnection>,
254+
mut query: Query<(&mut RawConnection, Option<&InConfigurationState>)>,
255255
) {
256256
for event in send_packet_events.read() {
257-
if let Ok(raw_conn) = query.get_mut(event.sent_by) {
258-
// debug!("Sending packet: {:?}", event.packet);
257+
if let Ok((raw_conn, in_configuration_state)) = query.get_mut(event.sent_by) {
258+
if in_configuration_state.is_none() {
259+
error!(
260+
"Tried to send a configuration packet {:?} while not in configuration state",
261+
event.packet
262+
);
263+
continue;
264+
}
265+
debug!("Sending packet: {:?}", event.packet);
259266
if let Err(e) = raw_conn.write_packet(event.packet.clone()) {
260267
error!("Failed to send packet: {e}");
261268
}

0 commit comments

Comments
 (0)