fix: make stop and restart work correctly when a player runs it instead of console

This commit is contained in:
ChomeNS
2025-07-27 14:41:51 +07:00
parent 9dfa269271
commit 3da96f9347
3 changed files with 9 additions and 3 deletions

View File

@@ -1 +1 @@
3507
3517

View File

@@ -25,7 +25,10 @@ public class RestartCommand extends Command {
final String reason = context.getString(true, false);
Main.stop(12, reason.isEmpty() ? null : reason, I18nUtilities.get("info.restarting"));
new Thread(
() -> Main.stop(12, reason.isEmpty() ? null : reason, I18nUtilities.get("info.restarting")),
"ChomeNS Bot Shutdown Thread"
).start();
return Component.translatable("commands.restart.output", bot.colorPalette.defaultColor);
}

View File

@@ -24,7 +24,10 @@ public class StopCommand extends Command {
final String reason = context.getString(true, false);
Main.stop(0, reason.isEmpty() ? null : reason);
new Thread(
() -> Main.stop(0, reason.isEmpty() ? null : reason),
"ChomeNS Bot Shutdown Thread"
).start();
return Component.translatable("commands.stop.output", bot.colorPalette.defaultColor);
}