diff options
author | Keuin <[email protected]> | 2020-04-23 20:13:35 +0800 |
---|---|---|
committer | keuin <[email protected]> | 2020-04-23 20:13:35 +0800 |
commit | ba19ab350516e26a8e52cc217878bde63c0b7eee (patch) | |
tree | 482a4ad4b4b8c4d630833f93863195f56ef34244 /src/main/java/com/keuin/kbackupfabric/KBCommandRegister.java | |
parent | ffd446e4decbe487b8e56b6726be0ecc81f8428d (diff) |
Refactored code.
Added startup message on the first start after restoring a backup.
Adjusted text color.
Diffstat (limited to 'src/main/java/com/keuin/kbackupfabric/KBCommandRegister.java')
-rw-r--r-- | src/main/java/com/keuin/kbackupfabric/KBCommandRegister.java | 32 |
1 files changed, 0 insertions, 32 deletions
diff --git a/src/main/java/com/keuin/kbackupfabric/KBCommandRegister.java b/src/main/java/com/keuin/kbackupfabric/KBCommandRegister.java deleted file mode 100644 index a9dcb38..0000000 --- a/src/main/java/com/keuin/kbackupfabric/KBCommandRegister.java +++ /dev/null @@ -1,32 +0,0 @@ -package com.keuin.kbackupfabric; - -import com.keuin.kbackupfabric.util.PermissionValidator; -import com.mojang.brigadier.CommandDispatcher; -import com.mojang.brigadier.arguments.StringArgumentType; -import net.minecraft.server.command.CommandManager; -import net.minecraft.server.command.ServerCommandSource; - -public final class KBCommandRegister { - // First make method to register - public static void register(CommandDispatcher<ServerCommandSource> dispatcher) { - // register /kb and /kb help for help menu - dispatcher.register(CommandManager.literal("kb").executes(KBCommandHandler::help)); - dispatcher.register(CommandManager.literal("kb").then(CommandManager.literal("help").executes(KBCommandHandler::help))); - - // register /kb list for showing the backup list. OP is required. - dispatcher.register(CommandManager.literal("kb").then(CommandManager.literal("list").requires(PermissionValidator::op).executes(KBCommandHandler::list))); - - // register /kb backup [name] for performing backup. OP is required. - dispatcher.register(CommandManager.literal("kb").then(CommandManager.literal("backup").then(CommandManager.argument("backupName", StringArgumentType.string()).requires(PermissionValidator::op).executes(KBCommandHandler::backup)).requires(PermissionValidator::op).executes(KBCommandHandler::backupWithDefaultName))); - - // register /kb restore <name> for performing restore. OP is required. - dispatcher.register(CommandManager.literal("kb").then(CommandManager.literal("restore").then(CommandManager.argument("backupName", StringArgumentType.string()).requires(PermissionValidator::op).executes(KBCommandHandler::restore)).executes(KBCommandHandler::list))); - - // register /kb confirm for confirming the execution. OP is required. - dispatcher.register(CommandManager.literal("kb").then(CommandManager.literal("confirm").requires(PermissionValidator::op).executes(KBCommandHandler::confirm))); - - // register /kb cancel for cancelling the execution to be confirmed. OP is required. - dispatcher.register(CommandManager.literal("kb").then(CommandManager.literal("cancel").requires(PermissionValidator::op).executes(KBCommandHandler::cancel))); - - } -} |