From 3aba53afad71369af95733143fff2fdc7f6a1fe8 Mon Sep 17 00:00:00 2001 From: mat Date: Sat, 23 Aug 2025 11:24:07 -1000 Subject: handle AppExit event --- azalea/examples/testbot/commands/debug.rs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'azalea/examples') 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>) { 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 -- cgit v1.2.3