From 93d54373c6c335dd72c8fbc2847df75e1c75c55a Mon Sep 17 00:00:00 2001 From: Luck Date: Wed, 28 Sep 2016 20:59:08 +0100 Subject: [PATCH] Add detailed command info system --- .../java/me/lucko/luckperms/commands/Arg.java | 53 +++++++++++++++++++ .../lucko/luckperms/commands/MainCommand.java | 2 +- .../lucko/luckperms/commands/SubCommand.java | 37 ++++++++----- .../group/subcommands/GroupAddPrefix.java | 15 +++--- .../group/subcommands/GroupAddSuffix.java | 15 +++--- .../group/subcommands/GroupAddTempPrefix.java | 16 +++--- .../group/subcommands/GroupAddTempSuffix.java | 16 +++--- .../group/subcommands/GroupBulkChange.java | 14 ++--- .../group/subcommands/GroupChatMeta.java | 2 +- .../group/subcommands/GroupClear.java | 2 +- .../group/subcommands/GroupHasPerm.java | 10 +++- .../commands/group/subcommands/GroupInfo.java | 2 +- .../group/subcommands/GroupInheritsPerm.java | 10 +++- .../group/subcommands/GroupListNodes.java | 2 +- .../group/subcommands/GroupListParents.java | 2 +- .../group/subcommands/GroupRemovePrefix.java | 15 +++--- .../group/subcommands/GroupRemoveSuffix.java | 15 +++--- .../subcommands/GroupRemoveTempPrefix.java | 16 +++--- .../subcommands/GroupRemoveTempSuffix.java | 16 +++--- .../group/subcommands/GroupRename.java | 9 ++-- .../group/subcommands/GroupSetInherit.java | 17 +++--- .../group/subcommands/GroupSetPermission.java | 19 ++++--- .../subcommands/GroupSetTempInherit.java | 18 ++++--- .../subcommands/GroupSetTempPermission.java | 21 +++++--- .../group/subcommands/GroupShowTracks.java | 2 +- .../subcommands/GroupUnSetPermission.java | 16 +++--- .../group/subcommands/GroupUnsetInherit.java | 17 +++--- .../subcommands/GroupUnsetTempInherit.java | 17 +++--- .../subcommands/GroupUnsetTempPermission.java | 17 +++--- .../commands/log/subcommands/LogExport.java | 9 ++-- .../log/subcommands/LogGroupHistory.java | 13 ++--- .../commands/log/subcommands/LogNotify.java | 9 ++-- .../commands/log/subcommands/LogRecent.java | 7 ++- .../commands/log/subcommands/LogSearch.java | 12 +++-- .../log/subcommands/LogTrackHistory.java | 12 +++-- .../log/subcommands/LogUserHistory.java | 7 ++- .../subcommands/MigrationBPermissions.java | 2 +- .../subcommands/MigrationBungeePerms.java | 2 +- .../subcommands/MigrationGroupManager.java | 9 ++-- .../subcommands/MigrationPermissionsEx.java | 9 ++-- .../subcommands/MigrationPowerfulPerms.java | 16 +++--- .../subcommands/MigrationZPermissions.java | 9 ++-- .../track/subcommands/TrackAppend.java | 6 ++- .../track/subcommands/TrackClear.java | 2 +- .../commands/track/subcommands/TrackInfo.java | 2 +- .../track/subcommands/TrackInsert.java | 10 ++-- .../track/subcommands/TrackRemove.java | 6 ++- .../track/subcommands/TrackRename.java | 9 ++-- .../user/subcommands/UserAddGroup.java | 15 +++--- .../user/subcommands/UserAddPrefix.java | 15 +++--- .../user/subcommands/UserAddSuffix.java | 15 +++--- .../user/subcommands/UserAddTempGroup.java | 17 +++--- .../user/subcommands/UserAddTempPrefix.java | 16 +++--- .../user/subcommands/UserAddTempSuffix.java | 16 +++--- .../user/subcommands/UserBulkChange.java | 14 ++--- .../user/subcommands/UserChatMeta.java | 2 +- .../commands/user/subcommands/UserClear.java | 2 +- .../commands/user/subcommands/UserDemote.java | 4 +- .../user/subcommands/UserGetUUID.java | 2 +- .../user/subcommands/UserHasPerm.java | 10 +++- .../commands/user/subcommands/UserInfo.java | 2 +- .../user/subcommands/UserInheritsPerm.java | 10 +++- .../user/subcommands/UserListGroups.java | 2 +- .../user/subcommands/UserListNodes.java | 2 +- .../user/subcommands/UserPromote.java | 4 +- .../user/subcommands/UserRemoveGroup.java | 16 +++--- .../user/subcommands/UserRemovePrefix.java | 15 +++--- .../user/subcommands/UserRemoveSuffix.java | 15 +++--- .../user/subcommands/UserRemoveTempGroup.java | 16 +++--- .../subcommands/UserRemoveTempPrefix.java | 16 +++--- .../subcommands/UserRemoveTempSuffix.java | 16 +++--- .../user/subcommands/UserSetPermission.java | 19 ++++--- .../user/subcommands/UserSetPrimaryGroup.java | 9 ++-- .../subcommands/UserSetTempPermission.java | 21 +++++--- .../user/subcommands/UserShowPos.java | 4 +- .../user/subcommands/UserShowTracks.java | 4 +- .../user/subcommands/UserUnSetPermission.java | 16 +++--- .../subcommands/UserUnsetTempPermission.java | 17 +++--- .../subcommands/BulkEditGroup.java | 16 +++--- .../subcommands/BulkEditPermission.java | 15 +++--- 80 files changed, 578 insertions(+), 349 deletions(-) create mode 100644 common/src/main/java/me/lucko/luckperms/commands/Arg.java diff --git a/common/src/main/java/me/lucko/luckperms/commands/Arg.java b/common/src/main/java/me/lucko/luckperms/commands/Arg.java new file mode 100644 index 000000000..130e7e254 --- /dev/null +++ b/common/src/main/java/me/lucko/luckperms/commands/Arg.java @@ -0,0 +1,53 @@ +/* + * Copyright (c) 2016 Lucko (Luck) + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ + +package me.lucko.luckperms.commands; + +import com.google.common.collect.ImmutableList; +import lombok.AccessLevel; +import lombok.AllArgsConstructor; +import lombok.Getter; + +@Getter +@AllArgsConstructor(access = AccessLevel.PRIVATE) +public class Arg { + public static Arg create(String name, boolean required, String description) { + return new Arg(name, required, description); + } + + public static ImmutableList list(Arg... args) { + return ImmutableList.copyOf(args); + } + + private final String name; + private final boolean required; + private final String description; + + public String asPrettyString() { + if (required) { + return "&8<&7" + name + "&8>"; + } else { + return "&8[&7" + name + "&8]"; + } + } + +} diff --git a/common/src/main/java/me/lucko/luckperms/commands/MainCommand.java b/common/src/main/java/me/lucko/luckperms/commands/MainCommand.java index 2e13b9a49..4b659f5da 100644 --- a/common/src/main/java/me/lucko/luckperms/commands/MainCommand.java +++ b/common/src/main/java/me/lucko/luckperms/commands/MainCommand.java @@ -98,7 +98,7 @@ public abstract class MainCommand { } if (sub.getIsArgumentInvalid().test(strippedArgs.size())) { - sub.sendUsage(sender); + sub.sendDetailedUsage(sender); return CommandResult.INVALID_ARGS; } diff --git a/common/src/main/java/me/lucko/luckperms/commands/SubCommand.java b/common/src/main/java/me/lucko/luckperms/commands/SubCommand.java index 9a86ea2e4..c1790743e 100644 --- a/common/src/main/java/me/lucko/luckperms/commands/SubCommand.java +++ b/common/src/main/java/me/lucko/luckperms/commands/SubCommand.java @@ -22,6 +22,8 @@ package me.lucko.luckperms.commands; +import com.google.common.collect.ImmutableList; +import lombok.AllArgsConstructor; import lombok.Getter; import me.lucko.luckperms.LuckPermsPlugin; import me.lucko.luckperms.constants.Message; @@ -41,6 +43,7 @@ import java.util.stream.Collectors; * Abstract SubCommand class */ @Getter +@AllArgsConstructor public abstract class SubCommand { /** @@ -53,11 +56,6 @@ public abstract class SubCommand { */ private final String description; - /** - * The command usage - */ - private final String usage; - /** * The permission needed to use this command */ @@ -68,13 +66,7 @@ public abstract class SubCommand { */ private final Predicate isArgumentInvalid; - public SubCommand(String name, String description, String usage, Permission permission, Predicate isArgumentInvalid) { - this.name = name; - this.description = description; - this.permission = permission; - this.isArgumentInvalid = isArgumentInvalid; - this.usage = usage.replace("<", "&8<&7").replace(">", "&8>&7").replace("[", "&8[&7").replace("]", "&8]&7"); - } + private final ImmutableList args; /** * Called when this sub command is ran @@ -103,7 +95,26 @@ public abstract class SubCommand { * @param sender the sender to send the usage to */ public void sendUsage(Sender sender) { - Util.sendPluginMessage(sender, "&3> &a" + getName() + (usage.isEmpty() ? "" : "&3 - &7" + getUsage())); + String usage = ""; + if (args != null) { + usage += "&3 - &7"; + for (Arg arg : args) { + usage += arg.asPrettyString() + " "; + } + } + + Util.sendPluginMessage(sender, "&3> &a" + getName() + usage); + } + + public void sendDetailedUsage(Sender sender) { + Util.sendPluginMessage(sender, "&3&lCommand Usage &3- &b" + getName()); + Util.sendPluginMessage(sender, "&b> &7" + getDescription()); + if (args != null) { + Util.sendPluginMessage(sender, "&3Arguments:"); + for (Arg arg : args) { + Util.sendPluginMessage(sender, "&b- " + arg.asPrettyString() + "&3 -> &7" + arg.getDescription()); + } + } } /** diff --git a/common/src/main/java/me/lucko/luckperms/commands/group/subcommands/GroupAddPrefix.java b/common/src/main/java/me/lucko/luckperms/commands/group/subcommands/GroupAddPrefix.java index d6696f322..abbad5817 100644 --- a/common/src/main/java/me/lucko/luckperms/commands/group/subcommands/GroupAddPrefix.java +++ b/common/src/main/java/me/lucko/luckperms/commands/group/subcommands/GroupAddPrefix.java @@ -23,10 +23,7 @@ package me.lucko.luckperms.commands.group.subcommands; import me.lucko.luckperms.LuckPermsPlugin; -import me.lucko.luckperms.commands.CommandResult; -import me.lucko.luckperms.commands.Predicate; -import me.lucko.luckperms.commands.Sender; -import me.lucko.luckperms.commands.SubCommand; +import me.lucko.luckperms.commands.*; import me.lucko.luckperms.constants.Message; import me.lucko.luckperms.constants.Permission; import me.lucko.luckperms.data.LogEntry; @@ -38,8 +35,14 @@ import java.util.List; public class GroupAddPrefix extends SubCommand { public GroupAddPrefix() { - super("addprefix", "Adds a prefix to the group", " [server] [world]", - Permission.GROUP_ADDPREFIX, Predicate.notInRange(2, 4)); + super("addprefix", "Adds a prefix to the group", Permission.GROUP_ADDPREFIX, Predicate.notInRange(2, 4), + Arg.list( + Arg.create("priority", true, "the priority to add the prefix at"), + Arg.create("prefix", true, "the prefix string"), + Arg.create("server", false, "the server to add the prefix on"), + Arg.create("world", false, "the world to add the prefix on") + ) + ); } @Override diff --git a/common/src/main/java/me/lucko/luckperms/commands/group/subcommands/GroupAddSuffix.java b/common/src/main/java/me/lucko/luckperms/commands/group/subcommands/GroupAddSuffix.java index cb92e5252..83033f4d6 100644 --- a/common/src/main/java/me/lucko/luckperms/commands/group/subcommands/GroupAddSuffix.java +++ b/common/src/main/java/me/lucko/luckperms/commands/group/subcommands/GroupAddSuffix.java @@ -23,10 +23,7 @@ package me.lucko.luckperms.commands.group.subcommands; import me.lucko.luckperms.LuckPermsPlugin; -import me.lucko.luckperms.commands.CommandResult; -import me.lucko.luckperms.commands.Predicate; -import me.lucko.luckperms.commands.Sender; -import me.lucko.luckperms.commands.SubCommand; +import me.lucko.luckperms.commands.*; import me.lucko.luckperms.constants.Message; import me.lucko.luckperms.constants.Permission; import me.lucko.luckperms.data.LogEntry; @@ -38,8 +35,14 @@ import java.util.List; public class GroupAddSuffix extends SubCommand { public GroupAddSuffix() { - super("addsuffix", "Adds a suffix to the group", " [server] [world]", - Permission.GROUP_ADDSUFFIX, Predicate.notInRange(2, 4)); + super("addsuffix", "Adds a suffix to the group", Permission.GROUP_ADDSUFFIX, Predicate.notInRange(2, 4), + Arg.list( + Arg.create("priority", true, "the priority to add the suffix at"), + Arg.create("suffix", true, "the suffix string"), + Arg.create("server", false, "the server to add the suffix on"), + Arg.create("world", false, "the world to add the suffix on") + ) + ); } @Override diff --git a/common/src/main/java/me/lucko/luckperms/commands/group/subcommands/GroupAddTempPrefix.java b/common/src/main/java/me/lucko/luckperms/commands/group/subcommands/GroupAddTempPrefix.java index 0403956bb..2cc0f7448 100644 --- a/common/src/main/java/me/lucko/luckperms/commands/group/subcommands/GroupAddTempPrefix.java +++ b/common/src/main/java/me/lucko/luckperms/commands/group/subcommands/GroupAddTempPrefix.java @@ -23,10 +23,7 @@ package me.lucko.luckperms.commands.group.subcommands; import me.lucko.luckperms.LuckPermsPlugin; -import me.lucko.luckperms.commands.CommandResult; -import me.lucko.luckperms.commands.Predicate; -import me.lucko.luckperms.commands.Sender; -import me.lucko.luckperms.commands.SubCommand; +import me.lucko.luckperms.commands.*; import me.lucko.luckperms.constants.Message; import me.lucko.luckperms.constants.Permission; import me.lucko.luckperms.data.LogEntry; @@ -39,8 +36,15 @@ import java.util.List; public class GroupAddTempPrefix extends SubCommand { public GroupAddTempPrefix() { - super("addtempprefix", "Adds a prefix to the group temporarily", " [server] [world]", - Permission.GROUP_ADD_TEMP_PREFIX, Predicate.notInRange(3, 5)); + super("addtempprefix", "Adds a prefix to the group temporarily", Permission.GROUP_ADD_TEMP_PREFIX, Predicate.notInRange(3, 5), + Arg.list( + Arg.create("priority", true, "the priority to add the prefix at"), + Arg.create("prefix", true, "the prefix string"), + Arg.create("duration", true, "the duration until the prefix expires"), + Arg.create("server", false, "the server to add the prefix on"), + Arg.create("world", false, "the world to add the prefix on") + ) + ); } @Override diff --git a/common/src/main/java/me/lucko/luckperms/commands/group/subcommands/GroupAddTempSuffix.java b/common/src/main/java/me/lucko/luckperms/commands/group/subcommands/GroupAddTempSuffix.java index c5fd5b60a..0931321b7 100644 --- a/common/src/main/java/me/lucko/luckperms/commands/group/subcommands/GroupAddTempSuffix.java +++ b/common/src/main/java/me/lucko/luckperms/commands/group/subcommands/GroupAddTempSuffix.java @@ -23,10 +23,7 @@ package me.lucko.luckperms.commands.group.subcommands; import me.lucko.luckperms.LuckPermsPlugin; -import me.lucko.luckperms.commands.CommandResult; -import me.lucko.luckperms.commands.Predicate; -import me.lucko.luckperms.commands.Sender; -import me.lucko.luckperms.commands.SubCommand; +import me.lucko.luckperms.commands.*; import me.lucko.luckperms.constants.Message; import me.lucko.luckperms.constants.Permission; import me.lucko.luckperms.data.LogEntry; @@ -39,8 +36,15 @@ import java.util.List; public class GroupAddTempSuffix extends SubCommand { public GroupAddTempSuffix() { - super("addtempsuffix", "Adds a suffix to the group temporarily", " [server] [world]", - Permission.GROUP_ADD_TEMP_SUFFIX, Predicate.notInRange(3, 5)); + super("addtempsuffix", "Adds a suffix to the group temporarily", Permission.GROUP_ADD_TEMP_SUFFIX, Predicate.notInRange(3, 5), + Arg.list( + Arg.create("priority", true, "the priority to add the suffix at"), + Arg.create("suffix", true, "the suffix string"), + Arg.create("duration", true, "the duration until the suffix expires"), + Arg.create("server", false, "the server to add the suffix on"), + Arg.create("world", false, "the world to add the suffix on") + ) + ); } @Override diff --git a/common/src/main/java/me/lucko/luckperms/commands/group/subcommands/GroupBulkChange.java b/common/src/main/java/me/lucko/luckperms/commands/group/subcommands/GroupBulkChange.java index 80c4a71a0..aa81f8ce8 100644 --- a/common/src/main/java/me/lucko/luckperms/commands/group/subcommands/GroupBulkChange.java +++ b/common/src/main/java/me/lucko/luckperms/commands/group/subcommands/GroupBulkChange.java @@ -24,10 +24,7 @@ package me.lucko.luckperms.commands.group.subcommands; import me.lucko.luckperms.LuckPermsPlugin; import me.lucko.luckperms.api.Node; -import me.lucko.luckperms.commands.CommandResult; -import me.lucko.luckperms.commands.Predicate; -import me.lucko.luckperms.commands.Sender; -import me.lucko.luckperms.commands.SubCommand; +import me.lucko.luckperms.commands.*; import me.lucko.luckperms.constants.Message; import me.lucko.luckperms.constants.Permission; import me.lucko.luckperms.groups.Group; @@ -39,8 +36,13 @@ import java.util.Set; public class GroupBulkChange extends SubCommand { public GroupBulkChange() { - super("bulkchange", "Applies a bulk permission change to the groups permissions", " ", - Permission.GROUP_BULKCHANGE, Predicate.not(3)); + super("bulkchange", "Applies a bulk permission change to the group's permissions", Permission.GROUP_BULKCHANGE, Predicate.not(3), + Arg.list( + Arg.create("server|world", true, "if the bulk change is modifying a 'server' or a 'world'"), + Arg.create("from", true, "the server/world to be changed from. can be 'global' or 'null' respectively"), + Arg.create("to", true, "the server/world to replace 'from' (can be 'null')") + ) + ); } @Override diff --git a/common/src/main/java/me/lucko/luckperms/commands/group/subcommands/GroupChatMeta.java b/common/src/main/java/me/lucko/luckperms/commands/group/subcommands/GroupChatMeta.java index d13e76c76..7bc585a02 100644 --- a/common/src/main/java/me/lucko/luckperms/commands/group/subcommands/GroupChatMeta.java +++ b/common/src/main/java/me/lucko/luckperms/commands/group/subcommands/GroupChatMeta.java @@ -34,7 +34,7 @@ import java.util.*; public class GroupChatMeta extends SubCommand { public GroupChatMeta() { - super("chatmeta", "Displays a groups chat meta", "", Permission.GROUP_CHATMETA, Predicate.alwaysFalse()); + super("chatmeta", "Lists the group's chat meta", Permission.GROUP_CHATMETA, Predicate.alwaysFalse(), null); } @Override diff --git a/common/src/main/java/me/lucko/luckperms/commands/group/subcommands/GroupClear.java b/common/src/main/java/me/lucko/luckperms/commands/group/subcommands/GroupClear.java index fd5a036de..5e727bab8 100644 --- a/common/src/main/java/me/lucko/luckperms/commands/group/subcommands/GroupClear.java +++ b/common/src/main/java/me/lucko/luckperms/commands/group/subcommands/GroupClear.java @@ -36,7 +36,7 @@ import java.util.List; public class GroupClear extends SubCommand { public GroupClear() { - super("clear", "Clears a groups permissions", "", Permission.GROUP_CLEAR, Predicate.alwaysFalse()); + super("clear", "Clears the group's permissions", Permission.GROUP_CLEAR, Predicate.alwaysFalse(), null); } @Override diff --git a/common/src/main/java/me/lucko/luckperms/commands/group/subcommands/GroupHasPerm.java b/common/src/main/java/me/lucko/luckperms/commands/group/subcommands/GroupHasPerm.java index 9c4cac127..ac7a18efe 100644 --- a/common/src/main/java/me/lucko/luckperms/commands/group/subcommands/GroupHasPerm.java +++ b/common/src/main/java/me/lucko/luckperms/commands/group/subcommands/GroupHasPerm.java @@ -33,8 +33,14 @@ import java.util.List; public class GroupHasPerm extends SubCommand { public GroupHasPerm() { - super("haspermission", "Checks to see if a group has a certain permission node", " [server] [world]", - Permission.GROUP_HASPERMISSION, Predicate.notInRange(1, 3)); + super("haspermission", "Checks to see if the group has a certain permission node", Permission.GROUP_HASPERMISSION, + Predicate.notInRange(1, 3), + Arg.list( + Arg.create("node", true, "the permission node to check for"), + Arg.create("server", false, "the server to check on"), + Arg.create("world", false, "the world to check on") + ) + ); } @Override diff --git a/common/src/main/java/me/lucko/luckperms/commands/group/subcommands/GroupInfo.java b/common/src/main/java/me/lucko/luckperms/commands/group/subcommands/GroupInfo.java index a2306d02c..bbd43bb66 100644 --- a/common/src/main/java/me/lucko/luckperms/commands/group/subcommands/GroupInfo.java +++ b/common/src/main/java/me/lucko/luckperms/commands/group/subcommands/GroupInfo.java @@ -35,7 +35,7 @@ import java.util.List; public class GroupInfo extends SubCommand { public GroupInfo() { - super("info", "Gives info about the group", "", Permission.GROUP_INFO, Predicate.alwaysFalse()); + super("info", "Gives info about the group", Permission.GROUP_INFO, Predicate.alwaysFalse(), null); } @Override diff --git a/common/src/main/java/me/lucko/luckperms/commands/group/subcommands/GroupInheritsPerm.java b/common/src/main/java/me/lucko/luckperms/commands/group/subcommands/GroupInheritsPerm.java index fab0c609c..e6768ec62 100644 --- a/common/src/main/java/me/lucko/luckperms/commands/group/subcommands/GroupInheritsPerm.java +++ b/common/src/main/java/me/lucko/luckperms/commands/group/subcommands/GroupInheritsPerm.java @@ -33,8 +33,14 @@ import java.util.List; public class GroupInheritsPerm extends SubCommand { public GroupInheritsPerm() { - super("inheritspermission", "Checks to see if a group inherits a certain permission node", " [server] [world]", - Permission.GROUP_INHERITSPERMISSION, Predicate.notInRange(1, 3)); + super("inheritspermission", "Checks to see if the group inherits a certain permission node", + Permission.GROUP_INHERITSPERMISSION, Predicate.notInRange(1, 3), + Arg.list( + Arg.create("node", true, "the permission node to check for"), + Arg.create("server", false, "the server to check on"), + Arg.create("world", false, "the world to check on") + ) + ); } @Override diff --git a/common/src/main/java/me/lucko/luckperms/commands/group/subcommands/GroupListNodes.java b/common/src/main/java/me/lucko/luckperms/commands/group/subcommands/GroupListNodes.java index 34ec81e70..c290fbc16 100644 --- a/common/src/main/java/me/lucko/luckperms/commands/group/subcommands/GroupListNodes.java +++ b/common/src/main/java/me/lucko/luckperms/commands/group/subcommands/GroupListNodes.java @@ -32,7 +32,7 @@ import java.util.List; public class GroupListNodes extends SubCommand { public GroupListNodes() { - super("listnodes", "Lists the permission nodes the group has", "", Permission.GROUP_LISTNODES, Predicate.alwaysFalse()); + super("listnodes", "Lists the permission nodes the group has", Permission.GROUP_LISTNODES, Predicate.alwaysFalse(), null); } @Override diff --git a/common/src/main/java/me/lucko/luckperms/commands/group/subcommands/GroupListParents.java b/common/src/main/java/me/lucko/luckperms/commands/group/subcommands/GroupListParents.java index 7d9a175fb..03e30277c 100644 --- a/common/src/main/java/me/lucko/luckperms/commands/group/subcommands/GroupListParents.java +++ b/common/src/main/java/me/lucko/luckperms/commands/group/subcommands/GroupListParents.java @@ -32,7 +32,7 @@ import java.util.List; public class GroupListParents extends SubCommand { public GroupListParents() { - super("listparents", "Lists the groups that this group inherits from", "", Permission.GROUP_LISTPARENTS, Predicate.alwaysFalse()); + super("listparents", "Lists the groups that this group inherits from", Permission.GROUP_LISTPARENTS, Predicate.alwaysFalse(), null); } @Override diff --git a/common/src/main/java/me/lucko/luckperms/commands/group/subcommands/GroupRemovePrefix.java b/common/src/main/java/me/lucko/luckperms/commands/group/subcommands/GroupRemovePrefix.java index b663a4639..42be5b68d 100644 --- a/common/src/main/java/me/lucko/luckperms/commands/group/subcommands/GroupRemovePrefix.java +++ b/common/src/main/java/me/lucko/luckperms/commands/group/subcommands/GroupRemovePrefix.java @@ -23,10 +23,7 @@ package me.lucko.luckperms.commands.group.subcommands; import me.lucko.luckperms.LuckPermsPlugin; -import me.lucko.luckperms.commands.CommandResult; -import me.lucko.luckperms.commands.Predicate; -import me.lucko.luckperms.commands.Sender; -import me.lucko.luckperms.commands.SubCommand; +import me.lucko.luckperms.commands.*; import me.lucko.luckperms.constants.Message; import me.lucko.luckperms.constants.Permission; import me.lucko.luckperms.data.LogEntry; @@ -38,8 +35,14 @@ import java.util.List; public class GroupRemovePrefix extends SubCommand { public GroupRemovePrefix() { - super("removeprefix", "Removes a prefix from a group", " [server] [world]", - Permission.GROUP_REMOVEPREFIX, Predicate.notInRange(2, 4)); + super("removeprefix", "Removes a prefix from the group", Permission.GROUP_REMOVEPREFIX, Predicate.notInRange(2, 4), + Arg.list( + Arg.create("priority", true, "the priority to remove the prefix at"), + Arg.create("prefix", true, "the prefix string to remove"), + Arg.create("server", false, "the server to remove the prefix on"), + Arg.create("world", false, "the world to remove the prefix on") + ) + ); } @Override diff --git a/common/src/main/java/me/lucko/luckperms/commands/group/subcommands/GroupRemoveSuffix.java b/common/src/main/java/me/lucko/luckperms/commands/group/subcommands/GroupRemoveSuffix.java index 0578154ff..b83332fe9 100644 --- a/common/src/main/java/me/lucko/luckperms/commands/group/subcommands/GroupRemoveSuffix.java +++ b/common/src/main/java/me/lucko/luckperms/commands/group/subcommands/GroupRemoveSuffix.java @@ -23,10 +23,7 @@ package me.lucko.luckperms.commands.group.subcommands; import me.lucko.luckperms.LuckPermsPlugin; -import me.lucko.luckperms.commands.CommandResult; -import me.lucko.luckperms.commands.Predicate; -import me.lucko.luckperms.commands.Sender; -import me.lucko.luckperms.commands.SubCommand; +import me.lucko.luckperms.commands.*; import me.lucko.luckperms.constants.Message; import me.lucko.luckperms.constants.Permission; import me.lucko.luckperms.data.LogEntry; @@ -38,8 +35,14 @@ import java.util.List; public class GroupRemoveSuffix extends SubCommand { public GroupRemoveSuffix() { - super("removesuffix", "Removes a suffix from a group", " [server] [world]", - Permission.GROUP_REMOVESUFFIX, Predicate.notInRange(2, 4)); + super("removesuffix", "Removes a suffix from the group", Permission.GROUP_REMOVESUFFIX, Predicate.notInRange(2, 4), + Arg.list( + Arg.create("priority", true, "the priority to remove the suffix at"), + Arg.create("suffix", true, "the suffix string to remove"), + Arg.create("server", false, "the server to remove the suffix on"), + Arg.create("world", false, "the world to remove the suffix on") + ) + ); } @Override diff --git a/common/src/main/java/me/lucko/luckperms/commands/group/subcommands/GroupRemoveTempPrefix.java b/common/src/main/java/me/lucko/luckperms/commands/group/subcommands/GroupRemoveTempPrefix.java index f1f17c67c..565a720b6 100644 --- a/common/src/main/java/me/lucko/luckperms/commands/group/subcommands/GroupRemoveTempPrefix.java +++ b/common/src/main/java/me/lucko/luckperms/commands/group/subcommands/GroupRemoveTempPrefix.java @@ -23,10 +23,7 @@ package me.lucko.luckperms.commands.group.subcommands; import me.lucko.luckperms.LuckPermsPlugin; -import me.lucko.luckperms.commands.CommandResult; -import me.lucko.luckperms.commands.Predicate; -import me.lucko.luckperms.commands.Sender; -import me.lucko.luckperms.commands.SubCommand; +import me.lucko.luckperms.commands.*; import me.lucko.luckperms.constants.Message; import me.lucko.luckperms.constants.Permission; import me.lucko.luckperms.data.LogEntry; @@ -38,8 +35,15 @@ import java.util.List; public class GroupRemoveTempPrefix extends SubCommand { public GroupRemoveTempPrefix() { - super("removetempprefix", "Removes a temporary prefix from a group", " [server] [world]", - Permission.GROUP_REMOVE_TEMP_PREFIX, Predicate.notInRange(2, 4)); + super("removetempprefix", "Removes a temporary prefix from the group", Permission.GROUP_REMOVE_TEMP_PREFIX, + Predicate.notInRange(2, 4), + Arg.list( + Arg.create("priority", true, "the priority to remove the prefix at"), + Arg.create("prefix", true, "the prefix string to remove"), + Arg.create("server", false, "the server to remove the prefix on"), + Arg.create("world", false, "the world to remove the prefix on") + ) + ); } @Override diff --git a/common/src/main/java/me/lucko/luckperms/commands/group/subcommands/GroupRemoveTempSuffix.java b/common/src/main/java/me/lucko/luckperms/commands/group/subcommands/GroupRemoveTempSuffix.java index 1eb4634bf..145bdd499 100644 --- a/common/src/main/java/me/lucko/luckperms/commands/group/subcommands/GroupRemoveTempSuffix.java +++ b/common/src/main/java/me/lucko/luckperms/commands/group/subcommands/GroupRemoveTempSuffix.java @@ -23,10 +23,7 @@ package me.lucko.luckperms.commands.group.subcommands; import me.lucko.luckperms.LuckPermsPlugin; -import me.lucko.luckperms.commands.CommandResult; -import me.lucko.luckperms.commands.Predicate; -import me.lucko.luckperms.commands.Sender; -import me.lucko.luckperms.commands.SubCommand; +import me.lucko.luckperms.commands.*; import me.lucko.luckperms.constants.Message; import me.lucko.luckperms.constants.Permission; import me.lucko.luckperms.data.LogEntry; @@ -38,8 +35,15 @@ import java.util.List; public class GroupRemoveTempSuffix extends SubCommand { public GroupRemoveTempSuffix() { - super("removetempsuffix", "Removes a temporary suffix from a group", " [server] [world]", - Permission.GROUP_REMOVE_TEMP_SUFFIX, Predicate.notInRange(2, 4)); + super("removetempsuffix", "Removes a temporary suffix from the group", Permission.GROUP_REMOVE_TEMP_SUFFIX, + Predicate.notInRange(2, 4), + Arg.list( + Arg.create("priority", true, "the priority to remove the suffix at"), + Arg.create("suffix", true, "the suffix string to remove"), + Arg.create("server", false, "the server to remove the suffix on"), + Arg.create("world", false, "the world to remove the suffix on") + ) + ); } @Override diff --git a/common/src/main/java/me/lucko/luckperms/commands/group/subcommands/GroupRename.java b/common/src/main/java/me/lucko/luckperms/commands/group/subcommands/GroupRename.java index f09dce08d..efb41d263 100644 --- a/common/src/main/java/me/lucko/luckperms/commands/group/subcommands/GroupRename.java +++ b/common/src/main/java/me/lucko/luckperms/commands/group/subcommands/GroupRename.java @@ -23,10 +23,7 @@ package me.lucko.luckperms.commands.group.subcommands; import me.lucko.luckperms.LuckPermsPlugin; -import me.lucko.luckperms.commands.CommandResult; -import me.lucko.luckperms.commands.Predicate; -import me.lucko.luckperms.commands.Sender; -import me.lucko.luckperms.commands.SubCommand; +import me.lucko.luckperms.commands.*; import me.lucko.luckperms.constants.Message; import me.lucko.luckperms.constants.Permission; import me.lucko.luckperms.data.LogEntry; @@ -37,7 +34,9 @@ import java.util.List; public class GroupRename extends SubCommand { public GroupRename() { - super("rename", "Rename this group", "", Permission.TRACK_APPEND, Predicate.not(1)); + super("rename", "Rename the group", Permission.TRACK_APPEND, Predicate.not(1), + Arg.list(Arg.create("name", true, "the new name")) + ); } @Override diff --git a/common/src/main/java/me/lucko/luckperms/commands/group/subcommands/GroupSetInherit.java b/common/src/main/java/me/lucko/luckperms/commands/group/subcommands/GroupSetInherit.java index 381f7d52b..7bf51e5f5 100644 --- a/common/src/main/java/me/lucko/luckperms/commands/group/subcommands/GroupSetInherit.java +++ b/common/src/main/java/me/lucko/luckperms/commands/group/subcommands/GroupSetInherit.java @@ -23,10 +23,7 @@ package me.lucko.luckperms.commands.group.subcommands; import me.lucko.luckperms.LuckPermsPlugin; -import me.lucko.luckperms.commands.CommandResult; -import me.lucko.luckperms.commands.Predicate; -import me.lucko.luckperms.commands.Sender; -import me.lucko.luckperms.commands.SubCommand; +import me.lucko.luckperms.commands.*; import me.lucko.luckperms.constants.Message; import me.lucko.luckperms.constants.Permission; import me.lucko.luckperms.data.LogEntry; @@ -38,8 +35,14 @@ import java.util.List; public class GroupSetInherit extends SubCommand { public GroupSetInherit() { - super("setinherit", "Sets another group for this group to inherit permissions from", " [server] [world]", - Permission.GROUP_SETINHERIT, Predicate.notInRange(1, 3)); + super("setinherit", "Sets another group for the group to inherit permissions from", + Permission.GROUP_SETINHERIT, Predicate.notInRange(1, 3), + Arg.list( + Arg.create("group", true, "the group to inherit from"), + Arg.create("server", false, "the server to inherit the group on"), + Arg.create("world", false, "the world to inherit the group on") + ) + ); } @Override @@ -47,7 +50,7 @@ public class GroupSetInherit extends SubCommand { String groupName = args.get(0).toLowerCase(); if (ArgumentChecker.checkNode(groupName)) { - sendUsage(sender); + sendDetailedUsage(sender); return CommandResult.INVALID_ARGS; } diff --git a/common/src/main/java/me/lucko/luckperms/commands/group/subcommands/GroupSetPermission.java b/common/src/main/java/me/lucko/luckperms/commands/group/subcommands/GroupSetPermission.java index 75fb76db1..f94890a75 100644 --- a/common/src/main/java/me/lucko/luckperms/commands/group/subcommands/GroupSetPermission.java +++ b/common/src/main/java/me/lucko/luckperms/commands/group/subcommands/GroupSetPermission.java @@ -23,10 +23,7 @@ package me.lucko.luckperms.commands.group.subcommands; import me.lucko.luckperms.LuckPermsPlugin; -import me.lucko.luckperms.commands.CommandResult; -import me.lucko.luckperms.commands.Predicate; -import me.lucko.luckperms.commands.Sender; -import me.lucko.luckperms.commands.SubCommand; +import me.lucko.luckperms.commands.*; import me.lucko.luckperms.constants.Message; import me.lucko.luckperms.constants.Permission; import me.lucko.luckperms.data.LogEntry; @@ -38,8 +35,14 @@ import java.util.List; public class GroupSetPermission extends SubCommand { public GroupSetPermission() { - super("set", "Sets a permission for a group", " [server] [world]", Permission.GROUP_SETPERMISSION, - Predicate.notInRange(2, 4)); + super("set", "Sets a permission for the group", Permission.GROUP_SETPERMISSION, Predicate.notInRange(2, 4), + Arg.list( + Arg.create("node", true, "the permission node to set"), + Arg.create("true|false", true, "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") + ) + ); } @Override @@ -48,7 +51,7 @@ public class GroupSetPermission extends SubCommand { String bool = args.get(1).toLowerCase(); if (ArgumentChecker.checkNode(node)) { - sendUsage(sender); + sendDetailedUsage(sender); return CommandResult.INVALID_ARGS; } @@ -58,7 +61,7 @@ public class GroupSetPermission extends SubCommand { } if (!bool.equalsIgnoreCase("true") && !bool.equalsIgnoreCase("false")) { - sendUsage(sender); + sendDetailedUsage(sender); return CommandResult.INVALID_ARGS; } diff --git a/common/src/main/java/me/lucko/luckperms/commands/group/subcommands/GroupSetTempInherit.java b/common/src/main/java/me/lucko/luckperms/commands/group/subcommands/GroupSetTempInherit.java index 798fa37e9..c66a537ff 100644 --- a/common/src/main/java/me/lucko/luckperms/commands/group/subcommands/GroupSetTempInherit.java +++ b/common/src/main/java/me/lucko/luckperms/commands/group/subcommands/GroupSetTempInherit.java @@ -23,10 +23,7 @@ package me.lucko.luckperms.commands.group.subcommands; import me.lucko.luckperms.LuckPermsPlugin; -import me.lucko.luckperms.commands.CommandResult; -import me.lucko.luckperms.commands.Predicate; -import me.lucko.luckperms.commands.Sender; -import me.lucko.luckperms.commands.SubCommand; +import me.lucko.luckperms.commands.*; import me.lucko.luckperms.constants.Message; import me.lucko.luckperms.constants.Permission; import me.lucko.luckperms.data.LogEntry; @@ -39,8 +36,15 @@ import java.util.List; public class GroupSetTempInherit extends SubCommand { public GroupSetTempInherit() { - super("settempinherit", "Sets another group for this group to inherit permissions from temporarily", - " [server] [world]", Permission.GROUP_SET_TEMP_INHERIT, Predicate.notInRange(2, 4)); + super("settempinherit", "Sets another group for the group to inherit permissions from temporarily", + Permission.GROUP_SET_TEMP_INHERIT, Predicate.notInRange(2, 4), + Arg.list( + Arg.create("group", true, "the group to inherit from"), + Arg.create("duration", true, "the duration of the group membership"), + Arg.create("server", false, "the server to add the group on"), + Arg.create("world", false, "the world to add the group on") + ) + ); } @Override @@ -48,7 +52,7 @@ public class GroupSetTempInherit extends SubCommand { String groupName = args.get(0).toLowerCase(); if (ArgumentChecker.checkNode(groupName)) { - sendUsage(sender); + sendDetailedUsage(sender); return CommandResult.INVALID_ARGS; } diff --git a/common/src/main/java/me/lucko/luckperms/commands/group/subcommands/GroupSetTempPermission.java b/common/src/main/java/me/lucko/luckperms/commands/group/subcommands/GroupSetTempPermission.java index a4bc2beb4..2dfbdd82c 100644 --- a/common/src/main/java/me/lucko/luckperms/commands/group/subcommands/GroupSetTempPermission.java +++ b/common/src/main/java/me/lucko/luckperms/commands/group/subcommands/GroupSetTempPermission.java @@ -23,10 +23,7 @@ package me.lucko.luckperms.commands.group.subcommands; import me.lucko.luckperms.LuckPermsPlugin; -import me.lucko.luckperms.commands.CommandResult; -import me.lucko.luckperms.commands.Predicate; -import me.lucko.luckperms.commands.Sender; -import me.lucko.luckperms.commands.SubCommand; +import me.lucko.luckperms.commands.*; import me.lucko.luckperms.constants.Message; import me.lucko.luckperms.constants.Permission; import me.lucko.luckperms.data.LogEntry; @@ -39,8 +36,16 @@ import java.util.List; public class GroupSetTempPermission extends SubCommand { public GroupSetTempPermission() { - super("settemp", "Sets a temporary permission for a group", " [server] [world]", - Permission.GROUP_SET_TEMP_PERMISSION, Predicate.notInRange(3, 5)); + super("settemp", "Sets a permission for the group temporarily", Permission.GROUP_SET_TEMP_PERMISSION, + Predicate.notInRange(3, 5), + Arg.list( + Arg.create("node", true, "the permission node to set"), + Arg.create("true|false", true, "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") + ) + ); } @Override @@ -49,7 +54,7 @@ public class GroupSetTempPermission extends SubCommand { String bool = args.get(1).toLowerCase(); if (ArgumentChecker.checkNode(node)) { - sendUsage(sender); + sendDetailedUsage(sender); return CommandResult.INVALID_ARGS; } @@ -59,7 +64,7 @@ public class GroupSetTempPermission extends SubCommand { } if (!bool.equalsIgnoreCase("true") && !bool.equalsIgnoreCase("false")) { - sendUsage(sender); + sendDetailedUsage(sender); return CommandResult.INVALID_ARGS; } diff --git a/common/src/main/java/me/lucko/luckperms/commands/group/subcommands/GroupShowTracks.java b/common/src/main/java/me/lucko/luckperms/commands/group/subcommands/GroupShowTracks.java index e3713e56f..20910861a 100644 --- a/common/src/main/java/me/lucko/luckperms/commands/group/subcommands/GroupShowTracks.java +++ b/common/src/main/java/me/lucko/luckperms/commands/group/subcommands/GroupShowTracks.java @@ -34,7 +34,7 @@ import java.util.stream.Collectors; public class GroupShowTracks extends SubCommand { public GroupShowTracks() { - super("showtracks", "Lists the tracks that this group features on", "", Permission.GROUP_SHOWTRACKS, Predicate.alwaysFalse()); + super("showtracks", "Lists the tracks that the group features on", Permission.GROUP_SHOWTRACKS, Predicate.alwaysFalse(), null); } @Override diff --git a/common/src/main/java/me/lucko/luckperms/commands/group/subcommands/GroupUnSetPermission.java b/common/src/main/java/me/lucko/luckperms/commands/group/subcommands/GroupUnSetPermission.java index b198d48a7..00d1b0624 100644 --- a/common/src/main/java/me/lucko/luckperms/commands/group/subcommands/GroupUnSetPermission.java +++ b/common/src/main/java/me/lucko/luckperms/commands/group/subcommands/GroupUnSetPermission.java @@ -23,10 +23,7 @@ package me.lucko.luckperms.commands.group.subcommands; import me.lucko.luckperms.LuckPermsPlugin; -import me.lucko.luckperms.commands.CommandResult; -import me.lucko.luckperms.commands.Predicate; -import me.lucko.luckperms.commands.Sender; -import me.lucko.luckperms.commands.SubCommand; +import me.lucko.luckperms.commands.*; import me.lucko.luckperms.constants.Message; import me.lucko.luckperms.constants.Permission; import me.lucko.luckperms.data.LogEntry; @@ -38,8 +35,13 @@ import java.util.List; public class GroupUnSetPermission extends SubCommand { public GroupUnSetPermission() { - super("unset", "Unsets a permission for a group", " [server] [world]", Permission.GROUP_UNSETPERMISSION, - Predicate.notInRange(1, 3)); + super("unset", "Unsets a permission for the group", Permission.GROUP_UNSETPERMISSION, Predicate.notInRange(1, 3), + Arg.list( + Arg.create("node", true, "the permission node to unset"), + Arg.create("server", false, "the server to remove the permission node on"), + Arg.create("world", false, "the world to remove the permission node on") + ) + ); } @Override @@ -47,7 +49,7 @@ public class GroupUnSetPermission extends SubCommand { String node = args.get(0).replace("{SPACE}", " "); if (ArgumentChecker.checkNode(node)) { - sendUsage(sender); + sendDetailedUsage(sender); return CommandResult.INVALID_ARGS; } diff --git a/common/src/main/java/me/lucko/luckperms/commands/group/subcommands/GroupUnsetInherit.java b/common/src/main/java/me/lucko/luckperms/commands/group/subcommands/GroupUnsetInherit.java index efa65f73d..003951257 100644 --- a/common/src/main/java/me/lucko/luckperms/commands/group/subcommands/GroupUnsetInherit.java +++ b/common/src/main/java/me/lucko/luckperms/commands/group/subcommands/GroupUnsetInherit.java @@ -23,10 +23,7 @@ package me.lucko.luckperms.commands.group.subcommands; import me.lucko.luckperms.LuckPermsPlugin; -import me.lucko.luckperms.commands.CommandResult; -import me.lucko.luckperms.commands.Predicate; -import me.lucko.luckperms.commands.Sender; -import me.lucko.luckperms.commands.SubCommand; +import me.lucko.luckperms.commands.*; import me.lucko.luckperms.constants.Message; import me.lucko.luckperms.constants.Permission; import me.lucko.luckperms.data.LogEntry; @@ -38,8 +35,14 @@ import java.util.List; public class GroupUnsetInherit extends SubCommand { public GroupUnsetInherit() { - super("unsetinherit", "Unsets another group for this group to inherit permissions from", - " [server] [world]", Permission.GROUP_UNSETINHERIT, Predicate.notInRange(1, 3)); + super("unsetinherit", "Removes a previously set inheritance rule", Permission.GROUP_UNSETINHERIT, + Predicate.notInRange(1, 3), + Arg.list( + Arg.create("group", true, "the group to uninherit"), + Arg.create("server", false, "the server to remove the group on"), + Arg.create("world", false, "the world to remove the group on") + ) + ); } @Override @@ -47,7 +50,7 @@ public class GroupUnsetInherit extends SubCommand { String groupName = args.get(0).toLowerCase(); if (ArgumentChecker.checkNode(groupName)) { - sendUsage(sender); + sendDetailedUsage(sender); return CommandResult.INVALID_ARGS; } diff --git a/common/src/main/java/me/lucko/luckperms/commands/group/subcommands/GroupUnsetTempInherit.java b/common/src/main/java/me/lucko/luckperms/commands/group/subcommands/GroupUnsetTempInherit.java index 09bb0f594..176e665f7 100644 --- a/common/src/main/java/me/lucko/luckperms/commands/group/subcommands/GroupUnsetTempInherit.java +++ b/common/src/main/java/me/lucko/luckperms/commands/group/subcommands/GroupUnsetTempInherit.java @@ -23,10 +23,7 @@ package me.lucko.luckperms.commands.group.subcommands; import me.lucko.luckperms.LuckPermsPlugin; -import me.lucko.luckperms.commands.CommandResult; -import me.lucko.luckperms.commands.Predicate; -import me.lucko.luckperms.commands.Sender; -import me.lucko.luckperms.commands.SubCommand; +import me.lucko.luckperms.commands.*; import me.lucko.luckperms.constants.Message; import me.lucko.luckperms.constants.Permission; import me.lucko.luckperms.data.LogEntry; @@ -38,8 +35,14 @@ import java.util.List; public class GroupUnsetTempInherit extends SubCommand { public GroupUnsetTempInherit() { - super("unsettempinherit", "Unsets another group for this group to inherit permissions from", - " [server] [world]", Permission.GROUP_UNSET_TEMP_INHERIT, Predicate.notInRange(1, 3)); + super("unsettempinherit", "Removes a previously set temporary inheritance rule", + Permission.GROUP_UNSET_TEMP_INHERIT, Predicate.notInRange(1, 3), + Arg.list( + Arg.create("group", true, "the group to uninherit"), + Arg.create("server", false, "the server to remove the group on"), + Arg.create("world", false, "the world to remove the group on") + ) + ); } @Override @@ -47,7 +50,7 @@ public class GroupUnsetTempInherit extends SubCommand { String groupName = args.get(0).toLowerCase(); if (ArgumentChecker.checkNode(groupName)) { - sendUsage(sender); + sendDetailedUsage(sender); return CommandResult.INVALID_ARGS; } diff --git a/common/src/main/java/me/lucko/luckperms/commands/group/subcommands/GroupUnsetTempPermission.java b/common/src/main/java/me/lucko/luckperms/commands/group/subcommands/GroupUnsetTempPermission.java index 9a51d8726..6350fc309 100644 --- a/common/src/main/java/me/lucko/luckperms/commands/group/subcommands/GroupUnsetTempPermission.java +++ b/common/src/main/java/me/lucko/luckperms/commands/group/subcommands/GroupUnsetTempPermission.java @@ -23,10 +23,7 @@ package me.lucko.luckperms.commands.group.subcommands; import me.lucko.luckperms.LuckPermsPlugin; -import me.lucko.luckperms.commands.CommandResult; -import me.lucko.luckperms.commands.Predicate; -import me.lucko.luckperms.commands.Sender; -import me.lucko.luckperms.commands.SubCommand; +import me.lucko.luckperms.commands.*; import me.lucko.luckperms.constants.Message; import me.lucko.luckperms.constants.Permission; import me.lucko.luckperms.data.LogEntry; @@ -38,8 +35,14 @@ import java.util.List; public class GroupUnsetTempPermission extends SubCommand { public GroupUnsetTempPermission() { - super("unsettemp", "Unsets a temporary permission for a group", " [server] [world]", - Permission.GROUP_UNSET_TEMP_PERMISSION, Predicate.notInRange(1, 3)); + super("unsettemp", "Unsets a temporary permission for the group", Permission.GROUP_UNSET_TEMP_PERMISSION, + Predicate.notInRange(1, 3), + Arg.list( + Arg.create("node", true, "the permission node to unset"), + Arg.create("server", false, "the server to remove the permission node on"), + Arg.create("world", false, "the world to remove the permission node on") + ) + ); } @Override @@ -47,7 +50,7 @@ public class GroupUnsetTempPermission extends SubCommand { String node = args.get(0).replace("{SPACE}", " "); if (ArgumentChecker.checkNode(node)) { - sendUsage(sender); + sendDetailedUsage(sender); return CommandResult.INVALID_ARGS; } diff --git a/common/src/main/java/me/lucko/luckperms/commands/log/subcommands/LogExport.java b/common/src/main/java/me/lucko/luckperms/commands/log/subcommands/LogExport.java index 3d5fc831a..7c4ddac41 100644 --- a/common/src/main/java/me/lucko/luckperms/commands/log/subcommands/LogExport.java +++ b/common/src/main/java/me/lucko/luckperms/commands/log/subcommands/LogExport.java @@ -24,10 +24,7 @@ package me.lucko.luckperms.commands.log.subcommands; import me.lucko.luckperms.LuckPermsPlugin; import me.lucko.luckperms.api.LogEntry; -import me.lucko.luckperms.commands.CommandResult; -import me.lucko.luckperms.commands.Predicate; -import me.lucko.luckperms.commands.Sender; -import me.lucko.luckperms.commands.SubCommand; +import me.lucko.luckperms.commands.*; import me.lucko.luckperms.constants.Message; import me.lucko.luckperms.constants.Permission; import me.lucko.luckperms.data.Log; @@ -41,7 +38,9 @@ import java.util.List; public class LogExport extends SubCommand { public LogExport() { - super("export", "Export the log to a file", "", Permission.LOG_EXPORT, Predicate.not(1)); + super("export", "Export the log to a file", Permission.LOG_EXPORT, Predicate.not(1), + Arg.list(Arg.create("file", true, "the name of the file")) + ); } @Override diff --git a/common/src/main/java/me/lucko/luckperms/commands/log/subcommands/LogGroupHistory.java b/common/src/main/java/me/lucko/luckperms/commands/log/subcommands/LogGroupHistory.java index e53976aec..c4a38a4e8 100644 --- a/common/src/main/java/me/lucko/luckperms/commands/log/subcommands/LogGroupHistory.java +++ b/common/src/main/java/me/lucko/luckperms/commands/log/subcommands/LogGroupHistory.java @@ -24,10 +24,7 @@ package me.lucko.luckperms.commands.log.subcommands; import me.lucko.luckperms.LuckPermsPlugin; import me.lucko.luckperms.api.LogEntry; -import me.lucko.luckperms.commands.CommandResult; -import me.lucko.luckperms.commands.Predicate; -import me.lucko.luckperms.commands.Sender; -import me.lucko.luckperms.commands.SubCommand; +import me.lucko.luckperms.commands.*; import me.lucko.luckperms.constants.Message; import me.lucko.luckperms.constants.Permission; import me.lucko.luckperms.data.Log; @@ -40,8 +37,12 @@ import java.util.SortedMap; public class LogGroupHistory extends SubCommand { public LogGroupHistory() { - super("grouphistory", "View an objects history", " [page]", Permission.LOG_GROUP_HISTORY, - Predicate.notInRange(1, 2)); + super("grouphistory", "View an group's history", Permission.LOG_GROUP_HISTORY, Predicate.notInRange(1, 2), + Arg.list( + Arg.create("group", true, "the name of the group"), + Arg.create("page", false, "the page number to view") + ) + ); } @Override diff --git a/common/src/main/java/me/lucko/luckperms/commands/log/subcommands/LogNotify.java b/common/src/main/java/me/lucko/luckperms/commands/log/subcommands/LogNotify.java index c531bd0a2..74f7ca221 100644 --- a/common/src/main/java/me/lucko/luckperms/commands/log/subcommands/LogNotify.java +++ b/common/src/main/java/me/lucko/luckperms/commands/log/subcommands/LogNotify.java @@ -23,10 +23,7 @@ package me.lucko.luckperms.commands.log.subcommands; import me.lucko.luckperms.LuckPermsPlugin; -import me.lucko.luckperms.commands.CommandResult; -import me.lucko.luckperms.commands.Predicate; -import me.lucko.luckperms.commands.Sender; -import me.lucko.luckperms.commands.SubCommand; +import me.lucko.luckperms.commands.*; import me.lucko.luckperms.constants.Message; import me.lucko.luckperms.constants.Permission; import me.lucko.luckperms.data.Log; @@ -37,7 +34,9 @@ import java.util.UUID; public class LogNotify extends SubCommand { public LogNotify() { - super("notify", "Toggle notifications", "[on|off]", Permission.LOG_NOTIFY, Predicate.notInRange(0, 1)); + super("notify", "Toggle notifications", Permission.LOG_NOTIFY, Predicate.notInRange(0, 1), + Arg.list(Arg.create("on|off", false, "whether to toggle on or off")) + ); } @Override diff --git a/common/src/main/java/me/lucko/luckperms/commands/log/subcommands/LogRecent.java b/common/src/main/java/me/lucko/luckperms/commands/log/subcommands/LogRecent.java index fbf0e8c45..273ec7ee6 100644 --- a/common/src/main/java/me/lucko/luckperms/commands/log/subcommands/LogRecent.java +++ b/common/src/main/java/me/lucko/luckperms/commands/log/subcommands/LogRecent.java @@ -38,7 +38,12 @@ import java.util.UUID; public class LogRecent extends SubCommand { public LogRecent() { - super("recent", "View recent actions", "[user] [page]", Permission.LOG_RECENT, Predicate.notInRange(0, 2)); + super("recent", "View recent actions", Permission.LOG_RECENT, Predicate.notInRange(0, 2), + Arg.list( + Arg.create("user", false, "the name/uuid of the user to filter by"), + Arg.create("page", false, "the page number to view") + ) + ); } @Override diff --git a/common/src/main/java/me/lucko/luckperms/commands/log/subcommands/LogSearch.java b/common/src/main/java/me/lucko/luckperms/commands/log/subcommands/LogSearch.java index 80059f2b6..7d73cc683 100644 --- a/common/src/main/java/me/lucko/luckperms/commands/log/subcommands/LogSearch.java +++ b/common/src/main/java/me/lucko/luckperms/commands/log/subcommands/LogSearch.java @@ -24,10 +24,7 @@ package me.lucko.luckperms.commands.log.subcommands; import me.lucko.luckperms.LuckPermsPlugin; import me.lucko.luckperms.api.LogEntry; -import me.lucko.luckperms.commands.CommandResult; -import me.lucko.luckperms.commands.Predicate; -import me.lucko.luckperms.commands.Sender; -import me.lucko.luckperms.commands.SubCommand; +import me.lucko.luckperms.commands.*; import me.lucko.luckperms.constants.Message; import me.lucko.luckperms.constants.Permission; import me.lucko.luckperms.data.Log; @@ -40,7 +37,12 @@ import java.util.stream.Collectors; public class LogSearch extends SubCommand { public LogSearch() { - super("search", "Search the log for an entry", " [page]", Permission.LOG_SEARCH, Predicate.is(0)); + super("search", "Search the log for an entry", Permission.LOG_SEARCH, Predicate.is(0), + Arg.list( + Arg.create("query", true, "the query to search by"), + Arg.create("page", false, "the page number to view") + ) + ); } @Override diff --git a/common/src/main/java/me/lucko/luckperms/commands/log/subcommands/LogTrackHistory.java b/common/src/main/java/me/lucko/luckperms/commands/log/subcommands/LogTrackHistory.java index 415b0c1eb..83bb99914 100644 --- a/common/src/main/java/me/lucko/luckperms/commands/log/subcommands/LogTrackHistory.java +++ b/common/src/main/java/me/lucko/luckperms/commands/log/subcommands/LogTrackHistory.java @@ -24,10 +24,7 @@ package me.lucko.luckperms.commands.log.subcommands; import me.lucko.luckperms.LuckPermsPlugin; import me.lucko.luckperms.api.LogEntry; -import me.lucko.luckperms.commands.CommandResult; -import me.lucko.luckperms.commands.Predicate; -import me.lucko.luckperms.commands.Sender; -import me.lucko.luckperms.commands.SubCommand; +import me.lucko.luckperms.commands.*; import me.lucko.luckperms.constants.Message; import me.lucko.luckperms.constants.Permission; import me.lucko.luckperms.data.Log; @@ -40,7 +37,12 @@ import java.util.SortedMap; public class LogTrackHistory extends SubCommand { public LogTrackHistory() { - super("trackhistory", "View an objects history", " [page]", Permission.LOG_TRACK_HISTORY, Predicate.notInRange(1, 2)); + super("trackhistory", "View a track's history", Permission.LOG_TRACK_HISTORY, Predicate.notInRange(1, 2), + Arg.list( + Arg.create("track", true, "the name of the track"), + Arg.create("page", false, "the page number to view") + ) + ); } @Override diff --git a/common/src/main/java/me/lucko/luckperms/commands/log/subcommands/LogUserHistory.java b/common/src/main/java/me/lucko/luckperms/commands/log/subcommands/LogUserHistory.java index 78d826178..f4a6edd40 100644 --- a/common/src/main/java/me/lucko/luckperms/commands/log/subcommands/LogUserHistory.java +++ b/common/src/main/java/me/lucko/luckperms/commands/log/subcommands/LogUserHistory.java @@ -38,7 +38,12 @@ import java.util.UUID; public class LogUserHistory extends SubCommand { public LogUserHistory() { - super("userhistory", "View an objects history", " [page]", Permission.LOG_USER_HISTORY, Predicate.notInRange(1, 2)); + super("userhistory", "View a user's history", Permission.LOG_USER_HISTORY, Predicate.notInRange(1, 2), + Arg.list( + Arg.create("user", true, "the name/uuid of the user"), + Arg.create("page", false, "the page number to view") + ) + ); } @Override diff --git a/common/src/main/java/me/lucko/luckperms/commands/migration/subcommands/MigrationBPermissions.java b/common/src/main/java/me/lucko/luckperms/commands/migration/subcommands/MigrationBPermissions.java index 51777b8ce..49b3e6c90 100644 --- a/common/src/main/java/me/lucko/luckperms/commands/migration/subcommands/MigrationBPermissions.java +++ b/common/src/main/java/me/lucko/luckperms/commands/migration/subcommands/MigrationBPermissions.java @@ -82,7 +82,7 @@ public class MigrationBPermissions extends SubCommand { } public MigrationBPermissions() { - super("bpermissions", "Migration from bPermissions", "", MIGRATION, Predicate.alwaysFalse()); + super("bpermissions", "Migration from bPermissions", MIGRATION, Predicate.alwaysFalse(), null); } @Override diff --git a/common/src/main/java/me/lucko/luckperms/commands/migration/subcommands/MigrationBungeePerms.java b/common/src/main/java/me/lucko/luckperms/commands/migration/subcommands/MigrationBungeePerms.java index f35127c8d..7b913a46a 100644 --- a/common/src/main/java/me/lucko/luckperms/commands/migration/subcommands/MigrationBungeePerms.java +++ b/common/src/main/java/me/lucko/luckperms/commands/migration/subcommands/MigrationBungeePerms.java @@ -43,7 +43,7 @@ import java.util.Map; */ public class MigrationBungeePerms extends SubCommand { public MigrationBungeePerms() { - super("bungeeperms", "Migration from BungeePerms", "", Permission.MIGRATION, Predicate.alwaysFalse()); + super("bungeeperms", "Migration from BungeePerms", Permission.MIGRATION, Predicate.alwaysFalse(), null); } @Override diff --git a/common/src/main/java/me/lucko/luckperms/commands/migration/subcommands/MigrationGroupManager.java b/common/src/main/java/me/lucko/luckperms/commands/migration/subcommands/MigrationGroupManager.java index 4a2e19353..ed43ce892 100644 --- a/common/src/main/java/me/lucko/luckperms/commands/migration/subcommands/MigrationGroupManager.java +++ b/common/src/main/java/me/lucko/luckperms/commands/migration/subcommands/MigrationGroupManager.java @@ -24,10 +24,7 @@ package me.lucko.luckperms.commands.migration.subcommands; import me.lucko.luckperms.LuckPermsPlugin; import me.lucko.luckperms.api.Logger; -import me.lucko.luckperms.commands.CommandResult; -import me.lucko.luckperms.commands.Predicate; -import me.lucko.luckperms.commands.Sender; -import me.lucko.luckperms.commands.SubCommand; +import me.lucko.luckperms.commands.*; import me.lucko.luckperms.constants.Constants; import me.lucko.luckperms.constants.Permission; import me.lucko.luckperms.data.LogEntry; @@ -45,7 +42,9 @@ import java.util.stream.Collectors; public class MigrationGroupManager extends SubCommand { public MigrationGroupManager() { - super("groupmanager", "Migration from GroupManager", "[world names...]", Permission.MIGRATION, Predicate.is(0)); + super("groupmanager", "Migration from GroupManager", Permission.MIGRATION, Predicate.is(0), + Arg.list(Arg.create("world names...", false, "a list of worlds to migrate permissions from")) + ); } @Override diff --git a/common/src/main/java/me/lucko/luckperms/commands/migration/subcommands/MigrationPermissionsEx.java b/common/src/main/java/me/lucko/luckperms/commands/migration/subcommands/MigrationPermissionsEx.java index 559709401..62d4d7491 100644 --- a/common/src/main/java/me/lucko/luckperms/commands/migration/subcommands/MigrationPermissionsEx.java +++ b/common/src/main/java/me/lucko/luckperms/commands/migration/subcommands/MigrationPermissionsEx.java @@ -25,10 +25,7 @@ package me.lucko.luckperms.commands.migration.subcommands; import me.lucko.luckperms.LuckPermsPlugin; import me.lucko.luckperms.api.Logger; import me.lucko.luckperms.api.PlatformType; -import me.lucko.luckperms.commands.CommandResult; -import me.lucko.luckperms.commands.Predicate; -import me.lucko.luckperms.commands.Sender; -import me.lucko.luckperms.commands.SubCommand; +import me.lucko.luckperms.commands.*; import me.lucko.luckperms.constants.Constants; import me.lucko.luckperms.constants.Permission; import me.lucko.luckperms.data.LogEntry; @@ -50,7 +47,9 @@ import java.util.stream.Collectors; public class MigrationPermissionsEx extends SubCommand { public MigrationPermissionsEx() { - super("permissionsex", "Migration from PermissionsEx", "[world names...]", Permission.MIGRATION, Predicate.alwaysFalse()); + super("permissionsex", "Migration from PermissionsEx", Permission.MIGRATION, Predicate.alwaysFalse(), + Arg.list(Arg.create("world names...", false, "a list of worlds to migrate permissions from")) + ); } @SuppressWarnings("deprecation") diff --git a/common/src/main/java/me/lucko/luckperms/commands/migration/subcommands/MigrationPowerfulPerms.java b/common/src/main/java/me/lucko/luckperms/commands/migration/subcommands/MigrationPowerfulPerms.java index 22e666205..d16e2f083 100644 --- a/common/src/main/java/me/lucko/luckperms/commands/migration/subcommands/MigrationPowerfulPerms.java +++ b/common/src/main/java/me/lucko/luckperms/commands/migration/subcommands/MigrationPowerfulPerms.java @@ -29,10 +29,7 @@ import lombok.Cleanup; import me.lucko.luckperms.LuckPermsPlugin; import me.lucko.luckperms.api.Logger; import me.lucko.luckperms.api.data.Callback; -import me.lucko.luckperms.commands.CommandResult; -import me.lucko.luckperms.commands.Predicate; -import me.lucko.luckperms.commands.Sender; -import me.lucko.luckperms.commands.SubCommand; +import me.lucko.luckperms.commands.*; import me.lucko.luckperms.commands.migration.subcommands.utils.LPResultRunnable; import me.lucko.luckperms.constants.Constants; import me.lucko.luckperms.core.PermissionHolder; @@ -119,8 +116,15 @@ public class MigrationPowerfulPerms extends SubCommand { public MigrationPowerfulPerms() { - super("powerfulperms", "Migration from PowerfulPerms", "
", - MIGRATION, Predicate.not(5)); + super("powerfulperms", "Migration from PowerfulPerms", MIGRATION, Predicate.not(5), + Arg.list( + Arg.create("address", true, "the address of the PP database"), + Arg.create("database", true, "the name of the PP database"), + Arg.create("username", true, "the username to log into the DB"), + Arg.create("password", true, "the password to log into the DB"), + Arg.create("db table", true, "the name of the PP table where player data is stored") + ) + ); } @Override diff --git a/common/src/main/java/me/lucko/luckperms/commands/migration/subcommands/MigrationZPermissions.java b/common/src/main/java/me/lucko/luckperms/commands/migration/subcommands/MigrationZPermissions.java index a335dba20..0476bcd14 100644 --- a/common/src/main/java/me/lucko/luckperms/commands/migration/subcommands/MigrationZPermissions.java +++ b/common/src/main/java/me/lucko/luckperms/commands/migration/subcommands/MigrationZPermissions.java @@ -24,10 +24,7 @@ package me.lucko.luckperms.commands.migration.subcommands; import me.lucko.luckperms.LuckPermsPlugin; import me.lucko.luckperms.api.Logger; -import me.lucko.luckperms.commands.CommandResult; -import me.lucko.luckperms.commands.Predicate; -import me.lucko.luckperms.commands.Sender; -import me.lucko.luckperms.commands.SubCommand; +import me.lucko.luckperms.commands.*; import me.lucko.luckperms.constants.Constants; import me.lucko.luckperms.constants.Permission; import me.lucko.luckperms.data.LogEntry; @@ -49,7 +46,9 @@ import java.util.stream.Collectors; */ public class MigrationZPermissions extends SubCommand { public MigrationZPermissions() { - super("zpermissions", "Migration from zPermissions", "[world names...]", Permission.MIGRATION, Predicate.alwaysFalse()); + super("zpermissions", "Migration from zPermissions", Permission.MIGRATION, Predicate.alwaysFalse(), + Arg.list(Arg.create("world names...", false, "a list of worlds to migrate permissions from")) + ); } @Override diff --git a/common/src/main/java/me/lucko/luckperms/commands/track/subcommands/TrackAppend.java b/common/src/main/java/me/lucko/luckperms/commands/track/subcommands/TrackAppend.java index 38dc051d1..7e079f93c 100644 --- a/common/src/main/java/me/lucko/luckperms/commands/track/subcommands/TrackAppend.java +++ b/common/src/main/java/me/lucko/luckperms/commands/track/subcommands/TrackAppend.java @@ -36,7 +36,9 @@ import java.util.List; public class TrackAppend extends SubCommand { public TrackAppend() { - super("append", "Appends a group onto the end of the track", "", Permission.TRACK_APPEND, Predicate.not(1)); + super("append", "Appends a group onto the end of the track", Permission.TRACK_APPEND, Predicate.not(1), + Arg.list(Arg.create("group", true, "the group to append")) + ); } @Override @@ -44,7 +46,7 @@ public class TrackAppend extends SubCommand { String groupName = args.get(0).toLowerCase(); if (ArgumentChecker.checkNode(groupName)) { - sendUsage(sender); + sendDetailedUsage(sender); return CommandResult.INVALID_ARGS; } diff --git a/common/src/main/java/me/lucko/luckperms/commands/track/subcommands/TrackClear.java b/common/src/main/java/me/lucko/luckperms/commands/track/subcommands/TrackClear.java index 50f33a464..69cd39c89 100644 --- a/common/src/main/java/me/lucko/luckperms/commands/track/subcommands/TrackClear.java +++ b/common/src/main/java/me/lucko/luckperms/commands/track/subcommands/TrackClear.java @@ -36,7 +36,7 @@ import java.util.List; public class TrackClear extends SubCommand { public TrackClear() { - super("clear", "Clears the groups on the track", "", Permission.TRACK_CLEAR, Predicate.alwaysFalse()); + super("clear", "Clears the groups on the track", Permission.TRACK_CLEAR, Predicate.alwaysFalse(), null); } @Override diff --git a/common/src/main/java/me/lucko/luckperms/commands/track/subcommands/TrackInfo.java b/common/src/main/java/me/lucko/luckperms/commands/track/subcommands/TrackInfo.java index d122f00ce..fb5dbbbc6 100644 --- a/common/src/main/java/me/lucko/luckperms/commands/track/subcommands/TrackInfo.java +++ b/common/src/main/java/me/lucko/luckperms/commands/track/subcommands/TrackInfo.java @@ -32,7 +32,7 @@ import java.util.List; public class TrackInfo extends SubCommand { public TrackInfo() { - super("info", "Gives info about the track", "", Permission.TRACK_INFO, Predicate.alwaysFalse()); + super("info", "Gives info about the track", Permission.TRACK_INFO, Predicate.alwaysFalse(), null); } @Override diff --git a/common/src/main/java/me/lucko/luckperms/commands/track/subcommands/TrackInsert.java b/common/src/main/java/me/lucko/luckperms/commands/track/subcommands/TrackInsert.java index 32dac8fa2..f411b9a78 100644 --- a/common/src/main/java/me/lucko/luckperms/commands/track/subcommands/TrackInsert.java +++ b/common/src/main/java/me/lucko/luckperms/commands/track/subcommands/TrackInsert.java @@ -36,8 +36,12 @@ import java.util.List; public class TrackInsert extends SubCommand { public TrackInsert() { - super("insert", "Inserts a group at a given position along the track", " ", - Permission.TRACK_INSERT, Predicate.not(2)); + super("insert", "Inserts a group at a given position along the track", Permission.TRACK_INSERT, Predicate.not(2), + Arg.list( + Arg.create("group", true, "the group to insert"), + Arg.create("position", true, "the position to insert the group at (the first position on the track is 1)") + ) + ); } @Override @@ -45,7 +49,7 @@ public class TrackInsert extends SubCommand { String groupName = args.get(0).toLowerCase(); if (ArgumentChecker.checkNode(groupName)) { - sendUsage(sender); + sendDetailedUsage(sender); return CommandResult.INVALID_ARGS; } diff --git a/common/src/main/java/me/lucko/luckperms/commands/track/subcommands/TrackRemove.java b/common/src/main/java/me/lucko/luckperms/commands/track/subcommands/TrackRemove.java index 5e652e080..9d399bc01 100644 --- a/common/src/main/java/me/lucko/luckperms/commands/track/subcommands/TrackRemove.java +++ b/common/src/main/java/me/lucko/luckperms/commands/track/subcommands/TrackRemove.java @@ -35,7 +35,9 @@ import java.util.List; public class TrackRemove extends SubCommand { public TrackRemove() { - super("remove", "Removes a group from the track", "", Permission.TRACK_REMOVE, Predicate.not(1)); + super("remove", "Removes a group from the track", Permission.TRACK_REMOVE, Predicate.not(1), + Arg.list(Arg.create("group", true, "the group to remove")) + ); } @Override @@ -43,7 +45,7 @@ public class TrackRemove extends SubCommand { String groupName = args.get(0).toLowerCase(); if (ArgumentChecker.checkNode(groupName)) { - sendUsage(sender); + sendDetailedUsage(sender); return CommandResult.INVALID_ARGS; } diff --git a/common/src/main/java/me/lucko/luckperms/commands/track/subcommands/TrackRename.java b/common/src/main/java/me/lucko/luckperms/commands/track/subcommands/TrackRename.java index 0e0b1f5e5..7eb55cec7 100644 --- a/common/src/main/java/me/lucko/luckperms/commands/track/subcommands/TrackRename.java +++ b/common/src/main/java/me/lucko/luckperms/commands/track/subcommands/TrackRename.java @@ -23,10 +23,7 @@ package me.lucko.luckperms.commands.track.subcommands; import me.lucko.luckperms.LuckPermsPlugin; -import me.lucko.luckperms.commands.CommandResult; -import me.lucko.luckperms.commands.Predicate; -import me.lucko.luckperms.commands.Sender; -import me.lucko.luckperms.commands.SubCommand; +import me.lucko.luckperms.commands.*; import me.lucko.luckperms.constants.Message; import me.lucko.luckperms.constants.Permission; import me.lucko.luckperms.data.LogEntry; @@ -37,7 +34,9 @@ import java.util.List; public class TrackRename extends SubCommand { public TrackRename() { - super("rename", "Rename this track", "", Permission.TRACK_APPEND, Predicate.not(1)); + super("rename", "Rename the track", Permission.TRACK_APPEND, Predicate.not(1), + Arg.list(Arg.create("name", true, "the new name")) + ); } @Override diff --git a/common/src/main/java/me/lucko/luckperms/commands/user/subcommands/UserAddGroup.java b/common/src/main/java/me/lucko/luckperms/commands/user/subcommands/UserAddGroup.java index a30128bcd..c028bf775 100644 --- a/common/src/main/java/me/lucko/luckperms/commands/user/subcommands/UserAddGroup.java +++ b/common/src/main/java/me/lucko/luckperms/commands/user/subcommands/UserAddGroup.java @@ -23,10 +23,7 @@ package me.lucko.luckperms.commands.user.subcommands; import me.lucko.luckperms.LuckPermsPlugin; -import me.lucko.luckperms.commands.CommandResult; -import me.lucko.luckperms.commands.Predicate; -import me.lucko.luckperms.commands.Sender; -import me.lucko.luckperms.commands.SubCommand; +import me.lucko.luckperms.commands.*; import me.lucko.luckperms.constants.Message; import me.lucko.luckperms.constants.Permission; import me.lucko.luckperms.data.LogEntry; @@ -39,7 +36,13 @@ import java.util.List; public class UserAddGroup extends SubCommand { public UserAddGroup() { - super("addgroup", "Adds the user to a group", " [server] [world]", Permission.USER_ADDGROUP, Predicate.notInRange(1, 3)); + super("addgroup", "Adds the user to a group", Permission.USER_ADDGROUP, Predicate.notInRange(1, 3), + Arg.list( + Arg.create("group", true, "the group to add the user to"), + Arg.create("server", false, "the server to add the group on"), + Arg.create("world", false, "the world to add the group on") + ) + ); } @Override @@ -47,7 +50,7 @@ public class UserAddGroup extends SubCommand { String groupName = args.get(0).toLowerCase(); if (ArgumentChecker.checkNode(groupName)) { - sendUsage(sender); + sendDetailedUsage(sender); return CommandResult.INVALID_ARGS; } diff --git a/common/src/main/java/me/lucko/luckperms/commands/user/subcommands/UserAddPrefix.java b/common/src/main/java/me/lucko/luckperms/commands/user/subcommands/UserAddPrefix.java index 76138d944..562f30ee9 100644 --- a/common/src/main/java/me/lucko/luckperms/commands/user/subcommands/UserAddPrefix.java +++ b/common/src/main/java/me/lucko/luckperms/commands/user/subcommands/UserAddPrefix.java @@ -23,10 +23,7 @@ package me.lucko.luckperms.commands.user.subcommands; import me.lucko.luckperms.LuckPermsPlugin; -import me.lucko.luckperms.commands.CommandResult; -import me.lucko.luckperms.commands.Predicate; -import me.lucko.luckperms.commands.Sender; -import me.lucko.luckperms.commands.SubCommand; +import me.lucko.luckperms.commands.*; import me.lucko.luckperms.constants.Message; import me.lucko.luckperms.constants.Permission; import me.lucko.luckperms.data.LogEntry; @@ -38,8 +35,14 @@ import java.util.List; public class UserAddPrefix extends SubCommand { public UserAddPrefix() { - super("addprefix", "Adds a prefix to the user", " [server] [world]", Permission.USER_ADDPREFIX, - Predicate.notInRange(2, 4)); + super("addprefix", "Adds a prefix to the user", Permission.USER_ADDPREFIX, Predicate.notInRange(2, 4), + Arg.list( + Arg.create("priority", true, "the priority to add the prefix at"), + Arg.create("prefix", true, "the prefix string"), + Arg.create("server", false, "the server to add the prefix on"), + Arg.create("world", false, "the world to add the prefix on") + ) + ); } @Override diff --git a/common/src/main/java/me/lucko/luckperms/commands/user/subcommands/UserAddSuffix.java b/common/src/main/java/me/lucko/luckperms/commands/user/subcommands/UserAddSuffix.java index 0438ceb15..d543e8664 100644 --- a/common/src/main/java/me/lucko/luckperms/commands/user/subcommands/UserAddSuffix.java +++ b/common/src/main/java/me/lucko/luckperms/commands/user/subcommands/UserAddSuffix.java @@ -23,10 +23,7 @@ package me.lucko.luckperms.commands.user.subcommands; import me.lucko.luckperms.LuckPermsPlugin; -import me.lucko.luckperms.commands.CommandResult; -import me.lucko.luckperms.commands.Predicate; -import me.lucko.luckperms.commands.Sender; -import me.lucko.luckperms.commands.SubCommand; +import me.lucko.luckperms.commands.*; import me.lucko.luckperms.constants.Message; import me.lucko.luckperms.constants.Permission; import me.lucko.luckperms.data.LogEntry; @@ -38,8 +35,14 @@ import java.util.List; public class UserAddSuffix extends SubCommand { public UserAddSuffix() { - super("addsuffix", "Adds a suffix to the user", " [server] [world]", Permission.USER_ADDSUFFIX, - Predicate.notInRange(2, 4)); + super("addsuffix", "Adds a suffix to the user", Permission.USER_ADDSUFFIX, Predicate.notInRange(2, 4), + Arg.list( + Arg.create("priority", true, "the priority to add the suffix at"), + Arg.create("suffix", true, "the suffix string"), + Arg.create("server", false, "the server to add the suffix on"), + Arg.create("world", false, "the world to add the suffix on") + ) + ); } @Override diff --git a/common/src/main/java/me/lucko/luckperms/commands/user/subcommands/UserAddTempGroup.java b/common/src/main/java/me/lucko/luckperms/commands/user/subcommands/UserAddTempGroup.java index a38830f61..30625cf0a 100644 --- a/common/src/main/java/me/lucko/luckperms/commands/user/subcommands/UserAddTempGroup.java +++ b/common/src/main/java/me/lucko/luckperms/commands/user/subcommands/UserAddTempGroup.java @@ -23,10 +23,7 @@ package me.lucko.luckperms.commands.user.subcommands; import me.lucko.luckperms.LuckPermsPlugin; -import me.lucko.luckperms.commands.CommandResult; -import me.lucko.luckperms.commands.Predicate; -import me.lucko.luckperms.commands.Sender; -import me.lucko.luckperms.commands.SubCommand; +import me.lucko.luckperms.commands.*; import me.lucko.luckperms.constants.Message; import me.lucko.luckperms.constants.Permission; import me.lucko.luckperms.data.LogEntry; @@ -40,8 +37,14 @@ import java.util.List; public class UserAddTempGroup extends SubCommand { public UserAddTempGroup() { - super("addtempgroup", "Adds the user to a group temporarily", " [server] [world]", - Permission.USER_ADDTEMPGROUP, Predicate.notInRange(2, 4)); + super("addtempgroup", "Adds the user to a group temporarily", Permission.USER_ADDTEMPGROUP, Predicate.notInRange(2, 4), + Arg.list( + Arg.create("group", true, "the group to add the user to"), + Arg.create("duration", true, "the duration of the group membership"), + Arg.create("server", false, "the server to add the group on"), + Arg.create("world", false, "the world to add the group on") + ) + ); } @Override @@ -49,7 +52,7 @@ public class UserAddTempGroup extends SubCommand { String groupName = args.get(0).toLowerCase(); if (ArgumentChecker.checkNode(groupName)) { - sendUsage(sender); + sendDetailedUsage(sender); return CommandResult.INVALID_ARGS; } diff --git a/common/src/main/java/me/lucko/luckperms/commands/user/subcommands/UserAddTempPrefix.java b/common/src/main/java/me/lucko/luckperms/commands/user/subcommands/UserAddTempPrefix.java index 351678e88..6379833d8 100644 --- a/common/src/main/java/me/lucko/luckperms/commands/user/subcommands/UserAddTempPrefix.java +++ b/common/src/main/java/me/lucko/luckperms/commands/user/subcommands/UserAddTempPrefix.java @@ -23,10 +23,7 @@ package me.lucko.luckperms.commands.user.subcommands; import me.lucko.luckperms.LuckPermsPlugin; -import me.lucko.luckperms.commands.CommandResult; -import me.lucko.luckperms.commands.Predicate; -import me.lucko.luckperms.commands.Sender; -import me.lucko.luckperms.commands.SubCommand; +import me.lucko.luckperms.commands.*; import me.lucko.luckperms.constants.Message; import me.lucko.luckperms.constants.Permission; import me.lucko.luckperms.data.LogEntry; @@ -39,8 +36,15 @@ import java.util.List; public class UserAddTempPrefix extends SubCommand { public UserAddTempPrefix() { - super("addtempprefix", "Adds a prefix to the user temporarily", " [server] [world]", - Permission.USER_ADD_TEMP_PREFIX, Predicate.notInRange(3, 5)); + super("addtempprefix", "Adds a prefix to the user temporarily", Permission.USER_ADD_TEMP_PREFIX, Predicate.notInRange(3, 5), + Arg.list( + Arg.create("priority", true, "the priority to add the prefix at"), + Arg.create("prefix", true, "the prefix string"), + Arg.create("duration", true, "the duration until the prefix expires"), + Arg.create("server", false, "the server to add the prefix on"), + Arg.create("world", false, "the world to add the prefix on") + ) + ); } @Override diff --git a/common/src/main/java/me/lucko/luckperms/commands/user/subcommands/UserAddTempSuffix.java b/common/src/main/java/me/lucko/luckperms/commands/user/subcommands/UserAddTempSuffix.java index fff297619..db32bee33 100644 --- a/common/src/main/java/me/lucko/luckperms/commands/user/subcommands/UserAddTempSuffix.java +++ b/common/src/main/java/me/lucko/luckperms/commands/user/subcommands/UserAddTempSuffix.java @@ -23,10 +23,7 @@ package me.lucko.luckperms.commands.user.subcommands; import me.lucko.luckperms.LuckPermsPlugin; -import me.lucko.luckperms.commands.CommandResult; -import me.lucko.luckperms.commands.Predicate; -import me.lucko.luckperms.commands.Sender; -import me.lucko.luckperms.commands.SubCommand; +import me.lucko.luckperms.commands.*; import me.lucko.luckperms.constants.Message; import me.lucko.luckperms.constants.Permission; import me.lucko.luckperms.data.LogEntry; @@ -39,8 +36,15 @@ import java.util.List; public class UserAddTempSuffix extends SubCommand { public UserAddTempSuffix() { - super("addtempsuffix", "Adds a suffix to the user temporarily", " [server] [world]", - Permission.USER_ADD_TEMP_SUFFIX, Predicate.notInRange(3, 5)); + super("addtempsuffix", "Adds a suffix to the user temporarily", Permission.USER_ADD_TEMP_SUFFIX, Predicate.notInRange(3, 5), + Arg.list( + Arg.create("priority", true, "the priority to add the suffix at"), + Arg.create("suffix", true, "the suffix string"), + Arg.create("duration", true, "the duration until the suffix expires"), + Arg.create("server", false, "the server to add the suffix on"), + Arg.create("world", false, "the world to add the suffix on") + ) + ); } @Override diff --git a/common/src/main/java/me/lucko/luckperms/commands/user/subcommands/UserBulkChange.java b/common/src/main/java/me/lucko/luckperms/commands/user/subcommands/UserBulkChange.java index 6ed2d1bda..53d063c51 100644 --- a/common/src/main/java/me/lucko/luckperms/commands/user/subcommands/UserBulkChange.java +++ b/common/src/main/java/me/lucko/luckperms/commands/user/subcommands/UserBulkChange.java @@ -24,10 +24,7 @@ package me.lucko.luckperms.commands.user.subcommands; import me.lucko.luckperms.LuckPermsPlugin; import me.lucko.luckperms.api.Node; -import me.lucko.luckperms.commands.CommandResult; -import me.lucko.luckperms.commands.Predicate; -import me.lucko.luckperms.commands.Sender; -import me.lucko.luckperms.commands.SubCommand; +import me.lucko.luckperms.commands.*; import me.lucko.luckperms.constants.Message; import me.lucko.luckperms.constants.Permission; import me.lucko.luckperms.users.User; @@ -39,8 +36,13 @@ import java.util.Set; public class UserBulkChange extends SubCommand { public UserBulkChange() { - super("bulkchange", "Applies a bulk permission change to the users permissions", " ", - Permission.USER_BULKCHANGE, Predicate.not(3)); + super("bulkchange", "Applies a bulk permission change to the user's permissions", Permission.USER_BULKCHANGE, Predicate.not(3), + Arg.list( + Arg.create("server|world", true, "if the bulk change is modifying a 'server' or a 'world'"), + Arg.create("from", true, "the server/world to be changed from. can be 'global' or 'null' respectively"), + Arg.create("to", true, "the server/world to replace 'from' (can be 'null')") + ) + ); } @Override diff --git a/common/src/main/java/me/lucko/luckperms/commands/user/subcommands/UserChatMeta.java b/common/src/main/java/me/lucko/luckperms/commands/user/subcommands/UserChatMeta.java index d56ff0d12..9405f800f 100644 --- a/common/src/main/java/me/lucko/luckperms/commands/user/subcommands/UserChatMeta.java +++ b/common/src/main/java/me/lucko/luckperms/commands/user/subcommands/UserChatMeta.java @@ -38,7 +38,7 @@ import java.util.TreeSet; public class UserChatMeta extends SubCommand { public UserChatMeta() { - super("chatmeta", "Displays a users chat meta", "", Permission.USER_CHATMETA, Predicate.alwaysFalse()); + super("chatmeta", "Lists the user's chat meta", Permission.USER_CHATMETA, Predicate.alwaysFalse(), null); } @Override diff --git a/common/src/main/java/me/lucko/luckperms/commands/user/subcommands/UserClear.java b/common/src/main/java/me/lucko/luckperms/commands/user/subcommands/UserClear.java index 0290d335e..5c3cb3976 100644 --- a/common/src/main/java/me/lucko/luckperms/commands/user/subcommands/UserClear.java +++ b/common/src/main/java/me/lucko/luckperms/commands/user/subcommands/UserClear.java @@ -36,7 +36,7 @@ import java.util.List; public class UserClear extends SubCommand { public UserClear() { - super("clear", "Clears a users permissions and groups", "", Permission.USER_CLEAR, Predicate.alwaysFalse()); + super("clear", "Clears the user's permissions and groups", Permission.USER_CLEAR, Predicate.alwaysFalse(), null); } @Override diff --git a/common/src/main/java/me/lucko/luckperms/commands/user/subcommands/UserDemote.java b/common/src/main/java/me/lucko/luckperms/commands/user/subcommands/UserDemote.java index bf3ea0da2..51a54edc2 100644 --- a/common/src/main/java/me/lucko/luckperms/commands/user/subcommands/UserDemote.java +++ b/common/src/main/java/me/lucko/luckperms/commands/user/subcommands/UserDemote.java @@ -41,7 +41,9 @@ import java.util.List; public class UserDemote extends SubCommand { public UserDemote() { - super("demote", "Demotes a user along a track", "", Permission.USER_DEMOTE, Predicate.not(1)); + super("demote", "Demotes the user down a track", Permission.USER_DEMOTE, Predicate.not(1), + Arg.list(Arg.create("track", true, "the track to demote the user down")) + ); } @Override diff --git a/common/src/main/java/me/lucko/luckperms/commands/user/subcommands/UserGetUUID.java b/common/src/main/java/me/lucko/luckperms/commands/user/subcommands/UserGetUUID.java index b0705dba9..b6047eb12 100644 --- a/common/src/main/java/me/lucko/luckperms/commands/user/subcommands/UserGetUUID.java +++ b/common/src/main/java/me/lucko/luckperms/commands/user/subcommands/UserGetUUID.java @@ -35,7 +35,7 @@ import java.util.List; public class UserGetUUID extends SubCommand { public UserGetUUID() { - super("getuuid", "Get the UUID of a user", "", Permission.USER_GETUUID, Predicate.alwaysFalse()); + super("getuuid", "Displays the user's internal LuckPerms unique id", Permission.USER_GETUUID, Predicate.alwaysFalse(), null); } @Override diff --git a/common/src/main/java/me/lucko/luckperms/commands/user/subcommands/UserHasPerm.java b/common/src/main/java/me/lucko/luckperms/commands/user/subcommands/UserHasPerm.java index 454cd8f23..561fbd1c8 100644 --- a/common/src/main/java/me/lucko/luckperms/commands/user/subcommands/UserHasPerm.java +++ b/common/src/main/java/me/lucko/luckperms/commands/user/subcommands/UserHasPerm.java @@ -33,8 +33,14 @@ import java.util.List; public class UserHasPerm extends SubCommand { public UserHasPerm() { - super("haspermission", "Checks to see if a user has a certain permission node", " [server] [world]", - Permission.USER_HASPERMISSION, Predicate.notInRange(1, 3)); + super("haspermission", "Checks to see if the user has a certain permission node", Permission.USER_HASPERMISSION, + Predicate.notInRange(1, 3), + Arg.list( + Arg.create("node", true, "the permission node to check for"), + Arg.create("server", false, "the server to check on"), + Arg.create("world", false, "the world to check on") + ) + ); } @Override diff --git a/common/src/main/java/me/lucko/luckperms/commands/user/subcommands/UserInfo.java b/common/src/main/java/me/lucko/luckperms/commands/user/subcommands/UserInfo.java index 0a5562131..731a8d365 100644 --- a/common/src/main/java/me/lucko/luckperms/commands/user/subcommands/UserInfo.java +++ b/common/src/main/java/me/lucko/luckperms/commands/user/subcommands/UserInfo.java @@ -35,7 +35,7 @@ import java.util.List; public class UserInfo extends SubCommand { public UserInfo() { - super("info", "Gives info about the user", "", Permission.USER_INFO, Predicate.alwaysFalse()); + super("info", "Shows info about the user", Permission.USER_INFO, Predicate.alwaysFalse(), null); } @Override diff --git a/common/src/main/java/me/lucko/luckperms/commands/user/subcommands/UserInheritsPerm.java b/common/src/main/java/me/lucko/luckperms/commands/user/subcommands/UserInheritsPerm.java index 77596889a..032c766ee 100644 --- a/common/src/main/java/me/lucko/luckperms/commands/user/subcommands/UserInheritsPerm.java +++ b/common/src/main/java/me/lucko/luckperms/commands/user/subcommands/UserInheritsPerm.java @@ -33,8 +33,14 @@ import java.util.List; public class UserInheritsPerm extends SubCommand { public UserInheritsPerm() { - super("inheritspermission", "Checks to see if a user inherits a certain permission node", - " [server] [world]", Permission.USER_INHERITSPERMISSION, Predicate.notInRange(1, 3)); + super("inheritspermission", "Checks to see if the user inherits a certain permission node", + Permission.USER_INHERITSPERMISSION, Predicate.notInRange(1, 3), + Arg.list( + Arg.create("node", true, "the permission node to check for"), + Arg.create("server", false, "the server to check on"), + Arg.create("world", false, "the world to check on") + ) + ); } @Override diff --git a/common/src/main/java/me/lucko/luckperms/commands/user/subcommands/UserListGroups.java b/common/src/main/java/me/lucko/luckperms/commands/user/subcommands/UserListGroups.java index b0d1dbc4e..e3440dd4f 100644 --- a/common/src/main/java/me/lucko/luckperms/commands/user/subcommands/UserListGroups.java +++ b/common/src/main/java/me/lucko/luckperms/commands/user/subcommands/UserListGroups.java @@ -32,7 +32,7 @@ import java.util.List; public class UserListGroups extends SubCommand { public UserListGroups() { - super("listgroups", "Lists the groups a user is in", "", Permission.USER_LISTGROUPS, Predicate.alwaysFalse()); + super("listgroups", "Lists the groups the user is a member of", Permission.USER_LISTGROUPS, Predicate.alwaysFalse(), null); } @Override diff --git a/common/src/main/java/me/lucko/luckperms/commands/user/subcommands/UserListNodes.java b/common/src/main/java/me/lucko/luckperms/commands/user/subcommands/UserListNodes.java index f79dbee14..7889b5a8b 100644 --- a/common/src/main/java/me/lucko/luckperms/commands/user/subcommands/UserListNodes.java +++ b/common/src/main/java/me/lucko/luckperms/commands/user/subcommands/UserListNodes.java @@ -32,7 +32,7 @@ import java.util.List; public class UserListNodes extends SubCommand { public UserListNodes() { - super("listnodes", "Lists the permission nodes the user has", "", Permission.USER_LISTNODES, Predicate.alwaysFalse()); + super("listnodes", "Lists the permission nodes the user has", Permission.USER_LISTNODES, Predicate.alwaysFalse(), null); } @Override diff --git a/common/src/main/java/me/lucko/luckperms/commands/user/subcommands/UserPromote.java b/common/src/main/java/me/lucko/luckperms/commands/user/subcommands/UserPromote.java index 2c68c1afe..2437854b0 100644 --- a/common/src/main/java/me/lucko/luckperms/commands/user/subcommands/UserPromote.java +++ b/common/src/main/java/me/lucko/luckperms/commands/user/subcommands/UserPromote.java @@ -41,7 +41,9 @@ import java.util.List; public class UserPromote extends SubCommand { public UserPromote() { - super("promote", "Promotes the user along a track", "", Permission.USER_PROMOTE, Predicate.not(1)); + super("promote", "Promotes the user up a track", Permission.USER_PROMOTE, Predicate.not(1), + Arg.list(Arg.create("track", true, "the track to promote the user up")) + ); } @Override diff --git a/common/src/main/java/me/lucko/luckperms/commands/user/subcommands/UserRemoveGroup.java b/common/src/main/java/me/lucko/luckperms/commands/user/subcommands/UserRemoveGroup.java index 930fb4e5a..a85284b58 100644 --- a/common/src/main/java/me/lucko/luckperms/commands/user/subcommands/UserRemoveGroup.java +++ b/common/src/main/java/me/lucko/luckperms/commands/user/subcommands/UserRemoveGroup.java @@ -23,10 +23,7 @@ package me.lucko.luckperms.commands.user.subcommands; import me.lucko.luckperms.LuckPermsPlugin; -import me.lucko.luckperms.commands.CommandResult; -import me.lucko.luckperms.commands.Predicate; -import me.lucko.luckperms.commands.Sender; -import me.lucko.luckperms.commands.SubCommand; +import me.lucko.luckperms.commands.*; import me.lucko.luckperms.constants.Message; import me.lucko.luckperms.constants.Permission; import me.lucko.luckperms.data.LogEntry; @@ -38,8 +35,13 @@ import java.util.List; public class UserRemoveGroup extends SubCommand { public UserRemoveGroup() { - super("removegroup", "Removes a user from a group", " [server] [world]", Permission.USER_REMOVEGROUP, - Predicate.notInRange(1, 3)); + super("removegroup", "Removes the user from a group", Permission.USER_REMOVEGROUP, Predicate.notInRange(1, 3), + Arg.list( + Arg.create("group", true, "the group to remove the user from"), + Arg.create("server", false, "the server to remove the group on"), + Arg.create("world", false, "the world to remove the group on") + ) + ); } @Override @@ -47,7 +49,7 @@ public class UserRemoveGroup extends SubCommand { String groupName = args.get(0).toLowerCase(); if (ArgumentChecker.checkNode(groupName)) { - sendUsage(sender); + sendDetailedUsage(sender); return CommandResult.INVALID_ARGS; } diff --git a/common/src/main/java/me/lucko/luckperms/commands/user/subcommands/UserRemovePrefix.java b/common/src/main/java/me/lucko/luckperms/commands/user/subcommands/UserRemovePrefix.java index e6acb808a..ee77eea10 100644 --- a/common/src/main/java/me/lucko/luckperms/commands/user/subcommands/UserRemovePrefix.java +++ b/common/src/main/java/me/lucko/luckperms/commands/user/subcommands/UserRemovePrefix.java @@ -23,10 +23,7 @@ package me.lucko.luckperms.commands.user.subcommands; import me.lucko.luckperms.LuckPermsPlugin; -import me.lucko.luckperms.commands.CommandResult; -import me.lucko.luckperms.commands.Predicate; -import me.lucko.luckperms.commands.Sender; -import me.lucko.luckperms.commands.SubCommand; +import me.lucko.luckperms.commands.*; import me.lucko.luckperms.constants.Message; import me.lucko.luckperms.constants.Permission; import me.lucko.luckperms.data.LogEntry; @@ -38,8 +35,14 @@ import java.util.List; public class UserRemovePrefix extends SubCommand { public UserRemovePrefix() { - super("removeprefix", "Removes a prefix from a user", " [server] [world]", - Permission.USER_REMOVEPREFIX, Predicate.notInRange(2, 4)); + super("removeprefix", "Removes a prefix from the user", Permission.USER_REMOVEPREFIX, Predicate.notInRange(2, 4), + Arg.list( + Arg.create("priority", true, "the priority to remove the prefix at"), + Arg.create("prefix", true, "the prefix string to remove"), + Arg.create("server", false, "the server to remove the prefix on"), + Arg.create("world", false, "the world to remove the prefix on") + ) + ); } @Override diff --git a/common/src/main/java/me/lucko/luckperms/commands/user/subcommands/UserRemoveSuffix.java b/common/src/main/java/me/lucko/luckperms/commands/user/subcommands/UserRemoveSuffix.java index 9cee183f6..96fdc8eca 100644 --- a/common/src/main/java/me/lucko/luckperms/commands/user/subcommands/UserRemoveSuffix.java +++ b/common/src/main/java/me/lucko/luckperms/commands/user/subcommands/UserRemoveSuffix.java @@ -23,10 +23,7 @@ package me.lucko.luckperms.commands.user.subcommands; import me.lucko.luckperms.LuckPermsPlugin; -import me.lucko.luckperms.commands.CommandResult; -import me.lucko.luckperms.commands.Predicate; -import me.lucko.luckperms.commands.Sender; -import me.lucko.luckperms.commands.SubCommand; +import me.lucko.luckperms.commands.*; import me.lucko.luckperms.constants.Message; import me.lucko.luckperms.constants.Permission; import me.lucko.luckperms.data.LogEntry; @@ -38,8 +35,14 @@ import java.util.List; public class UserRemoveSuffix extends SubCommand { public UserRemoveSuffix() { - super("removesuffix", "Removes a suffix from a user", " [server] [world]", - Permission.USER_REMOVESUFFIX, Predicate.notInRange(2, 4)); + super("removesuffix", "Removes a suffix from the user", Permission.USER_REMOVESUFFIX, Predicate.notInRange(2, 4), + Arg.list( + Arg.create("priority", true, "the priority to remove the suffix at"), + Arg.create("suffix", true, "the suffix string to remove"), + Arg.create("server", false, "the server to remove the suffix on"), + Arg.create("world", false, "the world to remove the suffix on") + ) + ); } @Override diff --git a/common/src/main/java/me/lucko/luckperms/commands/user/subcommands/UserRemoveTempGroup.java b/common/src/main/java/me/lucko/luckperms/commands/user/subcommands/UserRemoveTempGroup.java index ff2140d68..80d5b666b 100644 --- a/common/src/main/java/me/lucko/luckperms/commands/user/subcommands/UserRemoveTempGroup.java +++ b/common/src/main/java/me/lucko/luckperms/commands/user/subcommands/UserRemoveTempGroup.java @@ -23,10 +23,7 @@ package me.lucko.luckperms.commands.user.subcommands; import me.lucko.luckperms.LuckPermsPlugin; -import me.lucko.luckperms.commands.CommandResult; -import me.lucko.luckperms.commands.Predicate; -import me.lucko.luckperms.commands.Sender; -import me.lucko.luckperms.commands.SubCommand; +import me.lucko.luckperms.commands.*; import me.lucko.luckperms.constants.Message; import me.lucko.luckperms.constants.Permission; import me.lucko.luckperms.data.LogEntry; @@ -38,8 +35,13 @@ import java.util.List; public class UserRemoveTempGroup extends SubCommand { public UserRemoveTempGroup() { - super("removetempgroup", "Removes a user from a temporary group", " [server] [world]", - Permission.USER_REMOVETEMPGROUP, Predicate.notInRange(1, 3)); + super("removetempgroup", "Removes the user from a temporary group", Permission.USER_REMOVETEMPGROUP, Predicate.notInRange(1, 3), + Arg.list( + Arg.create("group", true, "the group to remove the user from"), + Arg.create("server", false, "the server to remove the group on"), + Arg.create("world", false, "the world to remove the group on") + ) + ); } @Override @@ -47,7 +49,7 @@ public class UserRemoveTempGroup extends SubCommand { String groupName = args.get(0).toLowerCase(); if (ArgumentChecker.checkNode(groupName)) { - sendUsage(sender); + sendDetailedUsage(sender); return CommandResult.INVALID_ARGS; } diff --git a/common/src/main/java/me/lucko/luckperms/commands/user/subcommands/UserRemoveTempPrefix.java b/common/src/main/java/me/lucko/luckperms/commands/user/subcommands/UserRemoveTempPrefix.java index 96a095fcb..4d2f6f13c 100644 --- a/common/src/main/java/me/lucko/luckperms/commands/user/subcommands/UserRemoveTempPrefix.java +++ b/common/src/main/java/me/lucko/luckperms/commands/user/subcommands/UserRemoveTempPrefix.java @@ -23,10 +23,7 @@ package me.lucko.luckperms.commands.user.subcommands; import me.lucko.luckperms.LuckPermsPlugin; -import me.lucko.luckperms.commands.CommandResult; -import me.lucko.luckperms.commands.Predicate; -import me.lucko.luckperms.commands.Sender; -import me.lucko.luckperms.commands.SubCommand; +import me.lucko.luckperms.commands.*; import me.lucko.luckperms.constants.Message; import me.lucko.luckperms.constants.Permission; import me.lucko.luckperms.data.LogEntry; @@ -38,8 +35,15 @@ import java.util.List; public class UserRemoveTempPrefix extends SubCommand { public UserRemoveTempPrefix() { - super("removetempprefix", "Removes a temporary prefix from a user", " [server] [world]", - Permission.USER_REMOVE_TEMP_PREFIX, Predicate.notInRange(2, 4)); + super("removetempprefix", "Removes the temporary prefix from a user", Permission.USER_REMOVE_TEMP_PREFIX, + Predicate.notInRange(2, 4), + Arg.list( + Arg.create("priority", true, "the priority to remove the prefix at"), + Arg.create("prefix", true, "the prefix string to remove"), + Arg.create("server", false, "the server to remove the prefix on"), + Arg.create("world", false, "the world to remove the prefix on") + ) + ); } @Override diff --git a/common/src/main/java/me/lucko/luckperms/commands/user/subcommands/UserRemoveTempSuffix.java b/common/src/main/java/me/lucko/luckperms/commands/user/subcommands/UserRemoveTempSuffix.java index 018e294c6..cdb2e2ebb 100644 --- a/common/src/main/java/me/lucko/luckperms/commands/user/subcommands/UserRemoveTempSuffix.java +++ b/common/src/main/java/me/lucko/luckperms/commands/user/subcommands/UserRemoveTempSuffix.java @@ -23,10 +23,7 @@ package me.lucko.luckperms.commands.user.subcommands; import me.lucko.luckperms.LuckPermsPlugin; -import me.lucko.luckperms.commands.CommandResult; -import me.lucko.luckperms.commands.Predicate; -import me.lucko.luckperms.commands.Sender; -import me.lucko.luckperms.commands.SubCommand; +import me.lucko.luckperms.commands.*; import me.lucko.luckperms.constants.Message; import me.lucko.luckperms.constants.Permission; import me.lucko.luckperms.data.LogEntry; @@ -38,8 +35,15 @@ import java.util.List; public class UserRemoveTempSuffix extends SubCommand { public UserRemoveTempSuffix() { - super("removetempsuffix", "Removes a temporary suffix from a user", " [server] [world]", - Permission.USER_REMOVE_TEMP_SUFFIX, Predicate.notInRange(2, 4)); + super("removetempsuffix", "Removes the temporary suffix from a user", Permission.USER_REMOVE_TEMP_SUFFIX, + Predicate.notInRange(2, 4), + Arg.list( + Arg.create("priority", true, "the priority to remove the suffix at"), + Arg.create("suffix", true, "the suffix string to remove"), + Arg.create("server", false, "the server to remove the suffix on"), + Arg.create("world", false, "the world to remove the suffix on") + ) + ); } @Override diff --git a/common/src/main/java/me/lucko/luckperms/commands/user/subcommands/UserSetPermission.java b/common/src/main/java/me/lucko/luckperms/commands/user/subcommands/UserSetPermission.java index 21a159f88..1f13ede50 100644 --- a/common/src/main/java/me/lucko/luckperms/commands/user/subcommands/UserSetPermission.java +++ b/common/src/main/java/me/lucko/luckperms/commands/user/subcommands/UserSetPermission.java @@ -23,10 +23,7 @@ package me.lucko.luckperms.commands.user.subcommands; import me.lucko.luckperms.LuckPermsPlugin; -import me.lucko.luckperms.commands.CommandResult; -import me.lucko.luckperms.commands.Predicate; -import me.lucko.luckperms.commands.Sender; -import me.lucko.luckperms.commands.SubCommand; +import me.lucko.luckperms.commands.*; import me.lucko.luckperms.constants.Message; import me.lucko.luckperms.constants.Permission; import me.lucko.luckperms.data.LogEntry; @@ -38,8 +35,14 @@ import java.util.List; public class UserSetPermission extends SubCommand { public UserSetPermission() { - super("set", "Sets a permission for a user", " [server] [world]", Permission.USER_SETPERMISSION, - Predicate.notInRange(2, 4)); + super("set", "Sets a permission for the user", Permission.USER_SETPERMISSION, Predicate.notInRange(2, 4), + Arg.list( + Arg.create("node", true, "the permission node to set"), + Arg.create("true|false", true, "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") + ) + ); } @Override @@ -48,7 +51,7 @@ public class UserSetPermission extends SubCommand { String bool = args.get(1).toLowerCase(); if (ArgumentChecker.checkNode(node)) { - sendUsage(sender); + sendDetailedUsage(sender); return CommandResult.INVALID_ARGS; } @@ -58,7 +61,7 @@ public class UserSetPermission extends SubCommand { } if (!bool.equalsIgnoreCase("true") && !bool.equalsIgnoreCase("false")) { - sendUsage(sender); + sendDetailedUsage(sender); return CommandResult.INVALID_ARGS; } diff --git a/common/src/main/java/me/lucko/luckperms/commands/user/subcommands/UserSetPrimaryGroup.java b/common/src/main/java/me/lucko/luckperms/commands/user/subcommands/UserSetPrimaryGroup.java index 20ed22fb7..b1bbc2bc5 100644 --- a/common/src/main/java/me/lucko/luckperms/commands/user/subcommands/UserSetPrimaryGroup.java +++ b/common/src/main/java/me/lucko/luckperms/commands/user/subcommands/UserSetPrimaryGroup.java @@ -23,10 +23,7 @@ package me.lucko.luckperms.commands.user.subcommands; import me.lucko.luckperms.LuckPermsPlugin; -import me.lucko.luckperms.commands.CommandResult; -import me.lucko.luckperms.commands.Predicate; -import me.lucko.luckperms.commands.Sender; -import me.lucko.luckperms.commands.SubCommand; +import me.lucko.luckperms.commands.*; import me.lucko.luckperms.constants.Message; import me.lucko.luckperms.constants.Permission; import me.lucko.luckperms.data.LogEntry; @@ -38,7 +35,9 @@ import java.util.List; public class UserSetPrimaryGroup extends SubCommand { public UserSetPrimaryGroup() { - super("setprimarygroup", "Sets a users primary group", "", Permission.USER_SETPRIMARYGROUP, Predicate.not(1)); + super("setprimarygroup", "Sets the user's primary group", Permission.USER_SETPRIMARYGROUP, Predicate.not(1), + Arg.list(Arg.create("group", true, "the group to set as the primary group")) + ); } @Override diff --git a/common/src/main/java/me/lucko/luckperms/commands/user/subcommands/UserSetTempPermission.java b/common/src/main/java/me/lucko/luckperms/commands/user/subcommands/UserSetTempPermission.java index 7b5b893dd..586f4bbfe 100644 --- a/common/src/main/java/me/lucko/luckperms/commands/user/subcommands/UserSetTempPermission.java +++ b/common/src/main/java/me/lucko/luckperms/commands/user/subcommands/UserSetTempPermission.java @@ -23,10 +23,7 @@ package me.lucko.luckperms.commands.user.subcommands; import me.lucko.luckperms.LuckPermsPlugin; -import me.lucko.luckperms.commands.CommandResult; -import me.lucko.luckperms.commands.Predicate; -import me.lucko.luckperms.commands.Sender; -import me.lucko.luckperms.commands.SubCommand; +import me.lucko.luckperms.commands.*; import me.lucko.luckperms.constants.Message; import me.lucko.luckperms.constants.Permission; import me.lucko.luckperms.data.LogEntry; @@ -39,8 +36,16 @@ import java.util.List; public class UserSetTempPermission extends SubCommand { public UserSetTempPermission() { - super("settemp", "Sets a temporary permission for a user", " [server] [world]", - Permission.USER_SET_TEMP_PERMISSION, Predicate.notInRange(3, 5)); + super("settemp", "Sets a permission for the user temporarily", Permission.USER_SET_TEMP_PERMISSION, + Predicate.notInRange(3, 5), + Arg.list( + Arg.create("node", true, "the permission node to set"), + Arg.create("true|false", true, "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") + ) + ); } @Override @@ -49,7 +54,7 @@ public class UserSetTempPermission extends SubCommand { String bool = args.get(1).toLowerCase(); if (ArgumentChecker.checkNode(node)) { - sendUsage(sender); + sendDetailedUsage(sender); return CommandResult.INVALID_ARGS; } @@ -59,7 +64,7 @@ public class UserSetTempPermission extends SubCommand { } if (!bool.equalsIgnoreCase("true") && !bool.equalsIgnoreCase("false")) { - sendUsage(sender); + sendDetailedUsage(sender); return CommandResult.INVALID_ARGS; } diff --git a/common/src/main/java/me/lucko/luckperms/commands/user/subcommands/UserShowPos.java b/common/src/main/java/me/lucko/luckperms/commands/user/subcommands/UserShowPos.java index 5d421ace1..cfcb416fb 100644 --- a/common/src/main/java/me/lucko/luckperms/commands/user/subcommands/UserShowPos.java +++ b/common/src/main/java/me/lucko/luckperms/commands/user/subcommands/UserShowPos.java @@ -34,7 +34,9 @@ import java.util.List; public class UserShowPos extends SubCommand { public UserShowPos() { - super("showpos", "Shows a users position on a track", "", Permission.USER_SHOWPOS, Predicate.not(1)); + super("showpos", "Shows the user's position on a track", Permission.USER_SHOWPOS, Predicate.not(1), + Arg.list(Arg.create("track", true, "the track name")) + ); } @Override diff --git a/common/src/main/java/me/lucko/luckperms/commands/user/subcommands/UserShowTracks.java b/common/src/main/java/me/lucko/luckperms/commands/user/subcommands/UserShowTracks.java index 9a633a2c0..b90650d97 100644 --- a/common/src/main/java/me/lucko/luckperms/commands/user/subcommands/UserShowTracks.java +++ b/common/src/main/java/me/lucko/luckperms/commands/user/subcommands/UserShowTracks.java @@ -34,8 +34,8 @@ import java.util.stream.Collectors; public class UserShowTracks extends SubCommand { public UserShowTracks() { - super("showtracks", "Lists the tracks that this user's primary group features on", "", Permission.USER_SHOWTRACKS, - Predicate.alwaysFalse()); + super("showtracks", "Lists the tracks that the user's primary group features on", Permission.USER_SHOWTRACKS, + Predicate.alwaysFalse(), null); } @Override diff --git a/common/src/main/java/me/lucko/luckperms/commands/user/subcommands/UserUnSetPermission.java b/common/src/main/java/me/lucko/luckperms/commands/user/subcommands/UserUnSetPermission.java index d649ca7c2..6081f7f52 100644 --- a/common/src/main/java/me/lucko/luckperms/commands/user/subcommands/UserUnSetPermission.java +++ b/common/src/main/java/me/lucko/luckperms/commands/user/subcommands/UserUnSetPermission.java @@ -23,10 +23,7 @@ package me.lucko.luckperms.commands.user.subcommands; import me.lucko.luckperms.LuckPermsPlugin; -import me.lucko.luckperms.commands.CommandResult; -import me.lucko.luckperms.commands.Predicate; -import me.lucko.luckperms.commands.Sender; -import me.lucko.luckperms.commands.SubCommand; +import me.lucko.luckperms.commands.*; import me.lucko.luckperms.constants.Message; import me.lucko.luckperms.constants.Permission; import me.lucko.luckperms.data.LogEntry; @@ -38,8 +35,13 @@ import java.util.List; public class UserUnSetPermission extends SubCommand { public UserUnSetPermission() { - super("unset", "Unsets a permission for a user", " [server] [world]", Permission.USER_UNSETPERMISSION, - Predicate.notInRange(1, 3)); + super("unset", "Unsets a permission for the user", Permission.USER_UNSETPERMISSION, Predicate.notInRange(1, 3), + Arg.list( + Arg.create("node", true, "the permission node to unset"), + Arg.create("server", false, "the server to remove the permission node on"), + Arg.create("world", false, "the world to remove the permission node on") + ) + ); } @Override @@ -47,7 +49,7 @@ public class UserUnSetPermission extends SubCommand { String node = args.get(0).replace("{SPACE}", " "); if (ArgumentChecker.checkNode(node)) { - sendUsage(sender); + sendDetailedUsage(sender); return CommandResult.INVALID_ARGS; } diff --git a/common/src/main/java/me/lucko/luckperms/commands/user/subcommands/UserUnsetTempPermission.java b/common/src/main/java/me/lucko/luckperms/commands/user/subcommands/UserUnsetTempPermission.java index f69ba7999..3384b8f12 100644 --- a/common/src/main/java/me/lucko/luckperms/commands/user/subcommands/UserUnsetTempPermission.java +++ b/common/src/main/java/me/lucko/luckperms/commands/user/subcommands/UserUnsetTempPermission.java @@ -23,10 +23,7 @@ package me.lucko.luckperms.commands.user.subcommands; import me.lucko.luckperms.LuckPermsPlugin; -import me.lucko.luckperms.commands.CommandResult; -import me.lucko.luckperms.commands.Predicate; -import me.lucko.luckperms.commands.Sender; -import me.lucko.luckperms.commands.SubCommand; +import me.lucko.luckperms.commands.*; import me.lucko.luckperms.constants.Message; import me.lucko.luckperms.constants.Permission; import me.lucko.luckperms.data.LogEntry; @@ -38,8 +35,14 @@ import java.util.List; public class UserUnsetTempPermission extends SubCommand { public UserUnsetTempPermission() { - super("unsettemp", "Unsets a temporary permission for a user", " [server] [world]", - Permission.USER_UNSET_TEMP_PERMISSION, Predicate.notInRange(1, 3)); + super("unsettemp", "Unsets a temporary permission for the user", Permission.USER_UNSET_TEMP_PERMISSION, + Predicate.notInRange(1, 3), + Arg.list( + Arg.create("node", true, "the permission node to unset"), + Arg.create("server", false, "the server to remove the permission node on"), + Arg.create("world", false, "the world to remove the permission node on") + ) + ); } @Override @@ -47,7 +50,7 @@ public class UserUnsetTempPermission extends SubCommand { String node = args.get(0).replace("{SPACE}", " "); if (ArgumentChecker.checkNode(node)) { - sendUsage(sender); + sendDetailedUsage(sender); return CommandResult.INVALID_ARGS; } diff --git a/common/src/main/java/me/lucko/luckperms/commands/usersbulkedit/subcommands/BulkEditGroup.java b/common/src/main/java/me/lucko/luckperms/commands/usersbulkedit/subcommands/BulkEditGroup.java index 8d6119dce..176c9add6 100644 --- a/common/src/main/java/me/lucko/luckperms/commands/usersbulkedit/subcommands/BulkEditGroup.java +++ b/common/src/main/java/me/lucko/luckperms/commands/usersbulkedit/subcommands/BulkEditGroup.java @@ -24,10 +24,7 @@ package me.lucko.luckperms.commands.usersbulkedit.subcommands; import me.lucko.luckperms.LuckPermsPlugin; import me.lucko.luckperms.api.Node; -import me.lucko.luckperms.commands.CommandResult; -import me.lucko.luckperms.commands.Predicate; -import me.lucko.luckperms.commands.Sender; -import me.lucko.luckperms.commands.SubCommand; +import me.lucko.luckperms.commands.*; import me.lucko.luckperms.constants.Message; import me.lucko.luckperms.constants.Permission; import me.lucko.luckperms.storage.Datastore; @@ -35,10 +32,17 @@ import me.lucko.luckperms.users.User; import java.util.*; +// " ", public class BulkEditGroup extends SubCommand { public BulkEditGroup() { - super("group", "Bulk edit group memberships", " ", Permission.USER_BULKCHANGE, - Predicate.not(4)); + super("group", "Bulk edit group memberships", Permission.USER_BULKCHANGE, Predicate.not(4), + Arg.list( + Arg.create("group|null", true, "the group to edit ('null' to select and edit all groups)"), + Arg.create("server|world", true, "if the bulk change is modifying a 'server' or a 'world'"), + Arg.create("from", true, "the server/world to be changed from. can be 'global' or 'null' respectively"), + Arg.create("to", true, "the server/world to replace 'from' (can be 'null')") + ) + ); } @Override diff --git a/common/src/main/java/me/lucko/luckperms/commands/usersbulkedit/subcommands/BulkEditPermission.java b/common/src/main/java/me/lucko/luckperms/commands/usersbulkedit/subcommands/BulkEditPermission.java index 071a41678..96be94fdf 100644 --- a/common/src/main/java/me/lucko/luckperms/commands/usersbulkedit/subcommands/BulkEditPermission.java +++ b/common/src/main/java/me/lucko/luckperms/commands/usersbulkedit/subcommands/BulkEditPermission.java @@ -24,10 +24,7 @@ package me.lucko.luckperms.commands.usersbulkedit.subcommands; import me.lucko.luckperms.LuckPermsPlugin; import me.lucko.luckperms.api.Node; -import me.lucko.luckperms.commands.CommandResult; -import me.lucko.luckperms.commands.Predicate; -import me.lucko.luckperms.commands.Sender; -import me.lucko.luckperms.commands.SubCommand; +import me.lucko.luckperms.commands.*; import me.lucko.luckperms.constants.Message; import me.lucko.luckperms.constants.Permission; import me.lucko.luckperms.storage.Datastore; @@ -37,8 +34,14 @@ import java.util.*; public class BulkEditPermission extends SubCommand { public BulkEditPermission() { - super("permission", "Bulk edit permissions", " ", Permission.USER_BULKCHANGE, - Predicate.not(4)); + super("permission", "Bulk edit permissions", Permission.USER_BULKCHANGE, Predicate.not(4), + Arg.list( + Arg.create("node|null", true, "the node to edit ('null' to select and edit all nodes)"), + Arg.create("server|world", true, "if the bulk change is modifying a 'server' or a 'world'"), + Arg.create("from", true, "the server/world to be changed from. can be 'global' or 'null' respectively"), + Arg.create("to", true, "the server/world to replace 'from' (can be 'null')") + ) + ); } @Override