summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKeuin <[email protected]>2022-09-20 23:28:55 +0800
committerKeuin <[email protected]>2022-09-20 23:28:55 +0800
commitce4fb0e736a0b5a5732c9e4e9850bb31ad9b36a7 (patch)
treefec0f1d6d53fd25f8235756b6bb97d29d0294e04
parent26428b148a8759c90c9b1b9e642af01fd5571f86 (diff)
Fix: OP cannot make backups or restore with default perm level without luckperms.
-rw-r--r--src/main/java/com/keuin/kbackupfabric/KBCommandsRegister.java27
1 files changed, 15 insertions, 12 deletions
diff --git a/src/main/java/com/keuin/kbackupfabric/KBCommandsRegister.java b/src/main/java/com/keuin/kbackupfabric/KBCommandsRegister.java
index 5ec0239..b502ad5 100644
--- a/src/main/java/com/keuin/kbackupfabric/KBCommandsRegister.java
+++ b/src/main/java/com/keuin/kbackupfabric/KBCommandsRegister.java
@@ -9,6 +9,9 @@ import net.minecraft.server.command.CommandManager;
import net.minecraft.server.command.ServerCommandSource;
public final class KBCommandsRegister {
+
+ public static final int DEFAULT_REQUIRED_LEVEL = 2;
+
// First make method to register
public static void registerCommands(CommandDispatcher<ServerCommandSource> dispatcher) {
@@ -24,24 +27,24 @@ public final class KBCommandsRegister {
// register /kb list for showing the backup list. OP is required.
dispatcher.register(CommandManager.literal("kb")
.then(CommandManager.literal("list")
- .requires(Permissions.require("kb.list", 4))
+ .requires(Permissions.require("kb.list", DEFAULT_REQUIRED_LEVEL))
.executes(KBCommands::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.greedyString())
- .requires(Permissions.require("kb.backup", 4))
+ .requires(Permissions.require("kb.backup", DEFAULT_REQUIRED_LEVEL))
.executes(KBCommands::primitiveBackup)
- ).requires(Permissions.require("kb.backup", 4))
+ ).requires(Permissions.require("kb.backup", DEFAULT_REQUIRED_LEVEL))
.executes(KBCommands::primitiveBackupWithDefaultName)));
// register /kb incbak [name] for performing incremental backup. OP is required.
dispatcher.register(CommandManager.literal("kb")
.then(CommandManager.literal("incbak")
.then(CommandManager.argument("backupName", StringArgumentType.greedyString())
- .requires(Permissions.require("kb.incbak", 4))
+ .requires(Permissions.require("kb.incbak", DEFAULT_REQUIRED_LEVEL))
.executes(KBCommands::incrementalBackup))
- .requires(Permissions.require("kb.incbak", 4))
+ .requires(Permissions.require("kb.incbak", DEFAULT_REQUIRED_LEVEL))
.executes(KBCommands::incrementalBackupWithDefaultName)
));
@@ -50,9 +53,9 @@ public final class KBCommandsRegister {
.then(CommandManager.literal("restore")
.then(CommandManager.argument("backupName", StringArgumentType.greedyString())
.suggests(BackupNameSuggestionProvider.getProvider())
- .requires(Permissions.require("kb.restore", 4))
+ .requires(Permissions.require("kb.restore", DEFAULT_REQUIRED_LEVEL))
.executes(KBCommands::restore))
- .requires(Permissions.require("kb.list", 4))
+ .requires(Permissions.require("kb.list", DEFAULT_REQUIRED_LEVEL))
.executes(KBCommands::list)));
// register /kb delete [name] for deleting an existing backup. OP is required.
@@ -60,26 +63,26 @@ public final class KBCommandsRegister {
.then(CommandManager.literal("delete")
.then(CommandManager.argument("backupName", StringArgumentType.greedyString())
.suggests(BackupNameSuggestionProvider.getProvider())
-// .requires(Permissions.require("kb.delete", 4))
+ .requires(Permissions.require("kb.delete", DEFAULT_REQUIRED_LEVEL))
.executes(KBCommands::delete))
- .requires(Permissions.require("kb.delete", 4))));
+ .requires(Permissions.require("kb.delete", DEFAULT_REQUIRED_LEVEL))));
// register /kb confirm for confirming the execution. OP is required.
dispatcher.register(CommandManager.literal("kb")
.then(CommandManager.literal("confirm")
- .requires(Permissions.require("kb.confirm", 4))
+ .requires(Permissions.require("kb.confirm", DEFAULT_REQUIRED_LEVEL))
.executes(KBCommands::confirm)));
// register /kb cancel for cancelling the execution to be confirmed. OP is required.
dispatcher.register(CommandManager.literal("kb")
.then(CommandManager.literal("cancel")
- .requires(Permissions.require("kb.cancel", 4))
+ .requires(Permissions.require("kb.cancel", DEFAULT_REQUIRED_LEVEL))
.executes(KBCommands::cancel)));
// register /kb prev for showing the latest backup. OP is required.
dispatcher.register(CommandManager.literal("kb")
.then(CommandManager.literal("prev")
- .requires(Permissions.require("kb.prev", 4))
+ .requires(Permissions.require("kb.prev", DEFAULT_REQUIRED_LEVEL))
.executes(KBCommands::prev)));
// // register /kb setMethod for selecting backup method (zip, incremental)