From a6b656bdd2a085dde7b30c52272ea986a88ee21b Mon Sep 17 00:00:00 2001 From: Kostas214 Date: Tue, 12 Mar 2024 23:53:31 +0200 Subject: [PATCH] Added a stop command I found the absence of a stop command particuraly annoying so i implemented it in 10 minutes --- README.md | 1 + .../command/commands/StopCommand.java | 20 +++++++++++++++++++ 2 files changed, 21 insertions(+) create mode 100644 src/main/java/emu/lunarcore/command/commands/StopCommand.java diff --git a/README.md b/README.md index 36106e6..548d053 100644 --- a/README.md +++ b/README.md @@ -80,6 +80,7 @@ Server commands can be run in the server console or in-game. There is a dummy us /reload. Reloads the server config. /scene [scene id] [floor id]. Teleports the player to the specified scene. /spawn [monster/prop id] x[amount] s[stage id]. Spawns a monster or prop near the targeted player. +/stop. Stops the server /unstuck @[player id]. Unstucks an offline player if they're in a scene that doesn't load. /worldlevel [world level]. Sets the targeted player's equilibrium level. ``` diff --git a/src/main/java/emu/lunarcore/command/commands/StopCommand.java b/src/main/java/emu/lunarcore/command/commands/StopCommand.java new file mode 100644 index 0000000..bc196cb --- /dev/null +++ b/src/main/java/emu/lunarcore/command/commands/StopCommand.java @@ -0,0 +1,20 @@ +package emu.lunarcore.command.commands; + + +import emu.lunarcore.command.Command; +import emu.lunarcore.command.CommandArgs; +import emu.lunarcore.command.CommandHandler; + +@Command(label = "stop", + aliases = {"exit"}, + permission = "admin.stop", + requireTarget = false, + desc = "/stop - Stops the server") +public class StopCommand implements CommandHandler { + + @Override + public void execute(CommandArgs args) { + args.sendMessage("Stopping server"); + System.exit(1000); + } +}