diff options
| author | mat <git@matdoes.dev> | 2025-02-21 21:51:26 +0000 |
|---|---|---|
| committer | mat <git@matdoes.dev> | 2025-02-21 21:51:26 +0000 |
| commit | f5f15362f2cb48088eb8ccf80988f994fecd81c9 (patch) | |
| tree | a6c697556aaa3a43ed12eb15fc43946de9ffdb0f /azalea-client/src | |
| parent | 5fdea4c0b7c5617133a8b497b9ead8829a21135d (diff) | |
| download | azalea-drasl-f5f15362f2cb48088eb8ccf80988f994fecd81c9.tar.xz | |
fix some components not being removed from clients and add debugecsleak testbot command
Diffstat (limited to 'azalea-client/src')
| -rw-r--r-- | azalea-client/src/disconnect.rs | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/azalea-client/src/disconnect.rs b/azalea-client/src/disconnect.rs index 06648691..a92423d7 100644 --- a/azalea-client/src/disconnect.rs +++ b/azalea-client/src/disconnect.rs @@ -1,7 +1,7 @@ //! Disconnect a client from the server. use azalea_chat::FormattedText; -use azalea_entity::{EntityBundle, LocalEntity}; +use azalea_entity::{metadata::PlayerMetadataBundle, EntityBundle, LocalEntity}; use bevy_app::{App, Plugin, PostUpdate}; use bevy_ecs::{ component::Component, @@ -15,7 +15,10 @@ use bevy_ecs::{ use derive_more::Deref; use tracing::trace; -use crate::{client::JoinedClientBundle, events::LocalPlayerEvents, raw_connection::RawConnection}; +use crate::{ + client::JoinedClientBundle, events::LocalPlayerEvents, raw_connection::RawConnection, + InstanceHolder, +}; pub struct DisconnectPlugin; impl Plugin for DisconnectPlugin { @@ -39,8 +42,8 @@ pub struct DisconnectEvent { pub reason: Option<FormattedText>, } -/// System that removes the [`JoinedClientBundle`] from the entity when it -/// receives a [`DisconnectEvent`]. +/// A system that removes the several components from our clients when they get +/// a [`DisconnectEvent`]. pub fn remove_components_from_disconnected_players( mut commands: Commands, mut events: EventReader<DisconnectEvent>, @@ -51,6 +54,8 @@ pub fn remove_components_from_disconnected_players( .entity(*entity) .remove::<JoinedClientBundle>() .remove::<EntityBundle>() + .remove::<InstanceHolder>() + .remove::<PlayerMetadataBundle>() // this makes it close the tcp connection .remove::<RawConnection>() // swarm detects when this tx gets dropped to fire SwarmEvent::Disconnect |
