diff options
| author | mat <27899617+mat-1@users.noreply.github.com> | 2025-12-28 04:31:29 -0600 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-12-28 04:31:29 -0600 |
| commit | 20c7e27250148f62bab9e7b99e4f0cd6deb82325 (patch) | |
| tree | 163b312ef4dc72c5c23be923f8ca17cdf2a7278c /azalea/examples/testbot/commands/debug.rs | |
| parent | 7ab3b8924f64f7eadb6b8928b6fae73cb06e4c2f (diff) | |
| download | azalea-drasl-20c7e27250148f62bab9e7b99e4f0cd6deb82325.tar.xz | |
Change Client::component to return a reference (#298)
* change Client::component to return a reference
* write docs
* merge main
* remove unused parking_lot feature
Diffstat (limited to 'azalea/examples/testbot/commands/debug.rs')
| -rw-r--r-- | azalea/examples/testbot/commands/debug.rs | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/azalea/examples/testbot/commands/debug.rs b/azalea/examples/testbot/commands/debug.rs index edadd697..711c3260 100644 --- a/azalea/examples/testbot/commands/debug.rs +++ b/azalea/examples/testbot/commands/debug.rs @@ -110,7 +110,7 @@ pub fn register(commands: &mut CommandDispatcher<Mutex<CommandSource>>) { let hit_result = source.bot.component::<HitResultComponent>(); - match &*hit_result { + match &**hit_result { HitResult::Block(r) => { if r.miss { source.reply("I'm not looking at anything"); @@ -121,7 +121,7 @@ pub fn register(commands: &mut CommandDispatcher<Mutex<CommandSource>>) { source.reply(format!("I'm looking at {block:?} at {block_pos:?}")); } HitResult::Entity(r) => { - let entity_kind = *source.bot.entity_component::<EntityKindComponent>(r.entity); + let entity_kind = **source.bot.entity_component::<EntityKindComponent>(r.entity); source.reply(format!( "I'm looking at {entity_kind} ({:?}) at {}", r.entity, r.location @@ -180,7 +180,7 @@ pub fn register(commands: &mut CommandDispatcher<Mutex<CommandSource>>) { "is_path_partial: {}, path.len: {}, queued_path.len: {}", executing_path.is_path_partial, executing_path.path.len(), - if let Some(queued) = executing_path.queued_path { + if let Some(queued) = &executing_path.queued_path { queued.len().to_string() } else { "n/a".to_owned() @@ -261,9 +261,7 @@ pub fn register(commands: &mut CommandDispatcher<Mutex<CommandSource>>) { thread::sleep(Duration::from_secs(1)); // dump the ecs - let mut ecs = ecs.lock(); - - + let mut ecs = ecs.write(); let report_path = env::temp_dir().join("azalea-ecs-leak-report.txt"); let mut report = File::create(&report_path).unwrap(); @@ -357,7 +355,12 @@ pub fn register(commands: &mut CommandDispatcher<Mutex<CommandSource>>) { thread::spawn(move || { thread::sleep(Duration::from_secs(1)); - source.lock().bot.ecs.lock().write_message(AppExit::Success); + source + .lock() + .bot + .ecs + .write() + .write_message(AppExit::Success); }); 1 |
