diff options
| author | mat <git@matdoes.dev> | 2025-09-28 16:51:06 +1100 |
|---|---|---|
| committer | mat <git@matdoes.dev> | 2025-09-28 16:51:06 +1100 |
| commit | 5ed0c5d635b1c28721b3c32f1d6ce04a30934992 (patch) | |
| tree | 187115969a656fd74851da925edfc3fb14d26edd /azalea/examples | |
| parent | 74dcb7b37d953ec4d45dd6aac4c8e598c87def7d (diff) | |
| download | azalea-drasl-5ed0c5d635b1c28721b3c32f1d6ce04a30934992.tar.xz | |
update deps
Diffstat (limited to 'azalea/examples')
| -rw-r--r-- | azalea/examples/testbot/commands/debug.rs | 22 |
1 files changed, 20 insertions, 2 deletions
diff --git a/azalea/examples/testbot/commands/debug.rs b/azalea/examples/testbot/commands/debug.rs index 23e29b00..3cdf4cf2 100644 --- a/azalea/examples/testbot/commands/debug.rs +++ b/azalea/examples/testbot/commands/debug.rs @@ -14,11 +14,11 @@ use azalea::{ world::MinecraftEntityId, }; use azalea_core::hit_result::HitResult; -use azalea_entity::EntityKindComponent; +use azalea_entity::{EntityKindComponent, EntityUuid, metadata}; use azalea_inventory::components::MaxStackSize; use azalea_world::InstanceContainer; use bevy_app::AppExit; -use bevy_ecs::event::Events; +use bevy_ecs::{event::Events, query::With}; use parking_lot::Mutex; use super::{CommandSource, Ctx}; @@ -214,6 +214,24 @@ pub fn register(commands: &mut CommandDispatcher<Mutex<CommandSource>>) { 1 })); + commands.register(literal("players").executes(|ctx: &Ctx| { + let source = ctx.source.lock(); + let player_entities = source + .bot + .nearest_entities_by::<With<metadata::Player>, ()>(|_: &()| true); + let tab_list = source.bot.tab_list(); + for player_entity in player_entities { + let uuid = source.bot.entity_component::<EntityUuid>(player_entity); + source.reply(format!( + "{} - {} ({:?})", + player_entity, + tab_list.get(&uuid).map_or("?", |p| p.profile.name.as_str()), + uuid + )); + } + 1 + })); + commands.register(literal("debugecsleak").executes(|ctx: &Ctx| { let source = ctx.source.lock(); |
