diff --git a/common/src/main/java/me/lucko/luckperms/common/commands/CommandManager.java b/common/src/main/java/me/lucko/luckperms/common/commands/CommandManager.java index 05c0bfee6..268728145 100644 --- a/common/src/main/java/me/lucko/luckperms/common/commands/CommandManager.java +++ b/common/src/main/java/me/lucko/luckperms/common/commands/CommandManager.java @@ -271,11 +271,6 @@ public class CommandManager { return CommandResult.INVALID_ARGS; } - if (e instanceof ArgumentUtils.UseInheritException) { - Message.USE_INHERIT_COMMAND.send(sender); - return CommandResult.INVALID_ARGS; - } - if (e instanceof ArgumentUtils.InvalidServerWorldException) { Message.SERVER_WORLD_INVALID_ENTRY.send(sender); return CommandResult.INVALID_ARGS; diff --git a/common/src/main/java/me/lucko/luckperms/common/commands/abstraction/SharedMainCommand.java b/common/src/main/java/me/lucko/luckperms/common/commands/abstraction/SharedMainCommand.java index 877667d2a..5a8bc2083 100644 --- a/common/src/main/java/me/lucko/luckperms/common/commands/abstraction/SharedMainCommand.java +++ b/common/src/main/java/me/lucko/luckperms/common/commands/abstraction/SharedMainCommand.java @@ -168,11 +168,6 @@ public class SharedMainCommand extends SubCommand return CommandResult.INVALID_ARGS; } - if (e instanceof ArgumentUtils.UseInheritException) { - Message.USE_INHERIT_COMMAND.send(sender); - return CommandResult.INVALID_ARGS; - } - if (e instanceof ArgumentUtils.InvalidServerWorldException) { Message.SERVER_WORLD_INVALID_ENTRY.send(sender); return CommandResult.INVALID_ARGS; diff --git a/common/src/main/java/me/lucko/luckperms/common/commands/impl/generic/permission/PermissionSet.java b/common/src/main/java/me/lucko/luckperms/common/commands/impl/generic/permission/PermissionSet.java index b656fe26f..e37b3be8a 100644 --- a/common/src/main/java/me/lucko/luckperms/common/commands/impl/generic/permission/PermissionSet.java +++ b/common/src/main/java/me/lucko/luckperms/common/commands/impl/generic/permission/PermissionSet.java @@ -61,8 +61,8 @@ public class PermissionSet extends SharedSubCommand { return CommandResult.NO_PERMISSION; } + String node = ArgumentUtils.handleString(0, args); boolean b = ArgumentUtils.handleBoolean(1, args); - String node = b ? ArgumentUtils.handleNode(0, args) : ArgumentUtils.handleString(0, args); MutableContextSet context = ArgumentUtils.handleContext(2, args, plugin); if (ArgumentPermissions.checkContext(plugin, sender, permission, context)) { diff --git a/common/src/main/java/me/lucko/luckperms/common/commands/impl/generic/permission/PermissionSetTemp.java b/common/src/main/java/me/lucko/luckperms/common/commands/impl/generic/permission/PermissionSetTemp.java index bfd4769da..2d7170c9a 100644 --- a/common/src/main/java/me/lucko/luckperms/common/commands/impl/generic/permission/PermissionSetTemp.java +++ b/common/src/main/java/me/lucko/luckperms/common/commands/impl/generic/permission/PermissionSetTemp.java @@ -66,8 +66,8 @@ public class PermissionSetTemp extends SharedSubCommand { return CommandResult.NO_PERMISSION; } + String node = ArgumentUtils.handleString(0, args); boolean b = ArgumentUtils.handleBoolean(1, args); - String node = b ? ArgumentUtils.handleNode(0, args) : ArgumentUtils.handleString(0, args); long duration = ArgumentUtils.handleDuration(2, args); MutableContextSet context = ArgumentUtils.handleContext(3, args, plugin); diff --git a/common/src/main/java/me/lucko/luckperms/common/commands/impl/generic/permission/PermissionUnset.java b/common/src/main/java/me/lucko/luckperms/common/commands/impl/generic/permission/PermissionUnset.java index 8eef511fb..28ced4a56 100644 --- a/common/src/main/java/me/lucko/luckperms/common/commands/impl/generic/permission/PermissionUnset.java +++ b/common/src/main/java/me/lucko/luckperms/common/commands/impl/generic/permission/PermissionUnset.java @@ -73,14 +73,7 @@ public class PermissionUnset extends SharedSubCommand { return CommandResult.NO_PERMISSION; } - DataMutateResult result; - if (node.startsWith("group.")) { - // unset exact - with false value only - result = holder.unsetPermissionExact(NodeFactory.newBuilder(node).setValue(false).withExtraContext(context).build()); - } else { - // standard unset - result = holder.unsetPermission(NodeFactory.newBuilder(node).withExtraContext(context).build()); - } + DataMutateResult result = holder.unsetPermission(NodeFactory.newBuilder(node).withExtraContext(context).build()); if (result.asBoolean()) { Message.UNSETPERMISSION_SUCCESS.send(sender, node, holder.getFriendlyName(), Util.contextSetToString(context)); 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 4f79b8c96..bc88189bf 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 @@ -37,13 +37,11 @@ import me.lucko.luckperms.common.utils.DateUtil; import java.util.ArrayList; import java.util.List; -import java.util.function.Function; /** * Utility class to help process arguments, and throw checked exceptions if the arguments are invalid. */ public class ArgumentUtils { - public static final Function WRAPPER = s -> s.contains(" ") ? "\"" + s + "\"" : s; public static String handleString(int index, List args) { return args.get(index).replace("{SPACE}", " "); @@ -69,16 +67,6 @@ public class ArgumentUtils { } } - public static String handleNode(int index, List args) throws ArgumentException { - String node = args.get(index).replace("{SPACE}", " "); - if (node.toLowerCase().startsWith("group.")) { - throw new UseInheritException(); - } - - - return node; - } - public static String handleName(int index, List args) throws ArgumentException { String groupName = args.get(index).toLowerCase(); if (!DataConstraints.GROUP_NAME_TEST.test(groupName)) { @@ -245,20 +233,10 @@ public class ArgumentUtils { return contextSet.makeImmutable(); } - public static abstract class ArgumentException extends CommandException { - } - - public static class DetailedUsageException extends ArgumentException { - } - - public static class UseInheritException extends ArgumentException { - } - - public static class InvalidServerWorldException extends ArgumentException { - } - - public static class PastDateException extends ArgumentException { - } + public static abstract class ArgumentException extends CommandException {} + public static class DetailedUsageException extends ArgumentException {} + public static class InvalidServerWorldException extends ArgumentException {} + public static class PastDateException extends ArgumentException {} @Getter @AllArgsConstructor diff --git a/common/src/main/java/me/lucko/luckperms/common/locale/Message.java b/common/src/main/java/me/lucko/luckperms/common/locale/Message.java index a5a80f6a9..d81e02bf7 100644 --- a/common/src/main/java/me/lucko/luckperms/common/locale/Message.java +++ b/common/src/main/java/me/lucko/luckperms/common/locale/Message.java @@ -91,7 +91,6 @@ public enum Message { GROUP_INVALID_ENTRY("&4{}&c is not a valid group name.", true), TRACK_INVALID_ENTRY("&4{}&c is not a valid track name.", true), SERVER_WORLD_INVALID_ENTRY("&cServer/world names can only contain alphanumeric characters and cannot exceed 36 characters in length.", true), - USE_INHERIT_COMMAND("&cUse the 'parent add' and 'parent remove' commands instead of specifying the node.", true), /*