commands: disconnect, quit

This commit is contained in:
Moritz Zwerger 2023-07-30 01:53:06 +02:00
parent 8de97ec940
commit 8041df4d71
No known key found for this signature in database
GPG Key ID: 5CAD791931B09AC4
3 changed files with 44 additions and 5 deletions

View File

@ -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<Command> = listOf(
HelpCommand,
HelpCommand, QuitCommand,
ConnectionManageCommand,
AccountManageCommand,
ReloadCommand,
@ -36,5 +33,6 @@ object Commands {
SayCommand,
ActionCommand, QueryCommand,
DebugCommand,
DisconnectCommand,
)
}

View File

@ -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 <https://www.gnu.org/licenses/>.
*
* 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() })
}

View File

@ -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 <https://www.gnu.org/licenses/>.
*
* 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() })
}