diff --git a/common/src/main/java/me/lucko/luckperms/common/commands/generic/permission/PermissionSet.java b/common/src/main/java/me/lucko/luckperms/common/commands/generic/permission/PermissionSet.java index d4ec5858c..5bb6ff0bd 100644 --- a/common/src/main/java/me/lucko/luckperms/common/commands/generic/permission/PermissionSet.java +++ b/common/src/main/java/me/lucko/luckperms/common/commands/generic/permission/PermissionSet.java @@ -46,10 +46,10 @@ import static me.lucko.luckperms.common.commands.SubCommand.getPermissionTabComp public class PermissionSet extends SharedSubCommand { public PermissionSet() { super("set", "Sets a permission for the object", Permission.USER_PERM_SET, Permission.GROUP_PERM_SET, - Predicates.notInRange(2, 4), + Predicates.notInRange(1, 4), Arg.list( Arg.create("node", true, "the permission node to set"), - Arg.create("true|false", true, "the value of the node"), + Arg.create("true|false", false, "the value of the node"), Arg.create("server", false, "the server to add the permission node on"), Arg.create("world", false, "the world to add the permission node on") ) diff --git a/common/src/main/java/me/lucko/luckperms/common/commands/generic/permission/PermissionSetTemp.java b/common/src/main/java/me/lucko/luckperms/common/commands/generic/permission/PermissionSetTemp.java index 1b726646c..c429362b4 100644 --- a/common/src/main/java/me/lucko/luckperms/common/commands/generic/permission/PermissionSetTemp.java +++ b/common/src/main/java/me/lucko/luckperms/common/commands/generic/permission/PermissionSetTemp.java @@ -47,10 +47,10 @@ import static me.lucko.luckperms.common.commands.SubCommand.getPermissionTabComp public class PermissionSetTemp extends SharedSubCommand { public PermissionSetTemp() { super("settemp", "Sets a permission for the object temporarily", Permission.USER_PERM_SETTEMP, - Permission.GROUP_PERM_SETTEMP, Predicates.notInRange(3, 5), + Permission.GROUP_PERM_SETTEMP, Predicates.notInRange(2, 5), Arg.list( Arg.create("node", true, "the permission node to set"), - Arg.create("true|false", true, "the value of the node"), + Arg.create("true|false", false, "the value of the node"), Arg.create("duration", true, "the duration until the permission node expires"), Arg.create("server", false, "the server to add the permission node on"), Arg.create("world", false, "the world to add the permission node on") diff --git a/common/src/main/java/me/lucko/luckperms/common/commands/utils/ArgumentUtils.java b/common/src/main/java/me/lucko/luckperms/common/commands/utils/ArgumentUtils.java index 0fba34296..c69e028d5 100644 --- a/common/src/main/java/me/lucko/luckperms/common/commands/utils/ArgumentUtils.java +++ b/common/src/main/java/me/lucko/luckperms/common/commands/utils/ArgumentUtils.java @@ -66,11 +66,15 @@ public class ArgumentUtils { } public static boolean handleBoolean(int index, List args) throws ArgumentException { - String bool = args.get(index); - if (!bool.equalsIgnoreCase("true") && !bool.equalsIgnoreCase("false")) { - throw new DetailedUsageException(); + if (index < args.size()) { + String bool = args.get(index); + if (bool.equalsIgnoreCase("true") || bool.equalsIgnoreCase("false")) { + return Boolean.parseBoolean(bool); + } } - return Boolean.parseBoolean(bool); + + args.add(index, "true"); + return true; } public static String handleServer(int index, List args) throws ArgumentException {