aboutsummaryrefslogtreecommitdiff
path: root/azalea-client/src/disconnect.rs
diff options
context:
space:
mode:
author1zuna <1zuna@ccbluex.net>2023-12-02 05:45:12 +0100
committerGitHub <noreply@github.com>2023-12-01 22:45:12 -0600
commitfbee81e609e0cbc1bb8aff8ae649bca4e44ae465 (patch)
tree4e24226ebf0700f20036ded11ad2c3fdb1c09572 /azalea-client/src/disconnect.rs
parentd21e496bc36624900d771dacefcbe67dc8110c06 (diff)
downloadazalea-drasl-fbee81e609e0cbc1bb8aff8ae649bca4e44ae465.tar.xz
addd disconnect reason (#114)
Diffstat (limited to 'azalea-client/src/disconnect.rs')
-rw-r--r--azalea-client/src/disconnect.rs5
1 files changed, 3 insertions, 2 deletions
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<String>,
}
/// 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<DisconnectEvent>,
) {
- for DisconnectEvent { entity } in events.read() {
+ for DisconnectEvent { entity, .. } in events.read() {
commands.entity(*entity).remove::<JoinedClientBundle>();
}
}
@@ -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 });
}
}
}