diff options
| author | mat <git@matdoes.dev> | 2025-08-23 11:24:07 -1000 |
|---|---|---|
| committer | mat <git@matdoes.dev> | 2025-08-23 11:24:07 -1000 |
| commit | 3aba53afad71369af95733143fff2fdc7f6a1fe8 (patch) | |
| tree | c7993bd8aa448c633e6909c594faed1f17c0b9bc /azalea/examples | |
| parent | 776c8dbd5e1441a4345c0077025a180cad6f5666 (diff) | |
| download | azalea-drasl-3aba53afad71369af95733143fff2fdc7f6a1fe8.tar.xz | |
handle AppExit event
Diffstat (limited to 'azalea/examples')
| -rw-r--r-- | azalea/examples/testbot/commands/debug.rs | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/azalea/examples/testbot/commands/debug.rs b/azalea/examples/testbot/commands/debug.rs index b3a8b419..06a49ce2 100644 --- a/azalea/examples/testbot/commands/debug.rs +++ b/azalea/examples/testbot/commands/debug.rs @@ -1,6 +1,6 @@ //! Commands for debugging and getting the current state of the bot. -use std::{env, fs::File, io::Write, process, thread, time::Duration}; +use std::{env, fs::File, io::Write, thread, time::Duration}; use azalea::{ BlockPos, @@ -17,6 +17,7 @@ use azalea_core::hit_result::HitResult; use azalea_entity::EntityKindComponent; use azalea_inventory::components::MaxStackSize; use azalea_world::InstanceContainer; +use bevy_app::AppExit; use bevy_ecs::event::Events; use parking_lot::Mutex; @@ -316,10 +317,11 @@ pub fn register(commands: &mut CommandDispatcher<Mutex<CommandSource>>) { source.bot.disconnect(); + let source = ctx.source.clone(); thread::spawn(move || { thread::sleep(Duration::from_secs(1)); - process::exit(0); + source.lock().bot.ecs.lock().send_event(AppExit::Success); }); 1 |
