From fbee81e609e0cbc1bb8aff8ae649bca4e44ae465 Mon Sep 17 00:00:00 2001 From: 1zuna <1zuna@ccbluex.net> Date: Sat, 2 Dec 2023 05:45:12 +0100 Subject: addd disconnect reason (#114) --- azalea-client/src/disconnect.rs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'azalea-client/src/disconnect.rs') diff --git a/azalea-client/src/disconnect.rs b/azalea-client/src/disconnect.rs index 916ef1fb..ac663a66 100644 --- a/azalea-client/src/disconnect.rs +++ b/azalea-client/src/disconnect.rs @@ -33,6 +33,7 @@ impl Plugin for DisconnectPlugin { #[derive(Event)] pub struct DisconnectEvent { pub entity: Entity, + pub reason: Option, } /// System that removes the [`JoinedClientBundle`] from the entity when it @@ -41,7 +42,7 @@ pub fn remove_components_from_disconnected_players( mut commands: Commands, mut events: EventReader, ) { - for DisconnectEvent { entity } in events.read() { + for DisconnectEvent { entity, .. } in events.read() { commands.entity(*entity).remove::(); } } @@ -64,7 +65,7 @@ fn disconnect_on_connection_dead( ) { for (entity, &is_connection_alive) in &query { if !*is_connection_alive { - disconnect_events.send(DisconnectEvent { entity }); + disconnect_events.send(DisconnectEvent { entity, reason: None }); } } } -- cgit v1.2.3