Skip to content

Commit

Permalink
partial fix for sending Config packets during Game
Browse files Browse the repository at this point in the history
  • Loading branch information
mat-1 committed Dec 25, 2024
1 parent 8f0d0d9 commit 2f1fe5f
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions azalea-client/src/packet_handling/configuration.rs
Original file line number Diff line number Diff line change
Expand Up @@ -251,11 +251,18 @@ impl SendConfigurationEvent {

pub fn handle_send_packet_event(
mut send_packet_events: EventReader<SendConfigurationEvent>,
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}");
}
Expand Down

0 comments on commit 2f1fe5f

Please sign in to comment.