From 24ff4656793fb3d2df06d550310b1c7ed1abd192 Mon Sep 17 00:00:00 2001 From: Luck Date: Sun, 17 Jul 2016 14:44:52 +0100 Subject: [PATCH] Make command usage send with the correct label & bump version --- bukkit/pom.xml | 2 +- .../lucko/luckperms/CommandManagerBukkit.java | 2 +- .../me/lucko/luckperms/LPBukkitPlugin.java | 2 +- bukkit/src/main/resources/plugin.yml | 2 +- bungee/pom.xml | 2 +- .../me/lucko/luckperms/LPBungeePlugin.java | 5 ++++- .../java/me/lucko/luckperms/MainCommand.java | 2 +- bungee/src/main/resources/plugin.yml | 4 +++- common/pom.xml | 2 +- .../luckperms/commands/CommandManager.java | 18 +++++++++--------- .../lucko/luckperms/commands/MainCommand.java | 8 ++++---- .../lucko/luckperms/commands/SubCommand.java | 4 ++-- .../java/me/lucko/luckperms/commands/Util.java | 4 ---- .../commands/group/CreateGroupCommand.java | 6 +++--- .../commands/group/DeleteGroupCommand.java | 6 +++--- .../commands/group/GroupMainCommand.java | 10 +++++----- .../commands/group/GroupSubCommand.java | 2 +- .../commands/group/ListGroupsCommand.java | 4 ++-- .../group/subcommands/GroupClearCommand.java | 4 ++-- .../group/subcommands/GroupHasPermCommand.java | 4 ++-- .../group/subcommands/GroupInfoCommand.java | 6 +++--- .../subcommands/GroupInheritsPermCommand.java | 4 ++-- .../subcommands/GroupListNodesCommand.java | 4 ++-- .../subcommands/GroupSetInheritCommand.java | 4 ++-- .../subcommands/GroupSetPermissionCommand.java | 8 ++++---- .../subcommands/GroupShowTracksCommand.java | 4 ++-- .../GroupUnSetPermissionCommand.java | 6 +++--- .../subcommands/GroupUnsetInheritCommand.java | 4 ++-- .../luckperms/commands/misc/DebugCommand.java | 4 ++-- .../luckperms/commands/misc/InfoCommand.java | 4 ++-- .../luckperms/commands/misc/SyncCommand.java | 4 ++-- .../commands/track/CreateTrackCommand.java | 6 +++--- .../commands/track/DeleteTrackCommand.java | 6 +++--- .../commands/track/ListTracksCommand.java | 4 ++-- .../commands/track/TrackMainCommand.java | 10 +++++----- .../commands/track/TrackSubCommand.java | 2 +- .../track/subcommands/TrackAppendCommand.java | 4 ++-- .../track/subcommands/TrackClearCommand.java | 4 ++-- .../track/subcommands/TrackInfoCommand.java | 4 ++-- .../track/subcommands/TrackInsertCommand.java | 4 ++-- .../track/subcommands/TrackRemoveCommand.java | 4 ++-- .../commands/user/UserMainCommand.java | 16 ++++++++-------- .../commands/user/UserSubCommand.java | 2 +- .../user/subcommands/UserAddGroupCommand.java | 4 ++-- .../user/subcommands/UserClearCommand.java | 4 ++-- .../user/subcommands/UserDemoteCommand.java | 4 ++-- .../user/subcommands/UserGetUUIDCommand.java | 4 ++-- .../user/subcommands/UserHasPermCommand.java | 4 ++-- .../user/subcommands/UserInfoCommand.java | 6 +++--- .../subcommands/UserInheritsPermCommand.java | 4 ++-- .../user/subcommands/UserListNodesCommand.java | 4 ++-- .../user/subcommands/UserPromoteCommand.java | 4 ++-- .../subcommands/UserRemoveGroupCommand.java | 4 ++-- .../subcommands/UserSetPermissionCommand.java | 8 ++++---- .../UserSetPrimaryGroupCommand.java | 6 +++--- .../user/subcommands/UserShowPosCommand.java | 4 ++-- .../subcommands/UserShowTracksCommand.java | 5 +++-- .../UserUnSetPermissionCommand.java | 6 +++--- .../me/lucko/luckperms/constants/Message.java | 6 +++--- pom.xml | 2 +- 60 files changed, 146 insertions(+), 144 deletions(-) diff --git a/bukkit/pom.xml b/bukkit/pom.xml index 1260fb762..f69812c86 100644 --- a/bukkit/pom.xml +++ b/bukkit/pom.xml @@ -5,7 +5,7 @@ luckperms me.lucko - 1.0-SNAPSHOT + 1.1 4.0.0 diff --git a/bukkit/src/main/java/me/lucko/luckperms/CommandManagerBukkit.java b/bukkit/src/main/java/me/lucko/luckperms/CommandManagerBukkit.java index 5f9e2f98e..8beecf5e8 100644 --- a/bukkit/src/main/java/me/lucko/luckperms/CommandManagerBukkit.java +++ b/bukkit/src/main/java/me/lucko/luckperms/CommandManagerBukkit.java @@ -18,7 +18,7 @@ class CommandManagerBukkit extends CommandManager implements CommandExecutor, Ta @Override public boolean onCommand(CommandSender sender, Command command, String label, String[] args) { - return onCommand(makeSender(sender), Arrays.asList(args)); + return onCommand(makeSender(sender), label, Arrays.asList(args)); } diff --git a/bukkit/src/main/java/me/lucko/luckperms/LPBukkitPlugin.java b/bukkit/src/main/java/me/lucko/luckperms/LPBukkitPlugin.java index ad0740acd..a69064123 100644 --- a/bukkit/src/main/java/me/lucko/luckperms/LPBukkitPlugin.java +++ b/bukkit/src/main/java/me/lucko/luckperms/LPBukkitPlugin.java @@ -28,7 +28,7 @@ import java.util.stream.Collectors; @Getter public class LPBukkitPlugin extends JavaPlugin implements LuckPermsPlugin { - public static final String VERSION = "v1.0"; + public static final String VERSION = "v1.1"; private LPConfiguration configuration; private UserManager userManager; diff --git a/bukkit/src/main/resources/plugin.yml b/bukkit/src/main/resources/plugin.yml index 3258b2d5f..ccd2a0701 100644 --- a/bukkit/src/main/resources/plugin.yml +++ b/bukkit/src/main/resources/plugin.yml @@ -1,6 +1,6 @@ name: LuckPerms author: Luck -version: 1.0 +version: 1.1 main: me.lucko.luckperms.LPBukkitPlugin softdepend: [Vault] description: A permissions plugin diff --git a/bungee/pom.xml b/bungee/pom.xml index 2f596b54e..03e8e02ab 100644 --- a/bungee/pom.xml +++ b/bungee/pom.xml @@ -5,7 +5,7 @@ luckperms me.lucko - 1.0-SNAPSHOT + 1.1 4.0.0 diff --git a/bungee/src/main/java/me/lucko/luckperms/LPBungeePlugin.java b/bungee/src/main/java/me/lucko/luckperms/LPBungeePlugin.java index 1a0d496e2..2f8035dee 100644 --- a/bungee/src/main/java/me/lucko/luckperms/LPBungeePlugin.java +++ b/bungee/src/main/java/me/lucko/luckperms/LPBungeePlugin.java @@ -23,7 +23,7 @@ import java.util.stream.Collectors; @Getter public class LPBungeePlugin extends Plugin implements LuckPermsPlugin { - public static final String VERSION = "v1.0"; + public static final String VERSION = "v1.1"; private LPConfiguration configuration; private UserManager userManager; @@ -41,6 +41,9 @@ public class LPBungeePlugin extends Plugin implements LuckPermsPlugin { // register commands getProxy().getPluginManager().registerCommand(this, new MainCommand(new CommandManager(this))); + // disable the default Bungee /perms command so it gets handled by the Bukkit plugin + getProxy().getDisabledCommands().add("perms"); + final String storageMethod = configuration.getStorageMethod(); if (storageMethod.equalsIgnoreCase("mysql")) { diff --git a/bungee/src/main/java/me/lucko/luckperms/MainCommand.java b/bungee/src/main/java/me/lucko/luckperms/MainCommand.java index 5f0ef15c0..fae809bf9 100644 --- a/bungee/src/main/java/me/lucko/luckperms/MainCommand.java +++ b/bungee/src/main/java/me/lucko/luckperms/MainCommand.java @@ -21,7 +21,7 @@ class MainCommand extends Command implements TabExecutor { @Override public void execute(CommandSender sender, String[] args) { - manager.onCommand(makeSender(sender), Arrays.asList(args)); + manager.onCommand(makeSender(sender), "bperms", Arrays.asList(args)); } @Override diff --git a/bungee/src/main/resources/plugin.yml b/bungee/src/main/resources/plugin.yml index 9215088ea..27b742034 100644 --- a/bungee/src/main/resources/plugin.yml +++ b/bungee/src/main/resources/plugin.yml @@ -1,3 +1,5 @@ name: LuckPerms +author: Luck +version: 1.1 main: me.lucko.luckperms.LPBungeePlugin -author: Luck \ No newline at end of file +description: A permissions plugin \ No newline at end of file diff --git a/common/pom.xml b/common/pom.xml index 9a00fc81e..6393b7709 100644 --- a/common/pom.xml +++ b/common/pom.xml @@ -5,7 +5,7 @@ luckperms me.lucko - 1.0-SNAPSHOT + 1.1 4.0.0 diff --git a/common/src/main/java/me/lucko/luckperms/commands/CommandManager.java b/common/src/main/java/me/lucko/luckperms/commands/CommandManager.java index 50b954474..ff9de86d0 100644 --- a/common/src/main/java/me/lucko/luckperms/commands/CommandManager.java +++ b/common/src/main/java/me/lucko/luckperms/commands/CommandManager.java @@ -91,36 +91,36 @@ public class CommandManager { * @param args the arguments provided * @return if the command was successful (hint: it always is :> ) */ - public boolean onCommand(Sender sender, List args) { + public boolean onCommand(Sender sender, String label, List args) { if (args.size() == 0) { - sendCommandUsage(sender); + sendCommandUsage(sender, label); return true; } Optional o = mainCommands.stream().filter(m -> m.getName().equalsIgnoreCase(args.get(0))).limit(1).findAny(); if (!o.isPresent()) { - sendCommandUsage(sender); + sendCommandUsage(sender, label); return true; } final MainCommand main = o.get(); if (!main.canUse(sender)) { - sendCommandUsage(sender); + sendCommandUsage(sender, label); return true; } if (main.getRequiredArgsLength() == 0) { - main.execute(plugin, sender, null); + main.execute(plugin, sender, null, label); return true; } if (args.size() == 1) { - main.sendUsage(sender); + main.sendUsage(sender, label); return true; } - main.execute(plugin, sender, new ArrayList<>(args.subList(1, args.size()))); + main.execute(plugin, sender, new ArrayList<>(args.subList(1, args.size())), label); return true; } @@ -155,11 +155,11 @@ public class CommandManager { mainCommands.add(command); } - private void sendCommandUsage(Sender sender) { + private void sendCommandUsage(Sender sender, String label) { Message.INFO_BRIEF.send(sender, plugin.getVersion()); mainCommands.stream() .filter(c -> c.canUse(sender)) - .forEach(c -> Util.sendPluginMessage(sender, "&e-> &d" + c.getUsage())); + .forEach(c -> Util.sendPluginMessage(sender, "&e-> &d" + String.format(c.getUsage(), label))); } } 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 e520f586b..37c422d8b 100644 --- a/common/src/main/java/me/lucko/luckperms/commands/MainCommand.java +++ b/common/src/main/java/me/lucko/luckperms/commands/MainCommand.java @@ -18,13 +18,13 @@ public abstract class MainCommand { private final String usage; private final int requiredArgsLength; - protected abstract void execute(LuckPermsPlugin plugin, Sender sender, List args); + protected abstract void execute(LuckPermsPlugin plugin, Sender sender, List args, String label); protected abstract List onTabComplete(Sender sender, List args, LuckPermsPlugin plugin); public abstract List getSubCommands(); - protected void sendUsage(Sender sender) { + protected void sendUsage(Sender sender, String label) { if (getSubCommands().isEmpty()) { - Util.sendPluginMessage(sender, "&e-> &d" + getUsage()); + Util.sendPluginMessage(sender, "&e-> &d" + String.format(getUsage(), label)); return; } @@ -33,7 +33,7 @@ public abstract class MainCommand { Util.sendPluginMessage(sender, "&e" + getName() + " Sub Commands:"); for (SubCommand s : subs) { - s.sendUsage(sender); + s.sendUsage(sender, label); } } else { 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 2fc9c2509..9e2d87ed5 100644 --- a/common/src/main/java/me/lucko/luckperms/commands/SubCommand.java +++ b/common/src/main/java/me/lucko/luckperms/commands/SubCommand.java @@ -51,8 +51,8 @@ public abstract class SubCommand { return permission.isAuthorized(sender); } - public void sendUsage(Sender sender) { - Util.sendPluginMessage(sender, "&e-> &d" + getUsage()); + public void sendUsage(Sender sender, String label) { + Util.sendPluginMessage(sender, "&e-> &d" + String.format(getUsage(), label)); } public List onTabComplete(Sender sender, List args, LuckPermsPlugin plugin) { diff --git a/common/src/main/java/me/lucko/luckperms/commands/Util.java b/common/src/main/java/me/lucko/luckperms/commands/Util.java index 2f3e07afb..6bf97b684 100644 --- a/common/src/main/java/me/lucko/luckperms/commands/Util.java +++ b/common/src/main/java/me/lucko/luckperms/commands/Util.java @@ -32,10 +32,6 @@ public class Util { return new String(b); } - public static boolean startsWithIgnoreCase(String s, String startsWith) { - return s.toLowerCase().startsWith(startsWith); - } - public static void sendBoolean(Sender sender, String node, boolean b) { if (b) { sender.sendMessage(Util.color("&b" + node + ": &atrue")); diff --git a/common/src/main/java/me/lucko/luckperms/commands/group/CreateGroupCommand.java b/common/src/main/java/me/lucko/luckperms/commands/group/CreateGroupCommand.java index ffa6fe7ba..a7ef54d50 100644 --- a/common/src/main/java/me/lucko/luckperms/commands/group/CreateGroupCommand.java +++ b/common/src/main/java/me/lucko/luckperms/commands/group/CreateGroupCommand.java @@ -13,13 +13,13 @@ import java.util.List; public class CreateGroupCommand extends MainCommand { public CreateGroupCommand() { - super("CreateGroup", "/perms creategroup ", 1); + super("CreateGroup", "/%s creategroup ", 1); } @Override - protected void execute(LuckPermsPlugin plugin, Sender sender, List args) { + protected void execute(LuckPermsPlugin plugin, Sender sender, List args, String label) { if (args.size() == 0) { - sendUsage(sender); + sendUsage(sender, label); return; } diff --git a/common/src/main/java/me/lucko/luckperms/commands/group/DeleteGroupCommand.java b/common/src/main/java/me/lucko/luckperms/commands/group/DeleteGroupCommand.java index 38e2ab7e4..583ac0951 100644 --- a/common/src/main/java/me/lucko/luckperms/commands/group/DeleteGroupCommand.java +++ b/common/src/main/java/me/lucko/luckperms/commands/group/DeleteGroupCommand.java @@ -15,13 +15,13 @@ import java.util.stream.Collectors; public class DeleteGroupCommand extends MainCommand { public DeleteGroupCommand() { - super("DeleteGroup", "/perms deletegroup ", 1); + super("DeleteGroup", "/%s deletegroup ", 1); } @Override - protected void execute(LuckPermsPlugin plugin, Sender sender, List args) { + protected void execute(LuckPermsPlugin plugin, Sender sender, List args, String label) { if (args.size() == 0) { - sendUsage(sender); + sendUsage(sender, label); return; } diff --git a/common/src/main/java/me/lucko/luckperms/commands/group/GroupMainCommand.java b/common/src/main/java/me/lucko/luckperms/commands/group/GroupMainCommand.java index 83cf2ad24..d2a82b89c 100644 --- a/common/src/main/java/me/lucko/luckperms/commands/group/GroupMainCommand.java +++ b/common/src/main/java/me/lucko/luckperms/commands/group/GroupMainCommand.java @@ -17,13 +17,13 @@ public class GroupMainCommand extends MainCommand { private final List subCommands = new ArrayList<>(); public GroupMainCommand() { - super("Group", "/perms group ", 2); + super("Group", "/%s group ", 2); } @Override - protected void execute(LuckPermsPlugin plugin, Sender sender, List args) { + protected void execute(LuckPermsPlugin plugin, Sender sender, List args, String label) { if (args.size() < 2) { - sendUsage(sender); + sendUsage(sender, label); return; } @@ -46,7 +46,7 @@ public class GroupMainCommand extends MainCommand { } if (sub.isArgLengthInvalid(strippedArgs.size())) { - sub.sendUsage(sender); + sub.sendUsage(sender, label); return; } @@ -63,7 +63,7 @@ public class GroupMainCommand extends MainCommand { return; } - sub.execute(plugin, sender, group, strippedArgs); + sub.execute(plugin, sender, group, strippedArgs, label); }); } diff --git a/common/src/main/java/me/lucko/luckperms/commands/group/GroupSubCommand.java b/common/src/main/java/me/lucko/luckperms/commands/group/GroupSubCommand.java index d2a765ae1..03988fed4 100644 --- a/common/src/main/java/me/lucko/luckperms/commands/group/GroupSubCommand.java +++ b/common/src/main/java/me/lucko/luckperms/commands/group/GroupSubCommand.java @@ -14,7 +14,7 @@ public abstract class GroupSubCommand extends SubCommand { super(name, description, usage, permission); } - protected abstract void execute(LuckPermsPlugin plugin, Sender sender, Group group, List args); + protected abstract void execute(LuckPermsPlugin plugin, Sender sender, Group group, List args, String label); protected void saveGroup(Group group, Sender sender, LuckPermsPlugin plugin) { plugin.getDatastore().saveGroup(group, success -> { diff --git a/common/src/main/java/me/lucko/luckperms/commands/group/ListGroupsCommand.java b/common/src/main/java/me/lucko/luckperms/commands/group/ListGroupsCommand.java index 3421a47bb..0a0dcc415 100644 --- a/common/src/main/java/me/lucko/luckperms/commands/group/ListGroupsCommand.java +++ b/common/src/main/java/me/lucko/luckperms/commands/group/ListGroupsCommand.java @@ -14,11 +14,11 @@ import java.util.List; public class ListGroupsCommand extends MainCommand { public ListGroupsCommand() { - super("ListGroups", "/perms listgroups", 0); + super("ListGroups", "/%s listgroups", 0); } @Override - protected void execute(LuckPermsPlugin plugin, Sender sender, List args) { + protected void execute(LuckPermsPlugin plugin, Sender sender, List args, String label) { plugin.getDatastore().loadAllGroups(success -> { if (!success) { Message.GROUPS_LOAD_ERROR.send(sender); diff --git a/common/src/main/java/me/lucko/luckperms/commands/group/subcommands/GroupClearCommand.java b/common/src/main/java/me/lucko/luckperms/commands/group/subcommands/GroupClearCommand.java index d6d53e5d1..27d60a0b1 100644 --- a/common/src/main/java/me/lucko/luckperms/commands/group/subcommands/GroupClearCommand.java +++ b/common/src/main/java/me/lucko/luckperms/commands/group/subcommands/GroupClearCommand.java @@ -11,11 +11,11 @@ import java.util.List; public class GroupClearCommand extends GroupSubCommand { public GroupClearCommand() { - super("clear", "Clears a groups permissions", "/perms group clear", Permission.GROUP_CLEAR); + super("clear", "Clears a groups permissions", "/%s group clear", Permission.GROUP_CLEAR); } @Override - protected void execute(LuckPermsPlugin plugin, Sender sender, Group group, List args) { + protected void execute(LuckPermsPlugin plugin, Sender sender, Group group, List args, String label) { group.clearNodes(); Message.CLEAR_SUCCESS.send(sender, group.getName()); diff --git a/common/src/main/java/me/lucko/luckperms/commands/group/subcommands/GroupHasPermCommand.java b/common/src/main/java/me/lucko/luckperms/commands/group/subcommands/GroupHasPermCommand.java index 7eb1181f8..6b1b032fc 100644 --- a/common/src/main/java/me/lucko/luckperms/commands/group/subcommands/GroupHasPermCommand.java +++ b/common/src/main/java/me/lucko/luckperms/commands/group/subcommands/GroupHasPermCommand.java @@ -12,11 +12,11 @@ import java.util.List; public class GroupHasPermCommand extends GroupSubCommand { public GroupHasPermCommand() { super("haspermission", "Checks to see if a group has a certain permission node", - "/perms group haspermission [server]", Permission.GROUP_HASPERMISSION); + "/%s group haspermission [server]", Permission.GROUP_HASPERMISSION); } @Override - protected void execute(LuckPermsPlugin plugin, Sender sender, Group group, List args) { + protected void execute(LuckPermsPlugin plugin, Sender sender, Group group, List args, String label) { if (args.size() == 2) { Util.sendBoolean(sender, args.get(0), group.hasPermission(args.get(0), true, args.get(1).toLowerCase())); } else { diff --git a/common/src/main/java/me/lucko/luckperms/commands/group/subcommands/GroupInfoCommand.java b/common/src/main/java/me/lucko/luckperms/commands/group/subcommands/GroupInfoCommand.java index 4fb3f2989..87feb0155 100644 --- a/common/src/main/java/me/lucko/luckperms/commands/group/subcommands/GroupInfoCommand.java +++ b/common/src/main/java/me/lucko/luckperms/commands/group/subcommands/GroupInfoCommand.java @@ -11,12 +11,12 @@ import java.util.List; public class GroupInfoCommand extends GroupSubCommand { public GroupInfoCommand() { - super("info", "Gives info about the group", "/perms group info", Permission.GROUP_INFO); + super("info", "Gives info about the group", "/%s group info", Permission.GROUP_INFO); } @Override - protected void execute(LuckPermsPlugin plugin, Sender sender, Group group, List args) { - Message.GROUP_INFO.send(sender, group.getName(), group.getNodes().keySet().size(), group.getName()); + protected void execute(LuckPermsPlugin plugin, Sender sender, Group group, List args, String label) { + Message.GROUP_INFO.send(sender, group.getName(), group.getNodes().keySet().size(), label, group.getName()); } @Override diff --git a/common/src/main/java/me/lucko/luckperms/commands/group/subcommands/GroupInheritsPermCommand.java b/common/src/main/java/me/lucko/luckperms/commands/group/subcommands/GroupInheritsPermCommand.java index 67c9f04d3..05f6bc50e 100644 --- a/common/src/main/java/me/lucko/luckperms/commands/group/subcommands/GroupInheritsPermCommand.java +++ b/common/src/main/java/me/lucko/luckperms/commands/group/subcommands/GroupInheritsPermCommand.java @@ -12,11 +12,11 @@ import java.util.List; public class GroupInheritsPermCommand extends GroupSubCommand { public GroupInheritsPermCommand() { super("inheritspermission", "Checks to see if a group inherits a certain permission node", - "/perms group inheritspermission [server]", Permission.GROUP_INHERITSPERMISSION); + "/%s group inheritspermission [server]", Permission.GROUP_INHERITSPERMISSION); } @Override - protected void execute(LuckPermsPlugin plugin, Sender sender, Group group, List args) { + protected void execute(LuckPermsPlugin plugin, Sender sender, Group group, List args, String label) { if (args.size() == 2) { Util.sendBoolean(sender, args.get(0), group.inheritsPermission(args.get(0), true, args.get(1).toLowerCase())); } else { diff --git a/common/src/main/java/me/lucko/luckperms/commands/group/subcommands/GroupListNodesCommand.java b/common/src/main/java/me/lucko/luckperms/commands/group/subcommands/GroupListNodesCommand.java index 82177ef61..0023c4fb6 100644 --- a/common/src/main/java/me/lucko/luckperms/commands/group/subcommands/GroupListNodesCommand.java +++ b/common/src/main/java/me/lucko/luckperms/commands/group/subcommands/GroupListNodesCommand.java @@ -12,12 +12,12 @@ import java.util.List; public class GroupListNodesCommand extends GroupSubCommand { public GroupListNodesCommand() { - super("listnodes", "Lists the permission nodes the group has", "/perms group listnodes", + super("listnodes", "Lists the permission nodes the group has", "/%s group listnodes", Permission.GROUP_LISTNODES); } @Override - protected void execute(LuckPermsPlugin plugin, Sender sender, Group group, List args) { + protected void execute(LuckPermsPlugin plugin, Sender sender, Group group, List args, String label) { Message.LISTNODES.send(sender, group.getName(), Util.nodesToString(group.getNodes())); } diff --git a/common/src/main/java/me/lucko/luckperms/commands/group/subcommands/GroupSetInheritCommand.java b/common/src/main/java/me/lucko/luckperms/commands/group/subcommands/GroupSetInheritCommand.java index 326749733..355ea9270 100644 --- a/common/src/main/java/me/lucko/luckperms/commands/group/subcommands/GroupSetInheritCommand.java +++ b/common/src/main/java/me/lucko/luckperms/commands/group/subcommands/GroupSetInheritCommand.java @@ -13,11 +13,11 @@ import java.util.List; public class GroupSetInheritCommand extends GroupSubCommand { public GroupSetInheritCommand() { super("setinherit", "Sets another group for this group to inherit permissions from", - "/perms group setinherit [server]", Permission.GROUP_SETINHERIT); + "/%s group setinherit [server]", Permission.GROUP_SETINHERIT); } @Override - protected void execute(LuckPermsPlugin plugin, Sender sender, Group group, List args) { + protected void execute(LuckPermsPlugin plugin, Sender sender, Group group, List args, String label) { String groupName = args.get(0).toLowerCase(); plugin.getDatastore().loadGroup(groupName, success -> { diff --git a/common/src/main/java/me/lucko/luckperms/commands/group/subcommands/GroupSetPermissionCommand.java b/common/src/main/java/me/lucko/luckperms/commands/group/subcommands/GroupSetPermissionCommand.java index fec369ade..b7731f8a0 100644 --- a/common/src/main/java/me/lucko/luckperms/commands/group/subcommands/GroupSetPermissionCommand.java +++ b/common/src/main/java/me/lucko/luckperms/commands/group/subcommands/GroupSetPermissionCommand.java @@ -13,17 +13,17 @@ import java.util.List; public class GroupSetPermissionCommand extends GroupSubCommand { public GroupSetPermissionCommand() { - super("set", "Sets a permission for a group", "/perms group set [server]", + super("set", "Sets a permission for a group", "/%s group set [server]", Permission.GROUP_SETPERMISSION); } @Override - protected void execute(LuckPermsPlugin plugin, Sender sender, Group group, List args) { + protected void execute(LuckPermsPlugin plugin, Sender sender, Group group, List args, String label) { String node = args.get(0); String bool = args.get(1).toLowerCase(); if (node.contains("/")) { - sendUsage(sender); + sendUsage(sender, label); return; } @@ -33,7 +33,7 @@ public class GroupSetPermissionCommand extends GroupSubCommand { } if (!bool.equalsIgnoreCase("true") && !bool.equalsIgnoreCase("false")) { - sendUsage(sender); + sendUsage(sender, label); return; } diff --git a/common/src/main/java/me/lucko/luckperms/commands/group/subcommands/GroupShowTracksCommand.java b/common/src/main/java/me/lucko/luckperms/commands/group/subcommands/GroupShowTracksCommand.java index 885a1c273..3454ac7ed 100644 --- a/common/src/main/java/me/lucko/luckperms/commands/group/subcommands/GroupShowTracksCommand.java +++ b/common/src/main/java/me/lucko/luckperms/commands/group/subcommands/GroupShowTracksCommand.java @@ -14,11 +14,11 @@ import java.util.stream.Collectors; public class GroupShowTracksCommand extends GroupSubCommand { public GroupShowTracksCommand() { - super("showtracks", "Lists the tracks that this group features on", "/perms group showtracks", Permission.GROUP_SHOWTRACKS); + super("showtracks", "Lists the tracks that this group features on", "/%s group showtracks", Permission.GROUP_SHOWTRACKS); } @Override - protected void execute(LuckPermsPlugin plugin, Sender sender, Group group, List args) { + protected void execute(LuckPermsPlugin plugin, Sender sender, Group group, List args, String label) { plugin.getDatastore().loadAllTracks(success -> { if (!success) { Message.TRACKS_LOAD_ERROR.send(sender); diff --git a/common/src/main/java/me/lucko/luckperms/commands/group/subcommands/GroupUnSetPermissionCommand.java b/common/src/main/java/me/lucko/luckperms/commands/group/subcommands/GroupUnSetPermissionCommand.java index 7b3294fda..7a674874e 100644 --- a/common/src/main/java/me/lucko/luckperms/commands/group/subcommands/GroupUnSetPermissionCommand.java +++ b/common/src/main/java/me/lucko/luckperms/commands/group/subcommands/GroupUnSetPermissionCommand.java @@ -14,15 +14,15 @@ import java.util.List; public class GroupUnSetPermissionCommand extends GroupSubCommand { public GroupUnSetPermissionCommand() { super("unset", "Unsets a permission for a group", - "/perms group unset [server]", Permission.GROUP_UNSETPERMISSION); + "/%s group unset [server]", Permission.GROUP_UNSETPERMISSION); } @Override - protected void execute(LuckPermsPlugin plugin, Sender sender, Group group, List args) { + protected void execute(LuckPermsPlugin plugin, Sender sender, Group group, List args, String label) { String node = args.get(0); if (node.contains("/")) { - sendUsage(sender); + sendUsage(sender, label); return; } diff --git a/common/src/main/java/me/lucko/luckperms/commands/group/subcommands/GroupUnsetInheritCommand.java b/common/src/main/java/me/lucko/luckperms/commands/group/subcommands/GroupUnsetInheritCommand.java index dc6845b9b..2160ed57f 100644 --- a/common/src/main/java/me/lucko/luckperms/commands/group/subcommands/GroupUnsetInheritCommand.java +++ b/common/src/main/java/me/lucko/luckperms/commands/group/subcommands/GroupUnsetInheritCommand.java @@ -13,11 +13,11 @@ import java.util.List; public class GroupUnsetInheritCommand extends GroupSubCommand { public GroupUnsetInheritCommand() { super("unsetinherit", "Unsets another group for this group to inherit permissions from", - "/perms group unsetinherit [server]", Permission.GROUP_UNSETINHERIT); + "/%s group unsetinherit [server]", Permission.GROUP_UNSETINHERIT); } @Override - protected void execute(LuckPermsPlugin plugin, Sender sender, Group group, List args) { + protected void execute(LuckPermsPlugin plugin, Sender sender, Group group, List args, String label) { String groupName = args.get(0).toLowerCase(); try { diff --git a/common/src/main/java/me/lucko/luckperms/commands/misc/DebugCommand.java b/common/src/main/java/me/lucko/luckperms/commands/misc/DebugCommand.java index 8ff344bd5..64f3452bc 100644 --- a/common/src/main/java/me/lucko/luckperms/commands/misc/DebugCommand.java +++ b/common/src/main/java/me/lucko/luckperms/commands/misc/DebugCommand.java @@ -12,11 +12,11 @@ import java.util.List; public class DebugCommand extends MainCommand { public DebugCommand() { - super("Debug", "/perms debug", 0); + super("Debug", "/%s debug", 0); } @Override - protected void execute(LuckPermsPlugin plugin, Sender sender, List args) { + protected void execute(LuckPermsPlugin plugin, Sender sender, List args, String label) { Message.DEBUG.send(sender, plugin.getPlayerCount(), plugin.getUserManager().getUsers().size(), plugin.getGroupManager().getGroups().size(), plugin.getTrackManager().getTracks().size() ); diff --git a/common/src/main/java/me/lucko/luckperms/commands/misc/InfoCommand.java b/common/src/main/java/me/lucko/luckperms/commands/misc/InfoCommand.java index 7f5ce063b..2f56886b9 100644 --- a/common/src/main/java/me/lucko/luckperms/commands/misc/InfoCommand.java +++ b/common/src/main/java/me/lucko/luckperms/commands/misc/InfoCommand.java @@ -12,11 +12,11 @@ import java.util.List; public class InfoCommand extends MainCommand { public InfoCommand() { - super("Info", "/perms info", 0); + super("Info", "/%s info", 0); } @Override - protected void execute(LuckPermsPlugin plugin, Sender sender, List args) { + protected void execute(LuckPermsPlugin plugin, Sender sender, List args, String label) { Message.INFO.send(sender, plugin.getVersion(), plugin.getDatastore().getName()); } diff --git a/common/src/main/java/me/lucko/luckperms/commands/misc/SyncCommand.java b/common/src/main/java/me/lucko/luckperms/commands/misc/SyncCommand.java index 27d921cd8..180bf1470 100644 --- a/common/src/main/java/me/lucko/luckperms/commands/misc/SyncCommand.java +++ b/common/src/main/java/me/lucko/luckperms/commands/misc/SyncCommand.java @@ -12,11 +12,11 @@ import java.util.List; public class SyncCommand extends MainCommand { public SyncCommand() { - super("Sync", "/perms sync", 0); + super("Sync", "/%s sync", 0); } @Override - protected void execute(LuckPermsPlugin plugin, Sender sender, List args) { + protected void execute(LuckPermsPlugin plugin, Sender sender, List args, String label) { Message.UPDATE_TASK_RUN.send(sender); plugin.runUpdateTask(); } diff --git a/common/src/main/java/me/lucko/luckperms/commands/track/CreateTrackCommand.java b/common/src/main/java/me/lucko/luckperms/commands/track/CreateTrackCommand.java index 82f6e25e6..071d24c4b 100644 --- a/common/src/main/java/me/lucko/luckperms/commands/track/CreateTrackCommand.java +++ b/common/src/main/java/me/lucko/luckperms/commands/track/CreateTrackCommand.java @@ -13,13 +13,13 @@ import java.util.List; public class CreateTrackCommand extends MainCommand { public CreateTrackCommand() { - super("CreateTrack", "/perms createtrack ", 1); + super("CreateTrack", "/%s createtrack ", 1); } @Override - protected void execute(LuckPermsPlugin plugin, Sender sender, List args) { + protected void execute(LuckPermsPlugin plugin, Sender sender, List args, String label) { if (args.size() == 0) { - sendUsage(sender); + sendUsage(sender, label); return; } diff --git a/common/src/main/java/me/lucko/luckperms/commands/track/DeleteTrackCommand.java b/common/src/main/java/me/lucko/luckperms/commands/track/DeleteTrackCommand.java index a4b3a9ec7..3b9242220 100644 --- a/common/src/main/java/me/lucko/luckperms/commands/track/DeleteTrackCommand.java +++ b/common/src/main/java/me/lucko/luckperms/commands/track/DeleteTrackCommand.java @@ -15,13 +15,13 @@ import java.util.stream.Collectors; public class DeleteTrackCommand extends MainCommand { public DeleteTrackCommand() { - super("DeleteTrack", "/perms deletetrack ", 1); + super("DeleteTrack", "/%s deletetrack ", 1); } @Override - protected void execute(LuckPermsPlugin plugin, Sender sender, List args) { + protected void execute(LuckPermsPlugin plugin, Sender sender, List args, String label) { if (args.size() == 0) { - sendUsage(sender); + sendUsage(sender, label); return; } diff --git a/common/src/main/java/me/lucko/luckperms/commands/track/ListTracksCommand.java b/common/src/main/java/me/lucko/luckperms/commands/track/ListTracksCommand.java index 54d1514f8..99d390fc2 100644 --- a/common/src/main/java/me/lucko/luckperms/commands/track/ListTracksCommand.java +++ b/common/src/main/java/me/lucko/luckperms/commands/track/ListTracksCommand.java @@ -14,11 +14,11 @@ import java.util.List; public class ListTracksCommand extends MainCommand { public ListTracksCommand() { - super("ListTracks", "/perms listtracks", 0); + super("ListTracks", "/%s listtracks", 0); } @Override - protected void execute(LuckPermsPlugin plugin, Sender sender, List args) { + protected void execute(LuckPermsPlugin plugin, Sender sender, List args, String label) { plugin.getDatastore().loadAllTracks(success -> { if (!success) { Message.TRACKS_LOAD_ERROR.send(sender); diff --git a/common/src/main/java/me/lucko/luckperms/commands/track/TrackMainCommand.java b/common/src/main/java/me/lucko/luckperms/commands/track/TrackMainCommand.java index caf548c4a..70052d3aa 100644 --- a/common/src/main/java/me/lucko/luckperms/commands/track/TrackMainCommand.java +++ b/common/src/main/java/me/lucko/luckperms/commands/track/TrackMainCommand.java @@ -17,13 +17,13 @@ public class TrackMainCommand extends MainCommand { private final List subCommands = new ArrayList<>(); public TrackMainCommand() { - super("Track", "/perms track ", 2); + super("Track", "/%s track ", 2); } @Override - protected void execute(LuckPermsPlugin plugin, Sender sender, List args) { + protected void execute(LuckPermsPlugin plugin, Sender sender, List args, String label) { if (args.size() < 2) { - sendUsage(sender); + sendUsage(sender, label); return; } @@ -46,7 +46,7 @@ public class TrackMainCommand extends MainCommand { } if (sub.isArgLengthInvalid(strippedArgs.size())) { - sub.sendUsage(sender); + sub.sendUsage(sender, label); return; } @@ -63,7 +63,7 @@ public class TrackMainCommand extends MainCommand { return; } - sub.execute(plugin, sender, track, strippedArgs); + sub.execute(plugin, sender, track, strippedArgs, label); }); } diff --git a/common/src/main/java/me/lucko/luckperms/commands/track/TrackSubCommand.java b/common/src/main/java/me/lucko/luckperms/commands/track/TrackSubCommand.java index 62929ec58..13752dbc1 100644 --- a/common/src/main/java/me/lucko/luckperms/commands/track/TrackSubCommand.java +++ b/common/src/main/java/me/lucko/luckperms/commands/track/TrackSubCommand.java @@ -14,7 +14,7 @@ public abstract class TrackSubCommand extends SubCommand { super(name, description, usage, permission); } - protected abstract void execute(LuckPermsPlugin plugin, Sender sender, Track track, List args); + protected abstract void execute(LuckPermsPlugin plugin, Sender sender, Track track, List args, String label); protected void saveTrack(Track track, Sender sender, LuckPermsPlugin plugin) { plugin.getDatastore().saveTrack(track, success -> { diff --git a/common/src/main/java/me/lucko/luckperms/commands/track/subcommands/TrackAppendCommand.java b/common/src/main/java/me/lucko/luckperms/commands/track/subcommands/TrackAppendCommand.java index 9a83c96ff..a119e6a1c 100644 --- a/common/src/main/java/me/lucko/luckperms/commands/track/subcommands/TrackAppendCommand.java +++ b/common/src/main/java/me/lucko/luckperms/commands/track/subcommands/TrackAppendCommand.java @@ -14,11 +14,11 @@ import java.util.List; public class TrackAppendCommand extends TrackSubCommand { public TrackAppendCommand() { - super("append", "Appends a group onto the end of the track", "/perms track append ", Permission.TRACK_APPEND); + super("append", "Appends a group onto the end of the track", "/%s track append ", Permission.TRACK_APPEND); } @Override - protected void execute(LuckPermsPlugin plugin, Sender sender, Track track, List args) { + protected void execute(LuckPermsPlugin plugin, Sender sender, Track track, List args, String label) { String groupName = args.get(0).toLowerCase(); plugin.getDatastore().loadGroup(groupName, success -> { diff --git a/common/src/main/java/me/lucko/luckperms/commands/track/subcommands/TrackClearCommand.java b/common/src/main/java/me/lucko/luckperms/commands/track/subcommands/TrackClearCommand.java index 4949d4bf6..a1c2afa62 100644 --- a/common/src/main/java/me/lucko/luckperms/commands/track/subcommands/TrackClearCommand.java +++ b/common/src/main/java/me/lucko/luckperms/commands/track/subcommands/TrackClearCommand.java @@ -11,11 +11,11 @@ import java.util.List; public class TrackClearCommand extends TrackSubCommand { public TrackClearCommand() { - super("clear", "Clears the groups on the track", "/perms track clear", Permission.TRACK_CLEAR); + super("clear", "Clears the groups on the track", "/%s track clear", Permission.TRACK_CLEAR); } @Override - protected void execute(LuckPermsPlugin plugin, Sender sender, Track track, List args) { + protected void execute(LuckPermsPlugin plugin, Sender sender, Track track, List args, String label) { track.clearGroups(); Message.TRACK_CLEAR.send(sender, track.getName()); saveTrack(track, sender, plugin); diff --git a/common/src/main/java/me/lucko/luckperms/commands/track/subcommands/TrackInfoCommand.java b/common/src/main/java/me/lucko/luckperms/commands/track/subcommands/TrackInfoCommand.java index e0c7cc107..13bd7f624 100644 --- a/common/src/main/java/me/lucko/luckperms/commands/track/subcommands/TrackInfoCommand.java +++ b/common/src/main/java/me/lucko/luckperms/commands/track/subcommands/TrackInfoCommand.java @@ -12,11 +12,11 @@ import java.util.List; public class TrackInfoCommand extends TrackSubCommand { public TrackInfoCommand() { - super("info", "Gives info about the track", "/perms track info", Permission.TRACK_INFO); + super("info", "Gives info about the track", "/%s track info", Permission.TRACK_INFO); } @Override - protected void execute(LuckPermsPlugin plugin, Sender sender, Track track, List args) { + protected void execute(LuckPermsPlugin plugin, Sender sender, Track track, List args, String label) { Message.TRACK_INFO.send(sender, track.getName(), Util.listToArrowSep(track.getGroups())); } diff --git a/common/src/main/java/me/lucko/luckperms/commands/track/subcommands/TrackInsertCommand.java b/common/src/main/java/me/lucko/luckperms/commands/track/subcommands/TrackInsertCommand.java index c95acd3c8..802709e12 100644 --- a/common/src/main/java/me/lucko/luckperms/commands/track/subcommands/TrackInsertCommand.java +++ b/common/src/main/java/me/lucko/luckperms/commands/track/subcommands/TrackInsertCommand.java @@ -15,11 +15,11 @@ import java.util.List; public class TrackInsertCommand extends TrackSubCommand { public TrackInsertCommand() { super("insert", "Inserts a group at a given position along the track", - "/perms track insert ", Permission.TRACK_INSERT); + "/%s track insert ", Permission.TRACK_INSERT); } @Override - protected void execute(LuckPermsPlugin plugin, Sender sender, Track track, List args) { + protected void execute(LuckPermsPlugin plugin, Sender sender, Track track, List args, String label) { String groupName = args.get(0).toLowerCase(); int pos; try { diff --git a/common/src/main/java/me/lucko/luckperms/commands/track/subcommands/TrackRemoveCommand.java b/common/src/main/java/me/lucko/luckperms/commands/track/subcommands/TrackRemoveCommand.java index 234c5554d..527e6cf3d 100644 --- a/common/src/main/java/me/lucko/luckperms/commands/track/subcommands/TrackRemoveCommand.java +++ b/common/src/main/java/me/lucko/luckperms/commands/track/subcommands/TrackRemoveCommand.java @@ -12,11 +12,11 @@ import java.util.List; public class TrackRemoveCommand extends TrackSubCommand { public TrackRemoveCommand() { - super("remove", "Removes a group from the track", "/perms track remove ", Permission.TRACK_REMOVE); + super("remove", "Removes a group from the track", "/%s track remove ", Permission.TRACK_REMOVE); } @Override - protected void execute(LuckPermsPlugin plugin, Sender sender, Track track, List args) { + protected void execute(LuckPermsPlugin plugin, Sender sender, Track track, List args, String label) { String groupName = args.get(0).toLowerCase(); try { track.removeGroup(groupName); diff --git a/common/src/main/java/me/lucko/luckperms/commands/user/UserMainCommand.java b/common/src/main/java/me/lucko/luckperms/commands/user/UserMainCommand.java index fc4e34f47..82f01d901 100644 --- a/common/src/main/java/me/lucko/luckperms/commands/user/UserMainCommand.java +++ b/common/src/main/java/me/lucko/luckperms/commands/user/UserMainCommand.java @@ -19,13 +19,13 @@ public class UserMainCommand extends MainCommand { private final List subCommands = new ArrayList<>(); public UserMainCommand() { - super("User", "/perms user ", 2); + super("User", "/%s user ", 2); } @Override - protected void execute(LuckPermsPlugin plugin, Sender sender, List args) { + protected void execute(LuckPermsPlugin plugin, Sender sender, List args, String label) { if (args.size() < 2) { - sendUsage(sender); + sendUsage(sender, label); return; } @@ -49,14 +49,14 @@ public class UserMainCommand extends MainCommand { } if (sub.isArgLengthInvalid(strippedArgs.size())) { - sub.sendUsage(sender); + sub.sendUsage(sender, label); return; } final String user = args.get(0); UUID u = Util.parseUuid(user); if (u != null) { - runSub(plugin, sender, u, sub, strippedArgs); + runSub(plugin, sender, u, sub, strippedArgs, label); return; } @@ -68,7 +68,7 @@ public class UserMainCommand extends MainCommand { Message.USER_NOT_FOUND.send(sender); return; } - runSub(plugin, sender, uuid, sub, strippedArgs); + runSub(plugin, sender, uuid, sub, strippedArgs, label); }); return; } @@ -91,7 +91,7 @@ public class UserMainCommand extends MainCommand { return onAbstractTabComplete(sender, args, plugin); } - private void runSub(LuckPermsPlugin plugin, Sender sender, UUID uuid, UserSubCommand command, List strippedArgs) { + private void runSub(LuckPermsPlugin plugin, Sender sender, UUID uuid, UserSubCommand command, List strippedArgs, String label) { plugin.getDatastore().loadUser(uuid, success -> { if (!success) { Message.USER_NOT_FOUND.send(sender); @@ -103,7 +103,7 @@ public class UserMainCommand extends MainCommand { Message.USER_NOT_FOUND.send(sender); } - command.execute(plugin, sender, user, strippedArgs); + command.execute(plugin, sender, user, strippedArgs, label); plugin.getUserManager().cleanupUser(user); }); } diff --git a/common/src/main/java/me/lucko/luckperms/commands/user/UserSubCommand.java b/common/src/main/java/me/lucko/luckperms/commands/user/UserSubCommand.java index 14a9835bf..8d9fca7e7 100644 --- a/common/src/main/java/me/lucko/luckperms/commands/user/UserSubCommand.java +++ b/common/src/main/java/me/lucko/luckperms/commands/user/UserSubCommand.java @@ -14,7 +14,7 @@ public abstract class UserSubCommand extends SubCommand { super(name, description, usage, permission); } - protected abstract void execute(LuckPermsPlugin plugin, Sender sender, User user, List args); + protected abstract void execute(LuckPermsPlugin plugin, Sender sender, User user, List args, String label); protected void saveUser(User user, Sender sender, LuckPermsPlugin plugin) { user.refreshPermissions(); diff --git a/common/src/main/java/me/lucko/luckperms/commands/user/subcommands/UserAddGroupCommand.java b/common/src/main/java/me/lucko/luckperms/commands/user/subcommands/UserAddGroupCommand.java index 096605a26..85c18677d 100644 --- a/common/src/main/java/me/lucko/luckperms/commands/user/subcommands/UserAddGroupCommand.java +++ b/common/src/main/java/me/lucko/luckperms/commands/user/subcommands/UserAddGroupCommand.java @@ -13,11 +13,11 @@ import java.util.List; public class UserAddGroupCommand extends UserSubCommand { public UserAddGroupCommand() { - super("addgroup", "Adds the user to a group", "/perms user addgroup [server]", Permission.USER_ADDGROUP); + super("addgroup", "Adds the user to a group", "/%s user addgroup [server]", Permission.USER_ADDGROUP); } @Override - protected void execute(LuckPermsPlugin plugin, Sender sender, User user, List args) { + protected void execute(LuckPermsPlugin plugin, Sender sender, User user, List args, String label) { String groupName = args.get(0).toLowerCase(); plugin.getDatastore().loadGroup(groupName, success -> { diff --git a/common/src/main/java/me/lucko/luckperms/commands/user/subcommands/UserClearCommand.java b/common/src/main/java/me/lucko/luckperms/commands/user/subcommands/UserClearCommand.java index 0f25f6df5..e08a43671 100644 --- a/common/src/main/java/me/lucko/luckperms/commands/user/subcommands/UserClearCommand.java +++ b/common/src/main/java/me/lucko/luckperms/commands/user/subcommands/UserClearCommand.java @@ -11,11 +11,11 @@ import java.util.List; public class UserClearCommand extends UserSubCommand { public UserClearCommand() { - super("clear", "Clears a users permissions and groups", "/perms user clear", Permission.USER_CLEAR); + super("clear", "Clears a users permissions and groups", "/%s user clear", Permission.USER_CLEAR); } @Override - protected void execute(LuckPermsPlugin plugin, Sender sender, User user, List args) { + protected void execute(LuckPermsPlugin plugin, Sender sender, User user, List args, String label) { user.clearNodes(); plugin.getUserManager().giveDefaults(user); Message.CLEAR_SUCCESS.send(sender, user.getName()); diff --git a/common/src/main/java/me/lucko/luckperms/commands/user/subcommands/UserDemoteCommand.java b/common/src/main/java/me/lucko/luckperms/commands/user/subcommands/UserDemoteCommand.java index b10280a18..fcb988b8b 100644 --- a/common/src/main/java/me/lucko/luckperms/commands/user/subcommands/UserDemoteCommand.java +++ b/common/src/main/java/me/lucko/luckperms/commands/user/subcommands/UserDemoteCommand.java @@ -16,11 +16,11 @@ import java.util.List; public class UserDemoteCommand extends UserSubCommand { public UserDemoteCommand() { - super("demote", "Demotes a user along a track", "/perms user demote ", Permission.USER_DEMOTE); + super("demote", "Demotes a user along a track", "/%s user demote ", Permission.USER_DEMOTE); } @Override - protected void execute(LuckPermsPlugin plugin, Sender sender, User user, List args) { + protected void execute(LuckPermsPlugin plugin, Sender sender, User user, List args, String label) { final String trackName = args.get(0).toLowerCase(); plugin.getDatastore().loadTrack(trackName, success -> { diff --git a/common/src/main/java/me/lucko/luckperms/commands/user/subcommands/UserGetUUIDCommand.java b/common/src/main/java/me/lucko/luckperms/commands/user/subcommands/UserGetUUIDCommand.java index 8b654fb3b..732ac2be6 100644 --- a/common/src/main/java/me/lucko/luckperms/commands/user/subcommands/UserGetUUIDCommand.java +++ b/common/src/main/java/me/lucko/luckperms/commands/user/subcommands/UserGetUUIDCommand.java @@ -11,11 +11,11 @@ import java.util.List; public class UserGetUUIDCommand extends UserSubCommand { public UserGetUUIDCommand() { - super("getuuid", "Get the UUID of a user", "/perms user getuuid", Permission.USER_GETUUID); + super("getuuid", "Get the UUID of a user", "/%s user getuuid", Permission.USER_GETUUID); } @Override - protected void execute(LuckPermsPlugin plugin, Sender sender, User user, List args) { + protected void execute(LuckPermsPlugin plugin, Sender sender, User user, List args, String label) { Message.USER_GETUUID.send(sender, user.getName(), user.getUuid().toString()); } diff --git a/common/src/main/java/me/lucko/luckperms/commands/user/subcommands/UserHasPermCommand.java b/common/src/main/java/me/lucko/luckperms/commands/user/subcommands/UserHasPermCommand.java index 567369d3a..f330c92d2 100644 --- a/common/src/main/java/me/lucko/luckperms/commands/user/subcommands/UserHasPermCommand.java +++ b/common/src/main/java/me/lucko/luckperms/commands/user/subcommands/UserHasPermCommand.java @@ -12,11 +12,11 @@ import java.util.List; public class UserHasPermCommand extends UserSubCommand { public UserHasPermCommand() { super("haspermission", "Checks to see if a user has a certain permission node", - "/perms user haspermission [server]", Permission.USER_HASPERMISSION); + "/%s user haspermission [server]", Permission.USER_HASPERMISSION); } @Override - protected void execute(LuckPermsPlugin plugin, Sender sender, User user, List args) { + protected void execute(LuckPermsPlugin plugin, Sender sender, User user, List args, String label) { if (args.size() >= 2) { Util.sendBoolean(sender, args.get(0), user.hasPermission(args.get(0), true, args.get(1))); } else { diff --git a/common/src/main/java/me/lucko/luckperms/commands/user/subcommands/UserInfoCommand.java b/common/src/main/java/me/lucko/luckperms/commands/user/subcommands/UserInfoCommand.java index dbbeb33e8..6c9daa99d 100644 --- a/common/src/main/java/me/lucko/luckperms/commands/user/subcommands/UserInfoCommand.java +++ b/common/src/main/java/me/lucko/luckperms/commands/user/subcommands/UserInfoCommand.java @@ -12,14 +12,14 @@ import java.util.List; public class UserInfoCommand extends UserSubCommand { public UserInfoCommand() { - super("info", "Gives info about the user", "/perms user info", Permission.USER_INFO); + super("info", "Gives info about the user", "/%s user info", Permission.USER_INFO); } @Override - protected void execute(LuckPermsPlugin plugin, Sender sender, User user, List args) { + protected void execute(LuckPermsPlugin plugin, Sender sender, User user, List args, String label) { Message.USER_INFO.send(sender, user.getName(), user.getUuid(), plugin.getPlayerStatus(user.getUuid()), Util.listToCommaSep(user.getGroupNames()), user.getPrimaryGroup(), - (user.getNodes().keySet().size() - user.getGroupNames().size()), user.getName() + (user.getNodes().keySet().size() - user.getGroupNames().size()), label, user.getName() ); } diff --git a/common/src/main/java/me/lucko/luckperms/commands/user/subcommands/UserInheritsPermCommand.java b/common/src/main/java/me/lucko/luckperms/commands/user/subcommands/UserInheritsPermCommand.java index 48c44886b..b41b3082f 100644 --- a/common/src/main/java/me/lucko/luckperms/commands/user/subcommands/UserInheritsPermCommand.java +++ b/common/src/main/java/me/lucko/luckperms/commands/user/subcommands/UserInheritsPermCommand.java @@ -12,11 +12,11 @@ import java.util.List; public class UserInheritsPermCommand extends UserSubCommand { public UserInheritsPermCommand() { super("inheritspermission", "Checks to see if a user inherits a certain permission node", - "/perms user inheritspermission [server]", Permission.USER_INHERITSPERMISSION); + "/%s user inheritspermission [server]", Permission.USER_INHERITSPERMISSION); } @Override - protected void execute(LuckPermsPlugin plugin, Sender sender, User user, List args) { + protected void execute(LuckPermsPlugin plugin, Sender sender, User user, List args, String label) { if (args.size() >= 2) { Util.sendBoolean(sender, args.get(0), user.inheritsPermission(args.get(0), true, args.get(1))); } else { diff --git a/common/src/main/java/me/lucko/luckperms/commands/user/subcommands/UserListNodesCommand.java b/common/src/main/java/me/lucko/luckperms/commands/user/subcommands/UserListNodesCommand.java index a6a661ed3..410b3a2f3 100644 --- a/common/src/main/java/me/lucko/luckperms/commands/user/subcommands/UserListNodesCommand.java +++ b/common/src/main/java/me/lucko/luckperms/commands/user/subcommands/UserListNodesCommand.java @@ -12,11 +12,11 @@ import java.util.List; public class UserListNodesCommand extends UserSubCommand { public UserListNodesCommand() { - super("listnodes", "Lists the permission nodes the user has", "/perms user listnodes", Permission.USER_LISTNODES); + super("listnodes", "Lists the permission nodes the user has", "/%s user listnodes", Permission.USER_LISTNODES); } @Override - protected void execute(LuckPermsPlugin plugin, Sender sender, User user, List args) { + protected void execute(LuckPermsPlugin plugin, Sender sender, User user, List args, String label) { Message.LISTNODES.send(sender, user.getName(), Util.nodesToString(user.getNodes())); } diff --git a/common/src/main/java/me/lucko/luckperms/commands/user/subcommands/UserPromoteCommand.java b/common/src/main/java/me/lucko/luckperms/commands/user/subcommands/UserPromoteCommand.java index e80a63456..1ad07c04e 100644 --- a/common/src/main/java/me/lucko/luckperms/commands/user/subcommands/UserPromoteCommand.java +++ b/common/src/main/java/me/lucko/luckperms/commands/user/subcommands/UserPromoteCommand.java @@ -16,11 +16,11 @@ import java.util.List; public class UserPromoteCommand extends UserSubCommand { public UserPromoteCommand() { - super("promote", "Promotes the user along a track", "/perms user promote ", Permission.USER_PROMOTE); + super("promote", "Promotes the user along a track", "/%s user promote ", Permission.USER_PROMOTE); } @Override - protected void execute(LuckPermsPlugin plugin, Sender sender, User user, List args) { + protected void execute(LuckPermsPlugin plugin, Sender sender, User user, List args, String label) { final String trackName = args.get(0).toLowerCase(); plugin.getDatastore().loadTrack(trackName, success -> { diff --git a/common/src/main/java/me/lucko/luckperms/commands/user/subcommands/UserRemoveGroupCommand.java b/common/src/main/java/me/lucko/luckperms/commands/user/subcommands/UserRemoveGroupCommand.java index 79c9938a5..c89345d97 100644 --- a/common/src/main/java/me/lucko/luckperms/commands/user/subcommands/UserRemoveGroupCommand.java +++ b/common/src/main/java/me/lucko/luckperms/commands/user/subcommands/UserRemoveGroupCommand.java @@ -12,11 +12,11 @@ import java.util.List; public class UserRemoveGroupCommand extends UserSubCommand { public UserRemoveGroupCommand() { - super("removegroup", "Removes a user from a group", "/perms user removegroup [server]", Permission.USER_REMOVEGROUP); + super("removegroup", "Removes a user from a group", "/%s user removegroup [server]", Permission.USER_REMOVEGROUP); } @Override - protected void execute(LuckPermsPlugin plugin, Sender sender, User user, List args) { + protected void execute(LuckPermsPlugin plugin, Sender sender, User user, List args, String label) { String groupName = args.get(0).toLowerCase(); if ((args.size() == 1 || (args.size() == 2 && args.get(1).equalsIgnoreCase("global"))) diff --git a/common/src/main/java/me/lucko/luckperms/commands/user/subcommands/UserSetPermissionCommand.java b/common/src/main/java/me/lucko/luckperms/commands/user/subcommands/UserSetPermissionCommand.java index b6a40e55e..7528ceff2 100644 --- a/common/src/main/java/me/lucko/luckperms/commands/user/subcommands/UserSetPermissionCommand.java +++ b/common/src/main/java/me/lucko/luckperms/commands/user/subcommands/UserSetPermissionCommand.java @@ -14,16 +14,16 @@ import java.util.List; public class UserSetPermissionCommand extends UserSubCommand { public UserSetPermissionCommand() { super("set", "Sets a permission for a user", - "/perms user set [server]", Permission.USER_SETPERMISSION); + "/%s user set [server]", Permission.USER_SETPERMISSION); } @Override - protected void execute(LuckPermsPlugin plugin, Sender sender, User user, List args) { + protected void execute(LuckPermsPlugin plugin, Sender sender, User user, List args, String label) { String node = args.get(0); String bool = args.get(1).toLowerCase(); if (node.contains("/")) { - sendUsage(sender); + sendUsage(sender, label); return; } @@ -33,7 +33,7 @@ public class UserSetPermissionCommand extends UserSubCommand { } if (!bool.equalsIgnoreCase("true") && !bool.equalsIgnoreCase("false")) { - sendUsage(sender); + sendUsage(sender, label); return; } diff --git a/common/src/main/java/me/lucko/luckperms/commands/user/subcommands/UserSetPrimaryGroupCommand.java b/common/src/main/java/me/lucko/luckperms/commands/user/subcommands/UserSetPrimaryGroupCommand.java index b60c5c967..1519ce12c 100644 --- a/common/src/main/java/me/lucko/luckperms/commands/user/subcommands/UserSetPrimaryGroupCommand.java +++ b/common/src/main/java/me/lucko/luckperms/commands/user/subcommands/UserSetPrimaryGroupCommand.java @@ -13,11 +13,11 @@ import java.util.List; public class UserSetPrimaryGroupCommand extends UserSubCommand { public UserSetPrimaryGroupCommand() { super("setprimarygroup", "Sets a users primary group", - "/perms user setprimarygroup ", Permission.USER_SETPRIMARYGROUP); + "/%s user setprimarygroup ", Permission.USER_SETPRIMARYGROUP); } @Override - protected void execute(LuckPermsPlugin plugin, Sender sender, User user, List args) { + protected void execute(LuckPermsPlugin plugin, Sender sender, User user, List args, String label) { Group group = plugin.getGroupManager().getGroup(args.get(0).toLowerCase()); if (group == null) { Message.GROUP_DOES_NOT_EXIST.send(sender); @@ -30,7 +30,7 @@ public class UserSetPrimaryGroupCommand extends UserSubCommand { } if (!user.isInGroup(group)) { - Message.USER_PRIMARYGROUP_ERROR_NOTMEMBER.send(sender); + Message.USER_PRIMARYGROUP_ERROR_NOTMEMBER.send(sender, label); return; } diff --git a/common/src/main/java/me/lucko/luckperms/commands/user/subcommands/UserShowPosCommand.java b/common/src/main/java/me/lucko/luckperms/commands/user/subcommands/UserShowPosCommand.java index 0cf88fa78..538d0696a 100644 --- a/common/src/main/java/me/lucko/luckperms/commands/user/subcommands/UserShowPosCommand.java +++ b/common/src/main/java/me/lucko/luckperms/commands/user/subcommands/UserShowPosCommand.java @@ -13,11 +13,11 @@ import java.util.List; public class UserShowPosCommand extends UserSubCommand { public UserShowPosCommand() { - super("showpos", "Shows a users position on a track", "/perms user showpos ", Permission.USER_SHOWPOS); + super("showpos", "Shows a users position on a track", "/%s user showpos ", Permission.USER_SHOWPOS); } @Override - protected void execute(LuckPermsPlugin plugin, Sender sender, User user, List args) { + protected void execute(LuckPermsPlugin plugin, Sender sender, User user, List args, String label) { final String trackName = args.get(0).toLowerCase(); plugin.getDatastore().loadTrack(trackName, success -> { diff --git a/common/src/main/java/me/lucko/luckperms/commands/user/subcommands/UserShowTracksCommand.java b/common/src/main/java/me/lucko/luckperms/commands/user/subcommands/UserShowTracksCommand.java index 8afbca3c2..26f888205 100644 --- a/common/src/main/java/me/lucko/luckperms/commands/user/subcommands/UserShowTracksCommand.java +++ b/common/src/main/java/me/lucko/luckperms/commands/user/subcommands/UserShowTracksCommand.java @@ -14,11 +14,12 @@ import java.util.stream.Collectors; public class UserShowTracksCommand extends UserSubCommand { public UserShowTracksCommand() { - super("showtracks", "Lists the tracks that this user's primary group features on", "/perms user showtracks", Permission.USER_SHOWTRACKS); + super("showtracks", "Lists the tracks that this user's primary group features on", "/%s user showtracks", + Permission.USER_SHOWTRACKS); } @Override - protected void execute(LuckPermsPlugin plugin, Sender sender, User user, List args) { + protected void execute(LuckPermsPlugin plugin, Sender sender, User user, List args, String label) { plugin.getDatastore().loadAllTracks(success -> { if (!success) { Message.TRACKS_LOAD_ERROR.send(sender); diff --git a/common/src/main/java/me/lucko/luckperms/commands/user/subcommands/UserUnSetPermissionCommand.java b/common/src/main/java/me/lucko/luckperms/commands/user/subcommands/UserUnSetPermissionCommand.java index ad286f7ef..097534d08 100644 --- a/common/src/main/java/me/lucko/luckperms/commands/user/subcommands/UserUnSetPermissionCommand.java +++ b/common/src/main/java/me/lucko/luckperms/commands/user/subcommands/UserUnSetPermissionCommand.java @@ -14,15 +14,15 @@ import java.util.List; public class UserUnSetPermissionCommand extends UserSubCommand { public UserUnSetPermissionCommand() { super("unset", "Unsets a permission for a user", - "/perms user unset [server]", Permission.USER_UNSETPERMISSION); + "/%s user unset [server]", Permission.USER_UNSETPERMISSION); } @Override - protected void execute(LuckPermsPlugin plugin, Sender sender, User user, List args) { + protected void execute(LuckPermsPlugin plugin, Sender sender, User user, List args, String label) { String node = args.get(0); if (node.contains("/")) { - sendUsage(sender); + sendUsage(sender, label); return; } diff --git a/common/src/main/java/me/lucko/luckperms/constants/Message.java b/common/src/main/java/me/lucko/luckperms/constants/Message.java index e0520f6e6..f7cea23aa 100644 --- a/common/src/main/java/me/lucko/luckperms/constants/Message.java +++ b/common/src/main/java/me/lucko/luckperms/constants/Message.java @@ -120,7 +120,7 @@ public enum Message { PREFIX + "&d-> &eGroups: &6%s" + "\n" + PREFIX + "&d-> &ePrimary Group: &6%s" + "\n" + PREFIX + "&d-> &ePermissions: &6%s" + "\n" + - PREFIX + "&d-> &bUse &a/perms user %s listnodes &bto see all permissions.", + PREFIX + "&d-> &bUse &a/%s user %s listnodes &bto see all permissions.", false ), USER_GETUUID("&bThe UUID of &e%s&b is &e%s&b.", true), @@ -131,7 +131,7 @@ public enum Message { USER_REMOVEGROUP_ERROR_PRIMARY("You cannot remove a user from their primary group.", true), USER_PRIMARYGROUP_SUCCESS("&b%s&a's primary group was set to &b%s&a.", true), USER_PRIMARYGROUP_ERROR_ALREADYHAS("The user already has this group set as their primary group.", true), - USER_PRIMARYGROUP_ERROR_NOTMEMBER("The user must be a member of the group first! Use &4/perms user addgroup ", true), + USER_PRIMARYGROUP_ERROR_NOTMEMBER("The user must be a member of the group first! Use &4/%s user addgroup ", true), USER_SHOWTRACKS_INFO("&aShowing tracks that contain the group '&b%s&a' (%s's primary group)", true), USER_PROMOTE_SUCCESS_PROMOTE("&aPromoting user along track &b%s&a from &b%s&a to &b%s&a.", true), USER_PROMOTE_SUCCESS_REMOVE("&b%s&a was removed from &b%s&a, added to &b%s&a, and their primary group was set to &b%s&a.", true), @@ -156,7 +156,7 @@ public enum Message { GROUP_INFO( PREFIX + "&d-> &eGroup: &6%s" + "\n" + PREFIX + "&d-> &ePermissions: &6%s" + "\n" + - PREFIX + "&d-> &bUse &a/perms group %s listnodes &bto see all permissions.", + PREFIX + "&d-> &bUse &a/%s group %s listnodes &bto see all permissions.", false ), GROUP_SETINHERIT_SUCCESS("&b%s&a now inherits permissions from &b%s&a.", true), diff --git a/pom.xml b/pom.xml index 58e7e5e37..56bbdec40 100644 --- a/pom.xml +++ b/pom.xml @@ -7,7 +7,7 @@ me.lucko luckperms - 1.0-SNAPSHOT + 1.1 bukkit common