aboutsummaryrefslogtreecommitdiff
path: root/azalea-client/src/plugins/packet
diff options
context:
space:
mode:
Diffstat (limited to 'azalea-client/src/plugins/packet')
-rw-r--r--azalea-client/src/plugins/packet/game/events.rs12
-rw-r--r--azalea-client/src/plugins/packet/game/mod.rs4
2 files changed, 13 insertions, 3 deletions
diff --git a/azalea-client/src/plugins/packet/game/events.rs b/azalea-client/src/plugins/packet/game/events.rs
index e5c87971..5ba9972d 100644
--- a/azalea-client/src/plugins/packet/game/events.rs
+++ b/azalea-client/src/plugins/packet/game/events.rs
@@ -63,10 +63,18 @@ impl SendPacketEvent {
pub fn handle_outgoing_packets(
mut send_packet_events: EventReader<SendPacketEvent>,
- mut query: Query<&mut RawConnection>,
+ mut query: Query<(&mut RawConnection, Option<&InGameState>)>,
) {
for event in send_packet_events.read() {
- if let Ok(raw_connection) = query.get_mut(event.sent_by) {
+ if let Ok((raw_connection, in_game_state)) = query.get_mut(event.sent_by) {
+ if in_game_state.is_none() {
+ error!(
+ "Tried to send a game packet {:?} while not in game state",
+ event.packet
+ );
+ continue;
+ }
+
// debug!("Sending packet: {:?}", event.packet);
if let Err(e) = raw_connection.write_packet(event.packet.clone()) {
error!("Failed to send packet: {e}");
diff --git a/azalea-client/src/plugins/packet/game/mod.rs b/azalea-client/src/plugins/packet/game/mod.rs
index a13f1490..a715a77e 100644
--- a/azalea-client/src/plugins/packet/game/mod.rs
+++ b/azalea-client/src/plugins/packet/game/mod.rs
@@ -1503,10 +1503,12 @@ impl GamePacketHandler<'_> {
}
pub fn start_configuration(&mut self, _p: &ClientboundStartConfiguration) {
+ debug!("Got start configuration packet");
+
as_system::<(Commands, EventWriter<_>)>(self.ecs, |(mut commands, mut events)| {
events.send(SendPacketEvent::new(
self.player,
- ServerboundConfigurationAcknowledged {},
+ ServerboundConfigurationAcknowledged,
));
commands