diff --git a/src/main/java/de/bixilon/minosoft/terminal/commands/Commands.kt b/src/main/java/de/bixilon/minosoft/terminal/commands/Commands.kt index 7f0202182..a4607f707 100644 --- a/src/main/java/de/bixilon/minosoft/terminal/commands/Commands.kt +++ b/src/main/java/de/bixilon/minosoft/terminal/commands/Commands.kt @@ -13,15 +13,12 @@ package de.bixilon.minosoft.terminal.commands -import de.bixilon.minosoft.terminal.commands.connection.ActionCommand -import de.bixilon.minosoft.terminal.commands.connection.DebugCommand -import de.bixilon.minosoft.terminal.commands.connection.QueryCommand -import de.bixilon.minosoft.terminal.commands.connection.SayCommand +import de.bixilon.minosoft.terminal.commands.connection.* import de.bixilon.minosoft.terminal.commands.rendering.ReloadCommand object Commands { val COMMANDS: List = listOf( - HelpCommand, + HelpCommand, QuitCommand, ConnectionManageCommand, AccountManageCommand, ReloadCommand, @@ -36,5 +33,6 @@ object Commands { SayCommand, ActionCommand, QueryCommand, DebugCommand, + DisconnectCommand, ) } diff --git a/src/main/java/de/bixilon/minosoft/terminal/commands/QuitCommand.kt b/src/main/java/de/bixilon/minosoft/terminal/commands/QuitCommand.kt new file mode 100644 index 000000000..73b5d2f6b --- /dev/null +++ b/src/main/java/de/bixilon/minosoft/terminal/commands/QuitCommand.kt @@ -0,0 +1,21 @@ +/* + * Minosoft + * Copyright (C) 2020-2023 Moritz Zwerger + * + * This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along with this program. If not, see . + * + * This software is not affiliated with Mojang AB, the original developer of Minecraft. + */ + +package de.bixilon.minosoft.terminal.commands + +import de.bixilon.kutil.shutdown.ShutdownManager +import de.bixilon.minosoft.commands.nodes.LiteralNode + +object QuitCommand : Command { + override var node = LiteralNode("quit", setOf("exit"), executor = { ShutdownManager.shutdown() }) +} diff --git a/src/main/java/de/bixilon/minosoft/terminal/commands/connection/DisconnectCommand.kt b/src/main/java/de/bixilon/minosoft/terminal/commands/connection/DisconnectCommand.kt new file mode 100644 index 000000000..1a3cae2e3 --- /dev/null +++ b/src/main/java/de/bixilon/minosoft/terminal/commands/connection/DisconnectCommand.kt @@ -0,0 +1,20 @@ +/* + * Minosoft + * Copyright (C) 2020-2022 Moritz Zwerger + * + * This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along with this program. If not, see . + * + * This software is not affiliated with Mojang AB, the original developer of Minecraft. + */ + +package de.bixilon.minosoft.terminal.commands.connection + +import de.bixilon.minosoft.commands.nodes.LiteralNode + +object DisconnectCommand : ConnectionCommand { + override var node = LiteralNode("disconnect", setOf("leave"), executor = { it.connection.disconnect() }) +}