FINALLY a nice stop command, finally stopping the bot gracefully, no force, nice and slow.
This commit is contained in:
parent
06a1ce9ef2
commit
87477ce013
2 changed files with 34 additions and 0 deletions
|
@ -0,0 +1,33 @@
|
||||||
|
package land.chipmunk.chayapak.chomens_bot.commands;
|
||||||
|
|
||||||
|
import land.chipmunk.chayapak.chomens_bot.Bot;
|
||||||
|
import land.chipmunk.chayapak.chomens_bot.command.Command;
|
||||||
|
import land.chipmunk.chayapak.chomens_bot.command.CommandContext;
|
||||||
|
import land.chipmunk.chayapak.chomens_bot.command.CommandException;
|
||||||
|
import land.chipmunk.chayapak.chomens_bot.command.TrustLevel;
|
||||||
|
import land.chipmunk.chayapak.chomens_bot.util.ColorUtilities;
|
||||||
|
import net.kyori.adventure.text.Component;
|
||||||
|
|
||||||
|
public class StopCommand extends Command {
|
||||||
|
public StopCommand () {
|
||||||
|
super(
|
||||||
|
"stop",
|
||||||
|
"Gracefully stops the bot",
|
||||||
|
new String[] { "<ownerHash>" },
|
||||||
|
new String[] {},
|
||||||
|
TrustLevel.OWNER,
|
||||||
|
false
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Component execute(CommandContext context) throws CommandException {
|
||||||
|
context.checkOverloadArgs(0);
|
||||||
|
|
||||||
|
final Bot bot = context.bot;
|
||||||
|
|
||||||
|
System.exit(0);
|
||||||
|
|
||||||
|
return Component.text("Stopping").color(ColorUtilities.getColorByString(bot.config.colorPalette.defaultColor));
|
||||||
|
}
|
||||||
|
}
|
|
@ -55,6 +55,7 @@ public class CommandHandlerPlugin {
|
||||||
registerCommand(new WhitelistCommand());
|
registerCommand(new WhitelistCommand());
|
||||||
registerCommand(new SeenCommand());
|
registerCommand(new SeenCommand());
|
||||||
registerCommand(new IPFilterCommand());
|
registerCommand(new IPFilterCommand());
|
||||||
|
registerCommand(new StopCommand());
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean disabled = false;
|
public boolean disabled = false;
|
||||||
|
|
Loading…
Reference in a new issue