Make command usage send with the correct label & bump version

This commit is contained in:
Luck 2016-07-17 14:44:52 +01:00
parent d33a3ffcea
commit 24ff465679
60 changed files with 146 additions and 144 deletions

View File

@ -5,7 +5,7 @@
<parent> <parent>
<artifactId>luckperms</artifactId> <artifactId>luckperms</artifactId>
<groupId>me.lucko</groupId> <groupId>me.lucko</groupId>
<version>1.0-SNAPSHOT</version> <version>1.1</version>
</parent> </parent>
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>

View File

@ -18,7 +18,7 @@ class CommandManagerBukkit extends CommandManager implements CommandExecutor, Ta
@Override @Override
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) { 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));
} }

View File

@ -28,7 +28,7 @@ import java.util.stream.Collectors;
@Getter @Getter
public class LPBukkitPlugin extends JavaPlugin implements LuckPermsPlugin { 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 LPConfiguration configuration;
private UserManager userManager; private UserManager userManager;

View File

@ -1,6 +1,6 @@
name: LuckPerms name: LuckPerms
author: Luck author: Luck
version: 1.0 version: 1.1
main: me.lucko.luckperms.LPBukkitPlugin main: me.lucko.luckperms.LPBukkitPlugin
softdepend: [Vault] softdepend: [Vault]
description: A permissions plugin description: A permissions plugin

View File

@ -5,7 +5,7 @@
<parent> <parent>
<artifactId>luckperms</artifactId> <artifactId>luckperms</artifactId>
<groupId>me.lucko</groupId> <groupId>me.lucko</groupId>
<version>1.0-SNAPSHOT</version> <version>1.1</version>
</parent> </parent>
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>

View File

@ -23,7 +23,7 @@ import java.util.stream.Collectors;
@Getter @Getter
public class LPBungeePlugin extends Plugin implements LuckPermsPlugin { 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 LPConfiguration configuration;
private UserManager userManager; private UserManager userManager;
@ -41,6 +41,9 @@ public class LPBungeePlugin extends Plugin implements LuckPermsPlugin {
// register commands // register commands
getProxy().getPluginManager().registerCommand(this, new MainCommand(new CommandManager(this))); 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(); final String storageMethod = configuration.getStorageMethod();
if (storageMethod.equalsIgnoreCase("mysql")) { if (storageMethod.equalsIgnoreCase("mysql")) {

View File

@ -21,7 +21,7 @@ class MainCommand extends Command implements TabExecutor {
@Override @Override
public void execute(CommandSender sender, String[] args) { public void execute(CommandSender sender, String[] args) {
manager.onCommand(makeSender(sender), Arrays.asList(args)); manager.onCommand(makeSender(sender), "bperms", Arrays.asList(args));
} }
@Override @Override

View File

@ -1,3 +1,5 @@
name: LuckPerms name: LuckPerms
main: me.lucko.luckperms.LPBungeePlugin
author: Luck author: Luck
version: 1.1
main: me.lucko.luckperms.LPBungeePlugin
description: A permissions plugin

View File

@ -5,7 +5,7 @@
<parent> <parent>
<artifactId>luckperms</artifactId> <artifactId>luckperms</artifactId>
<groupId>me.lucko</groupId> <groupId>me.lucko</groupId>
<version>1.0-SNAPSHOT</version> <version>1.1</version>
</parent> </parent>
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>

View File

@ -91,36 +91,36 @@ public class CommandManager {
* @param args the arguments provided * @param args the arguments provided
* @return if the command was successful (hint: it always is :> ) * @return if the command was successful (hint: it always is :> )
*/ */
public boolean onCommand(Sender sender, List<String> args) { public boolean onCommand(Sender sender, String label, List<String> args) {
if (args.size() == 0) { if (args.size() == 0) {
sendCommandUsage(sender); sendCommandUsage(sender, label);
return true; return true;
} }
Optional<MainCommand> o = mainCommands.stream().filter(m -> m.getName().equalsIgnoreCase(args.get(0))).limit(1).findAny(); Optional<MainCommand> o = mainCommands.stream().filter(m -> m.getName().equalsIgnoreCase(args.get(0))).limit(1).findAny();
if (!o.isPresent()) { if (!o.isPresent()) {
sendCommandUsage(sender); sendCommandUsage(sender, label);
return true; return true;
} }
final MainCommand main = o.get(); final MainCommand main = o.get();
if (!main.canUse(sender)) { if (!main.canUse(sender)) {
sendCommandUsage(sender); sendCommandUsage(sender, label);
return true; return true;
} }
if (main.getRequiredArgsLength() == 0) { if (main.getRequiredArgsLength() == 0) {
main.execute(plugin, sender, null); main.execute(plugin, sender, null, label);
return true; return true;
} }
if (args.size() == 1) { if (args.size() == 1) {
main.sendUsage(sender); main.sendUsage(sender, label);
return true; 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; return true;
} }
@ -155,11 +155,11 @@ public class CommandManager {
mainCommands.add(command); mainCommands.add(command);
} }
private void sendCommandUsage(Sender sender) { private void sendCommandUsage(Sender sender, String label) {
Message.INFO_BRIEF.send(sender, plugin.getVersion()); Message.INFO_BRIEF.send(sender, plugin.getVersion());
mainCommands.stream() mainCommands.stream()
.filter(c -> c.canUse(sender)) .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)));
} }
} }

View File

@ -18,13 +18,13 @@ public abstract class MainCommand {
private final String usage; private final String usage;
private final int requiredArgsLength; private final int requiredArgsLength;
protected abstract void execute(LuckPermsPlugin plugin, Sender sender, List<String> args); protected abstract void execute(LuckPermsPlugin plugin, Sender sender, List<String> args, String label);
protected abstract List<String> onTabComplete(Sender sender, List<String> args, LuckPermsPlugin plugin); protected abstract List<String> onTabComplete(Sender sender, List<String> args, LuckPermsPlugin plugin);
public abstract List<? extends SubCommand> getSubCommands(); public abstract List<? extends SubCommand> getSubCommands();
protected void sendUsage(Sender sender) { protected void sendUsage(Sender sender, String label) {
if (getSubCommands().isEmpty()) { if (getSubCommands().isEmpty()) {
Util.sendPluginMessage(sender, "&e-> &d" + getUsage()); Util.sendPluginMessage(sender, "&e-> &d" + String.format(getUsage(), label));
return; return;
} }
@ -33,7 +33,7 @@ public abstract class MainCommand {
Util.sendPluginMessage(sender, "&e" + getName() + " Sub Commands:"); Util.sendPluginMessage(sender, "&e" + getName() + " Sub Commands:");
for (SubCommand s : subs) { for (SubCommand s : subs) {
s.sendUsage(sender); s.sendUsage(sender, label);
} }
} else { } else {

View File

@ -51,8 +51,8 @@ public abstract class SubCommand {
return permission.isAuthorized(sender); return permission.isAuthorized(sender);
} }
public void sendUsage(Sender sender) { public void sendUsage(Sender sender, String label) {
Util.sendPluginMessage(sender, "&e-> &d" + getUsage()); Util.sendPluginMessage(sender, "&e-> &d" + String.format(getUsage(), label));
} }
public List<String> onTabComplete(Sender sender, List<String> args, LuckPermsPlugin plugin) { public List<String> onTabComplete(Sender sender, List<String> args, LuckPermsPlugin plugin) {

View File

@ -32,10 +32,6 @@ public class Util {
return new String(b); 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) { public static void sendBoolean(Sender sender, String node, boolean b) {
if (b) { if (b) {
sender.sendMessage(Util.color("&b" + node + ": &atrue")); sender.sendMessage(Util.color("&b" + node + ": &atrue"));

View File

@ -13,13 +13,13 @@ import java.util.List;
public class CreateGroupCommand extends MainCommand { public class CreateGroupCommand extends MainCommand {
public CreateGroupCommand() { public CreateGroupCommand() {
super("CreateGroup", "/perms creategroup <group>", 1); super("CreateGroup", "/%s creategroup <group>", 1);
} }
@Override @Override
protected void execute(LuckPermsPlugin plugin, Sender sender, List<String> args) { protected void execute(LuckPermsPlugin plugin, Sender sender, List<String> args, String label) {
if (args.size() == 0) { if (args.size() == 0) {
sendUsage(sender); sendUsage(sender, label);
return; return;
} }

View File

@ -15,13 +15,13 @@ import java.util.stream.Collectors;
public class DeleteGroupCommand extends MainCommand { public class DeleteGroupCommand extends MainCommand {
public DeleteGroupCommand() { public DeleteGroupCommand() {
super("DeleteGroup", "/perms deletegroup <group>", 1); super("DeleteGroup", "/%s deletegroup <group>", 1);
} }
@Override @Override
protected void execute(LuckPermsPlugin plugin, Sender sender, List<String> args) { protected void execute(LuckPermsPlugin plugin, Sender sender, List<String> args, String label) {
if (args.size() == 0) { if (args.size() == 0) {
sendUsage(sender); sendUsage(sender, label);
return; return;
} }

View File

@ -17,13 +17,13 @@ public class GroupMainCommand extends MainCommand {
private final List<GroupSubCommand> subCommands = new ArrayList<>(); private final List<GroupSubCommand> subCommands = new ArrayList<>();
public GroupMainCommand() { public GroupMainCommand() {
super("Group", "/perms group <group>", 2); super("Group", "/%s group <group>", 2);
} }
@Override @Override
protected void execute(LuckPermsPlugin plugin, Sender sender, List<String> args) { protected void execute(LuckPermsPlugin plugin, Sender sender, List<String> args, String label) {
if (args.size() < 2) { if (args.size() < 2) {
sendUsage(sender); sendUsage(sender, label);
return; return;
} }
@ -46,7 +46,7 @@ public class GroupMainCommand extends MainCommand {
} }
if (sub.isArgLengthInvalid(strippedArgs.size())) { if (sub.isArgLengthInvalid(strippedArgs.size())) {
sub.sendUsage(sender); sub.sendUsage(sender, label);
return; return;
} }
@ -63,7 +63,7 @@ public class GroupMainCommand extends MainCommand {
return; return;
} }
sub.execute(plugin, sender, group, strippedArgs); sub.execute(plugin, sender, group, strippedArgs, label);
}); });
} }

View File

@ -14,7 +14,7 @@ public abstract class GroupSubCommand extends SubCommand {
super(name, description, usage, permission); super(name, description, usage, permission);
} }
protected abstract void execute(LuckPermsPlugin plugin, Sender sender, Group group, List<String> args); protected abstract void execute(LuckPermsPlugin plugin, Sender sender, Group group, List<String> args, String label);
protected void saveGroup(Group group, Sender sender, LuckPermsPlugin plugin) { protected void saveGroup(Group group, Sender sender, LuckPermsPlugin plugin) {
plugin.getDatastore().saveGroup(group, success -> { plugin.getDatastore().saveGroup(group, success -> {

View File

@ -14,11 +14,11 @@ import java.util.List;
public class ListGroupsCommand extends MainCommand { public class ListGroupsCommand extends MainCommand {
public ListGroupsCommand() { public ListGroupsCommand() {
super("ListGroups", "/perms listgroups", 0); super("ListGroups", "/%s listgroups", 0);
} }
@Override @Override
protected void execute(LuckPermsPlugin plugin, Sender sender, List<String> args) { protected void execute(LuckPermsPlugin plugin, Sender sender, List<String> args, String label) {
plugin.getDatastore().loadAllGroups(success -> { plugin.getDatastore().loadAllGroups(success -> {
if (!success) { if (!success) {
Message.GROUPS_LOAD_ERROR.send(sender); Message.GROUPS_LOAD_ERROR.send(sender);

View File

@ -11,11 +11,11 @@ import java.util.List;
public class GroupClearCommand extends GroupSubCommand { public class GroupClearCommand extends GroupSubCommand {
public GroupClearCommand() { public GroupClearCommand() {
super("clear", "Clears a groups permissions", "/perms group <group> clear", Permission.GROUP_CLEAR); super("clear", "Clears a groups permissions", "/%s group <group> clear", Permission.GROUP_CLEAR);
} }
@Override @Override
protected void execute(LuckPermsPlugin plugin, Sender sender, Group group, List<String> args) { protected void execute(LuckPermsPlugin plugin, Sender sender, Group group, List<String> args, String label) {
group.clearNodes(); group.clearNodes();
Message.CLEAR_SUCCESS.send(sender, group.getName()); Message.CLEAR_SUCCESS.send(sender, group.getName());

View File

@ -12,11 +12,11 @@ import java.util.List;
public class GroupHasPermCommand extends GroupSubCommand { public class GroupHasPermCommand extends GroupSubCommand {
public GroupHasPermCommand() { public GroupHasPermCommand() {
super("haspermission", "Checks to see if a group has a certain permission node", super("haspermission", "Checks to see if a group has a certain permission node",
"/perms group <group> haspermission <node> [server]", Permission.GROUP_HASPERMISSION); "/%s group <group> haspermission <node> [server]", Permission.GROUP_HASPERMISSION);
} }
@Override @Override
protected void execute(LuckPermsPlugin plugin, Sender sender, Group group, List<String> args) { protected void execute(LuckPermsPlugin plugin, Sender sender, Group group, List<String> args, String label) {
if (args.size() == 2) { if (args.size() == 2) {
Util.sendBoolean(sender, args.get(0), group.hasPermission(args.get(0), true, args.get(1).toLowerCase())); Util.sendBoolean(sender, args.get(0), group.hasPermission(args.get(0), true, args.get(1).toLowerCase()));
} else { } else {

View File

@ -11,12 +11,12 @@ import java.util.List;
public class GroupInfoCommand extends GroupSubCommand { public class GroupInfoCommand extends GroupSubCommand {
public GroupInfoCommand() { public GroupInfoCommand() {
super("info", "Gives info about the group", "/perms group <group> info", Permission.GROUP_INFO); super("info", "Gives info about the group", "/%s group <group> info", Permission.GROUP_INFO);
} }
@Override @Override
protected void execute(LuckPermsPlugin plugin, Sender sender, Group group, List<String> args) { protected void execute(LuckPermsPlugin plugin, Sender sender, Group group, List<String> args, String label) {
Message.GROUP_INFO.send(sender, group.getName(), group.getNodes().keySet().size(), group.getName()); Message.GROUP_INFO.send(sender, group.getName(), group.getNodes().keySet().size(), label, group.getName());
} }
@Override @Override

View File

@ -12,11 +12,11 @@ import java.util.List;
public class GroupInheritsPermCommand extends GroupSubCommand { public class GroupInheritsPermCommand extends GroupSubCommand {
public GroupInheritsPermCommand() { public GroupInheritsPermCommand() {
super("inheritspermission", "Checks to see if a group inherits a certain permission node", super("inheritspermission", "Checks to see if a group inherits a certain permission node",
"/perms group <group> inheritspermission <node> [server]", Permission.GROUP_INHERITSPERMISSION); "/%s group <group> inheritspermission <node> [server]", Permission.GROUP_INHERITSPERMISSION);
} }
@Override @Override
protected void execute(LuckPermsPlugin plugin, Sender sender, Group group, List<String> args) { protected void execute(LuckPermsPlugin plugin, Sender sender, Group group, List<String> args, String label) {
if (args.size() == 2) { if (args.size() == 2) {
Util.sendBoolean(sender, args.get(0), group.inheritsPermission(args.get(0), true, args.get(1).toLowerCase())); Util.sendBoolean(sender, args.get(0), group.inheritsPermission(args.get(0), true, args.get(1).toLowerCase()));
} else { } else {

View File

@ -12,12 +12,12 @@ import java.util.List;
public class GroupListNodesCommand extends GroupSubCommand { public class GroupListNodesCommand extends GroupSubCommand {
public GroupListNodesCommand() { public GroupListNodesCommand() {
super("listnodes", "Lists the permission nodes the group has", "/perms group <group> listnodes", super("listnodes", "Lists the permission nodes the group has", "/%s group <group> listnodes",
Permission.GROUP_LISTNODES); Permission.GROUP_LISTNODES);
} }
@Override @Override
protected void execute(LuckPermsPlugin plugin, Sender sender, Group group, List<String> args) { protected void execute(LuckPermsPlugin plugin, Sender sender, Group group, List<String> args, String label) {
Message.LISTNODES.send(sender, group.getName(), Util.nodesToString(group.getNodes())); Message.LISTNODES.send(sender, group.getName(), Util.nodesToString(group.getNodes()));
} }

View File

@ -13,11 +13,11 @@ import java.util.List;
public class GroupSetInheritCommand extends GroupSubCommand { public class GroupSetInheritCommand extends GroupSubCommand {
public GroupSetInheritCommand() { public GroupSetInheritCommand() {
super("setinherit", "Sets another group for this group to inherit permissions from", super("setinherit", "Sets another group for this group to inherit permissions from",
"/perms group <group> setinherit <group> [server]", Permission.GROUP_SETINHERIT); "/%s group <group> setinherit <group> [server]", Permission.GROUP_SETINHERIT);
} }
@Override @Override
protected void execute(LuckPermsPlugin plugin, Sender sender, Group group, List<String> args) { protected void execute(LuckPermsPlugin plugin, Sender sender, Group group, List<String> args, String label) {
String groupName = args.get(0).toLowerCase(); String groupName = args.get(0).toLowerCase();
plugin.getDatastore().loadGroup(groupName, success -> { plugin.getDatastore().loadGroup(groupName, success -> {

View File

@ -13,17 +13,17 @@ import java.util.List;
public class GroupSetPermissionCommand extends GroupSubCommand { public class GroupSetPermissionCommand extends GroupSubCommand {
public GroupSetPermissionCommand() { public GroupSetPermissionCommand() {
super("set", "Sets a permission for a group", "/perms group <group> set <node> <true|false> [server]", super("set", "Sets a permission for a group", "/%s group <group> set <node> <true|false> [server]",
Permission.GROUP_SETPERMISSION); Permission.GROUP_SETPERMISSION);
} }
@Override @Override
protected void execute(LuckPermsPlugin plugin, Sender sender, Group group, List<String> args) { protected void execute(LuckPermsPlugin plugin, Sender sender, Group group, List<String> args, String label) {
String node = args.get(0); String node = args.get(0);
String bool = args.get(1).toLowerCase(); String bool = args.get(1).toLowerCase();
if (node.contains("/")) { if (node.contains("/")) {
sendUsage(sender); sendUsage(sender, label);
return; return;
} }
@ -33,7 +33,7 @@ public class GroupSetPermissionCommand extends GroupSubCommand {
} }
if (!bool.equalsIgnoreCase("true") && !bool.equalsIgnoreCase("false")) { if (!bool.equalsIgnoreCase("true") && !bool.equalsIgnoreCase("false")) {
sendUsage(sender); sendUsage(sender, label);
return; return;
} }

View File

@ -14,11 +14,11 @@ import java.util.stream.Collectors;
public class GroupShowTracksCommand extends GroupSubCommand { public class GroupShowTracksCommand extends GroupSubCommand {
public GroupShowTracksCommand() { public GroupShowTracksCommand() {
super("showtracks", "Lists the tracks that this group features on", "/perms group <group> showtracks", Permission.GROUP_SHOWTRACKS); super("showtracks", "Lists the tracks that this group features on", "/%s group <group> showtracks", Permission.GROUP_SHOWTRACKS);
} }
@Override @Override
protected void execute(LuckPermsPlugin plugin, Sender sender, Group group, List<String> args) { protected void execute(LuckPermsPlugin plugin, Sender sender, Group group, List<String> args, String label) {
plugin.getDatastore().loadAllTracks(success -> { plugin.getDatastore().loadAllTracks(success -> {
if (!success) { if (!success) {
Message.TRACKS_LOAD_ERROR.send(sender); Message.TRACKS_LOAD_ERROR.send(sender);

View File

@ -14,15 +14,15 @@ import java.util.List;
public class GroupUnSetPermissionCommand extends GroupSubCommand { public class GroupUnSetPermissionCommand extends GroupSubCommand {
public GroupUnSetPermissionCommand() { public GroupUnSetPermissionCommand() {
super("unset", "Unsets a permission for a group", super("unset", "Unsets a permission for a group",
"/perms group <group> unset <node> [server]", Permission.GROUP_UNSETPERMISSION); "/%s group <group> unset <node> [server]", Permission.GROUP_UNSETPERMISSION);
} }
@Override @Override
protected void execute(LuckPermsPlugin plugin, Sender sender, Group group, List<String> args) { protected void execute(LuckPermsPlugin plugin, Sender sender, Group group, List<String> args, String label) {
String node = args.get(0); String node = args.get(0);
if (node.contains("/")) { if (node.contains("/")) {
sendUsage(sender); sendUsage(sender, label);
return; return;
} }

View File

@ -13,11 +13,11 @@ import java.util.List;
public class GroupUnsetInheritCommand extends GroupSubCommand { public class GroupUnsetInheritCommand extends GroupSubCommand {
public GroupUnsetInheritCommand() { public GroupUnsetInheritCommand() {
super("unsetinherit", "Unsets another group for this group to inherit permissions from", super("unsetinherit", "Unsets another group for this group to inherit permissions from",
"/perms group <group> unsetinherit <group> [server]", Permission.GROUP_UNSETINHERIT); "/%s group <group> unsetinherit <group> [server]", Permission.GROUP_UNSETINHERIT);
} }
@Override @Override
protected void execute(LuckPermsPlugin plugin, Sender sender, Group group, List<String> args) { protected void execute(LuckPermsPlugin plugin, Sender sender, Group group, List<String> args, String label) {
String groupName = args.get(0).toLowerCase(); String groupName = args.get(0).toLowerCase();
try { try {

View File

@ -12,11 +12,11 @@ import java.util.List;
public class DebugCommand extends MainCommand { public class DebugCommand extends MainCommand {
public DebugCommand() { public DebugCommand() {
super("Debug", "/perms debug", 0); super("Debug", "/%s debug", 0);
} }
@Override @Override
protected void execute(LuckPermsPlugin plugin, Sender sender, List<String> args) { protected void execute(LuckPermsPlugin plugin, Sender sender, List<String> args, String label) {
Message.DEBUG.send(sender, plugin.getPlayerCount(), plugin.getUserManager().getUsers().size(), Message.DEBUG.send(sender, plugin.getPlayerCount(), plugin.getUserManager().getUsers().size(),
plugin.getGroupManager().getGroups().size(), plugin.getTrackManager().getTracks().size() plugin.getGroupManager().getGroups().size(), plugin.getTrackManager().getTracks().size()
); );

View File

@ -12,11 +12,11 @@ import java.util.List;
public class InfoCommand extends MainCommand { public class InfoCommand extends MainCommand {
public InfoCommand() { public InfoCommand() {
super("Info", "/perms info", 0); super("Info", "/%s info", 0);
} }
@Override @Override
protected void execute(LuckPermsPlugin plugin, Sender sender, List<String> args) { protected void execute(LuckPermsPlugin plugin, Sender sender, List<String> args, String label) {
Message.INFO.send(sender, plugin.getVersion(), plugin.getDatastore().getName()); Message.INFO.send(sender, plugin.getVersion(), plugin.getDatastore().getName());
} }

View File

@ -12,11 +12,11 @@ import java.util.List;
public class SyncCommand extends MainCommand { public class SyncCommand extends MainCommand {
public SyncCommand() { public SyncCommand() {
super("Sync", "/perms sync", 0); super("Sync", "/%s sync", 0);
} }
@Override @Override
protected void execute(LuckPermsPlugin plugin, Sender sender, List<String> args) { protected void execute(LuckPermsPlugin plugin, Sender sender, List<String> args, String label) {
Message.UPDATE_TASK_RUN.send(sender); Message.UPDATE_TASK_RUN.send(sender);
plugin.runUpdateTask(); plugin.runUpdateTask();
} }

View File

@ -13,13 +13,13 @@ import java.util.List;
public class CreateTrackCommand extends MainCommand { public class CreateTrackCommand extends MainCommand {
public CreateTrackCommand() { public CreateTrackCommand() {
super("CreateTrack", "/perms createtrack <track>", 1); super("CreateTrack", "/%s createtrack <track>", 1);
} }
@Override @Override
protected void execute(LuckPermsPlugin plugin, Sender sender, List<String> args) { protected void execute(LuckPermsPlugin plugin, Sender sender, List<String> args, String label) {
if (args.size() == 0) { if (args.size() == 0) {
sendUsage(sender); sendUsage(sender, label);
return; return;
} }

View File

@ -15,13 +15,13 @@ import java.util.stream.Collectors;
public class DeleteTrackCommand extends MainCommand { public class DeleteTrackCommand extends MainCommand {
public DeleteTrackCommand() { public DeleteTrackCommand() {
super("DeleteTrack", "/perms deletetrack <track>", 1); super("DeleteTrack", "/%s deletetrack <track>", 1);
} }
@Override @Override
protected void execute(LuckPermsPlugin plugin, Sender sender, List<String> args) { protected void execute(LuckPermsPlugin plugin, Sender sender, List<String> args, String label) {
if (args.size() == 0) { if (args.size() == 0) {
sendUsage(sender); sendUsage(sender, label);
return; return;
} }

View File

@ -14,11 +14,11 @@ import java.util.List;
public class ListTracksCommand extends MainCommand { public class ListTracksCommand extends MainCommand {
public ListTracksCommand() { public ListTracksCommand() {
super("ListTracks", "/perms listtracks", 0); super("ListTracks", "/%s listtracks", 0);
} }
@Override @Override
protected void execute(LuckPermsPlugin plugin, Sender sender, List<String> args) { protected void execute(LuckPermsPlugin plugin, Sender sender, List<String> args, String label) {
plugin.getDatastore().loadAllTracks(success -> { plugin.getDatastore().loadAllTracks(success -> {
if (!success) { if (!success) {
Message.TRACKS_LOAD_ERROR.send(sender); Message.TRACKS_LOAD_ERROR.send(sender);

View File

@ -17,13 +17,13 @@ public class TrackMainCommand extends MainCommand {
private final List<TrackSubCommand> subCommands = new ArrayList<>(); private final List<TrackSubCommand> subCommands = new ArrayList<>();
public TrackMainCommand() { public TrackMainCommand() {
super("Track", "/perms track <track>", 2); super("Track", "/%s track <track>", 2);
} }
@Override @Override
protected void execute(LuckPermsPlugin plugin, Sender sender, List<String> args) { protected void execute(LuckPermsPlugin plugin, Sender sender, List<String> args, String label) {
if (args.size() < 2) { if (args.size() < 2) {
sendUsage(sender); sendUsage(sender, label);
return; return;
} }
@ -46,7 +46,7 @@ public class TrackMainCommand extends MainCommand {
} }
if (sub.isArgLengthInvalid(strippedArgs.size())) { if (sub.isArgLengthInvalid(strippedArgs.size())) {
sub.sendUsage(sender); sub.sendUsage(sender, label);
return; return;
} }
@ -63,7 +63,7 @@ public class TrackMainCommand extends MainCommand {
return; return;
} }
sub.execute(plugin, sender, track, strippedArgs); sub.execute(plugin, sender, track, strippedArgs, label);
}); });
} }

View File

@ -14,7 +14,7 @@ public abstract class TrackSubCommand extends SubCommand {
super(name, description, usage, permission); super(name, description, usage, permission);
} }
protected abstract void execute(LuckPermsPlugin plugin, Sender sender, Track track, List<String> args); protected abstract void execute(LuckPermsPlugin plugin, Sender sender, Track track, List<String> args, String label);
protected void saveTrack(Track track, Sender sender, LuckPermsPlugin plugin) { protected void saveTrack(Track track, Sender sender, LuckPermsPlugin plugin) {
plugin.getDatastore().saveTrack(track, success -> { plugin.getDatastore().saveTrack(track, success -> {

View File

@ -14,11 +14,11 @@ import java.util.List;
public class TrackAppendCommand extends TrackSubCommand { public class TrackAppendCommand extends TrackSubCommand {
public TrackAppendCommand() { public TrackAppendCommand() {
super("append", "Appends a group onto the end of the track", "/perms track <track> append <group>", Permission.TRACK_APPEND); super("append", "Appends a group onto the end of the track", "/%s track <track> append <group>", Permission.TRACK_APPEND);
} }
@Override @Override
protected void execute(LuckPermsPlugin plugin, Sender sender, Track track, List<String> args) { protected void execute(LuckPermsPlugin plugin, Sender sender, Track track, List<String> args, String label) {
String groupName = args.get(0).toLowerCase(); String groupName = args.get(0).toLowerCase();
plugin.getDatastore().loadGroup(groupName, success -> { plugin.getDatastore().loadGroup(groupName, success -> {

View File

@ -11,11 +11,11 @@ import java.util.List;
public class TrackClearCommand extends TrackSubCommand { public class TrackClearCommand extends TrackSubCommand {
public TrackClearCommand() { public TrackClearCommand() {
super("clear", "Clears the groups on the track", "/perms track <track> clear", Permission.TRACK_CLEAR); super("clear", "Clears the groups on the track", "/%s track <track> clear", Permission.TRACK_CLEAR);
} }
@Override @Override
protected void execute(LuckPermsPlugin plugin, Sender sender, Track track, List<String> args) { protected void execute(LuckPermsPlugin plugin, Sender sender, Track track, List<String> args, String label) {
track.clearGroups(); track.clearGroups();
Message.TRACK_CLEAR.send(sender, track.getName()); Message.TRACK_CLEAR.send(sender, track.getName());
saveTrack(track, sender, plugin); saveTrack(track, sender, plugin);

View File

@ -12,11 +12,11 @@ import java.util.List;
public class TrackInfoCommand extends TrackSubCommand { public class TrackInfoCommand extends TrackSubCommand {
public TrackInfoCommand() { public TrackInfoCommand() {
super("info", "Gives info about the track", "/perms track <track> info", Permission.TRACK_INFO); super("info", "Gives info about the track", "/%s track <track> info", Permission.TRACK_INFO);
} }
@Override @Override
protected void execute(LuckPermsPlugin plugin, Sender sender, Track track, List<String> args) { protected void execute(LuckPermsPlugin plugin, Sender sender, Track track, List<String> args, String label) {
Message.TRACK_INFO.send(sender, track.getName(), Util.listToArrowSep(track.getGroups())); Message.TRACK_INFO.send(sender, track.getName(), Util.listToArrowSep(track.getGroups()));
} }

View File

@ -15,11 +15,11 @@ import java.util.List;
public class TrackInsertCommand extends TrackSubCommand { public class TrackInsertCommand extends TrackSubCommand {
public TrackInsertCommand() { public TrackInsertCommand() {
super("insert", "Inserts a group at a given position along the track", super("insert", "Inserts a group at a given position along the track",
"/perms track <track> insert <group> <position>", Permission.TRACK_INSERT); "/%s track <track> insert <group> <position>", Permission.TRACK_INSERT);
} }
@Override @Override
protected void execute(LuckPermsPlugin plugin, Sender sender, Track track, List<String> args) { protected void execute(LuckPermsPlugin plugin, Sender sender, Track track, List<String> args, String label) {
String groupName = args.get(0).toLowerCase(); String groupName = args.get(0).toLowerCase();
int pos; int pos;
try { try {

View File

@ -12,11 +12,11 @@ import java.util.List;
public class TrackRemoveCommand extends TrackSubCommand { public class TrackRemoveCommand extends TrackSubCommand {
public TrackRemoveCommand() { public TrackRemoveCommand() {
super("remove", "Removes a group from the track", "/perms track <track> remove <group>", Permission.TRACK_REMOVE); super("remove", "Removes a group from the track", "/%s track <track> remove <group>", Permission.TRACK_REMOVE);
} }
@Override @Override
protected void execute(LuckPermsPlugin plugin, Sender sender, Track track, List<String> args) { protected void execute(LuckPermsPlugin plugin, Sender sender, Track track, List<String> args, String label) {
String groupName = args.get(0).toLowerCase(); String groupName = args.get(0).toLowerCase();
try { try {
track.removeGroup(groupName); track.removeGroup(groupName);

View File

@ -19,13 +19,13 @@ public class UserMainCommand extends MainCommand {
private final List<UserSubCommand> subCommands = new ArrayList<>(); private final List<UserSubCommand> subCommands = new ArrayList<>();
public UserMainCommand() { public UserMainCommand() {
super("User", "/perms user <user>", 2); super("User", "/%s user <user>", 2);
} }
@Override @Override
protected void execute(LuckPermsPlugin plugin, Sender sender, List<String> args) { protected void execute(LuckPermsPlugin plugin, Sender sender, List<String> args, String label) {
if (args.size() < 2) { if (args.size() < 2) {
sendUsage(sender); sendUsage(sender, label);
return; return;
} }
@ -49,14 +49,14 @@ public class UserMainCommand extends MainCommand {
} }
if (sub.isArgLengthInvalid(strippedArgs.size())) { if (sub.isArgLengthInvalid(strippedArgs.size())) {
sub.sendUsage(sender); sub.sendUsage(sender, label);
return; return;
} }
final String user = args.get(0); final String user = args.get(0);
UUID u = Util.parseUuid(user); UUID u = Util.parseUuid(user);
if (u != null) { if (u != null) {
runSub(plugin, sender, u, sub, strippedArgs); runSub(plugin, sender, u, sub, strippedArgs, label);
return; return;
} }
@ -68,7 +68,7 @@ public class UserMainCommand extends MainCommand {
Message.USER_NOT_FOUND.send(sender); Message.USER_NOT_FOUND.send(sender);
return; return;
} }
runSub(plugin, sender, uuid, sub, strippedArgs); runSub(plugin, sender, uuid, sub, strippedArgs, label);
}); });
return; return;
} }
@ -91,7 +91,7 @@ public class UserMainCommand extends MainCommand {
return onAbstractTabComplete(sender, args, plugin); return onAbstractTabComplete(sender, args, plugin);
} }
private void runSub(LuckPermsPlugin plugin, Sender sender, UUID uuid, UserSubCommand command, List<String> strippedArgs) { private void runSub(LuckPermsPlugin plugin, Sender sender, UUID uuid, UserSubCommand command, List<String> strippedArgs, String label) {
plugin.getDatastore().loadUser(uuid, success -> { plugin.getDatastore().loadUser(uuid, success -> {
if (!success) { if (!success) {
Message.USER_NOT_FOUND.send(sender); Message.USER_NOT_FOUND.send(sender);
@ -103,7 +103,7 @@ public class UserMainCommand extends MainCommand {
Message.USER_NOT_FOUND.send(sender); Message.USER_NOT_FOUND.send(sender);
} }
command.execute(plugin, sender, user, strippedArgs); command.execute(plugin, sender, user, strippedArgs, label);
plugin.getUserManager().cleanupUser(user); plugin.getUserManager().cleanupUser(user);
}); });
} }

View File

@ -14,7 +14,7 @@ public abstract class UserSubCommand extends SubCommand {
super(name, description, usage, permission); super(name, description, usage, permission);
} }
protected abstract void execute(LuckPermsPlugin plugin, Sender sender, User user, List<String> args); protected abstract void execute(LuckPermsPlugin plugin, Sender sender, User user, List<String> args, String label);
protected void saveUser(User user, Sender sender, LuckPermsPlugin plugin) { protected void saveUser(User user, Sender sender, LuckPermsPlugin plugin) {
user.refreshPermissions(); user.refreshPermissions();

View File

@ -13,11 +13,11 @@ import java.util.List;
public class UserAddGroupCommand extends UserSubCommand { public class UserAddGroupCommand extends UserSubCommand {
public UserAddGroupCommand() { public UserAddGroupCommand() {
super("addgroup", "Adds the user to a group", "/perms user <user> addgroup <group> [server]", Permission.USER_ADDGROUP); super("addgroup", "Adds the user to a group", "/%s user <user> addgroup <group> [server]", Permission.USER_ADDGROUP);
} }
@Override @Override
protected void execute(LuckPermsPlugin plugin, Sender sender, User user, List<String> args) { protected void execute(LuckPermsPlugin plugin, Sender sender, User user, List<String> args, String label) {
String groupName = args.get(0).toLowerCase(); String groupName = args.get(0).toLowerCase();
plugin.getDatastore().loadGroup(groupName, success -> { plugin.getDatastore().loadGroup(groupName, success -> {

View File

@ -11,11 +11,11 @@ import java.util.List;
public class UserClearCommand extends UserSubCommand { public class UserClearCommand extends UserSubCommand {
public UserClearCommand() { public UserClearCommand() {
super("clear", "Clears a users permissions and groups", "/perms user <user> clear", Permission.USER_CLEAR); super("clear", "Clears a users permissions and groups", "/%s user <user> clear", Permission.USER_CLEAR);
} }
@Override @Override
protected void execute(LuckPermsPlugin plugin, Sender sender, User user, List<String> args) { protected void execute(LuckPermsPlugin plugin, Sender sender, User user, List<String> args, String label) {
user.clearNodes(); user.clearNodes();
plugin.getUserManager().giveDefaults(user); plugin.getUserManager().giveDefaults(user);
Message.CLEAR_SUCCESS.send(sender, user.getName()); Message.CLEAR_SUCCESS.send(sender, user.getName());

View File

@ -16,11 +16,11 @@ import java.util.List;
public class UserDemoteCommand extends UserSubCommand { public class UserDemoteCommand extends UserSubCommand {
public UserDemoteCommand() { public UserDemoteCommand() {
super("demote", "Demotes a user along a track", "/perms user <user> demote <track>", Permission.USER_DEMOTE); super("demote", "Demotes a user along a track", "/%s user <user> demote <track>", Permission.USER_DEMOTE);
} }
@Override @Override
protected void execute(LuckPermsPlugin plugin, Sender sender, User user, List<String> args) { protected void execute(LuckPermsPlugin plugin, Sender sender, User user, List<String> args, String label) {
final String trackName = args.get(0).toLowerCase(); final String trackName = args.get(0).toLowerCase();
plugin.getDatastore().loadTrack(trackName, success -> { plugin.getDatastore().loadTrack(trackName, success -> {

View File

@ -11,11 +11,11 @@ import java.util.List;
public class UserGetUUIDCommand extends UserSubCommand { public class UserGetUUIDCommand extends UserSubCommand {
public UserGetUUIDCommand() { public UserGetUUIDCommand() {
super("getuuid", "Get the UUID of a user", "/perms user <user> getuuid", Permission.USER_GETUUID); super("getuuid", "Get the UUID of a user", "/%s user <user> getuuid", Permission.USER_GETUUID);
} }
@Override @Override
protected void execute(LuckPermsPlugin plugin, Sender sender, User user, List<String> args) { protected void execute(LuckPermsPlugin plugin, Sender sender, User user, List<String> args, String label) {
Message.USER_GETUUID.send(sender, user.getName(), user.getUuid().toString()); Message.USER_GETUUID.send(sender, user.getName(), user.getUuid().toString());
} }

View File

@ -12,11 +12,11 @@ import java.util.List;
public class UserHasPermCommand extends UserSubCommand { public class UserHasPermCommand extends UserSubCommand {
public UserHasPermCommand() { public UserHasPermCommand() {
super("haspermission", "Checks to see if a user has a certain permission node", super("haspermission", "Checks to see if a user has a certain permission node",
"/perms user <user> haspermission <node> [server]", Permission.USER_HASPERMISSION); "/%s user <user> haspermission <node> [server]", Permission.USER_HASPERMISSION);
} }
@Override @Override
protected void execute(LuckPermsPlugin plugin, Sender sender, User user, List<String> args) { protected void execute(LuckPermsPlugin plugin, Sender sender, User user, List<String> args, String label) {
if (args.size() >= 2) { if (args.size() >= 2) {
Util.sendBoolean(sender, args.get(0), user.hasPermission(args.get(0), true, args.get(1))); Util.sendBoolean(sender, args.get(0), user.hasPermission(args.get(0), true, args.get(1)));
} else { } else {

View File

@ -12,14 +12,14 @@ import java.util.List;
public class UserInfoCommand extends UserSubCommand { public class UserInfoCommand extends UserSubCommand {
public UserInfoCommand() { public UserInfoCommand() {
super("info", "Gives info about the user", "/perms user <user> info", Permission.USER_INFO); super("info", "Gives info about the user", "/%s user <user> info", Permission.USER_INFO);
} }
@Override @Override
protected void execute(LuckPermsPlugin plugin, Sender sender, User user, List<String> args) { protected void execute(LuckPermsPlugin plugin, Sender sender, User user, List<String> args, String label) {
Message.USER_INFO.send(sender, user.getName(), user.getUuid(), plugin.getPlayerStatus(user.getUuid()), Message.USER_INFO.send(sender, user.getName(), user.getUuid(), plugin.getPlayerStatus(user.getUuid()),
Util.listToCommaSep(user.getGroupNames()), user.getPrimaryGroup(), 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()
); );
} }

View File

@ -12,11 +12,11 @@ import java.util.List;
public class UserInheritsPermCommand extends UserSubCommand { public class UserInheritsPermCommand extends UserSubCommand {
public UserInheritsPermCommand() { public UserInheritsPermCommand() {
super("inheritspermission", "Checks to see if a user inherits a certain permission node", super("inheritspermission", "Checks to see if a user inherits a certain permission node",
"/perms user <user> inheritspermission <node> [server]", Permission.USER_INHERITSPERMISSION); "/%s user <user> inheritspermission <node> [server]", Permission.USER_INHERITSPERMISSION);
} }
@Override @Override
protected void execute(LuckPermsPlugin plugin, Sender sender, User user, List<String> args) { protected void execute(LuckPermsPlugin plugin, Sender sender, User user, List<String> args, String label) {
if (args.size() >= 2) { if (args.size() >= 2) {
Util.sendBoolean(sender, args.get(0), user.inheritsPermission(args.get(0), true, args.get(1))); Util.sendBoolean(sender, args.get(0), user.inheritsPermission(args.get(0), true, args.get(1)));
} else { } else {

View File

@ -12,11 +12,11 @@ import java.util.List;
public class UserListNodesCommand extends UserSubCommand { public class UserListNodesCommand extends UserSubCommand {
public UserListNodesCommand() { public UserListNodesCommand() {
super("listnodes", "Lists the permission nodes the user has", "/perms user <user> listnodes", Permission.USER_LISTNODES); super("listnodes", "Lists the permission nodes the user has", "/%s user <user> listnodes", Permission.USER_LISTNODES);
} }
@Override @Override
protected void execute(LuckPermsPlugin plugin, Sender sender, User user, List<String> args) { protected void execute(LuckPermsPlugin plugin, Sender sender, User user, List<String> args, String label) {
Message.LISTNODES.send(sender, user.getName(), Util.nodesToString(user.getNodes())); Message.LISTNODES.send(sender, user.getName(), Util.nodesToString(user.getNodes()));
} }

View File

@ -16,11 +16,11 @@ import java.util.List;
public class UserPromoteCommand extends UserSubCommand { public class UserPromoteCommand extends UserSubCommand {
public UserPromoteCommand() { public UserPromoteCommand() {
super("promote", "Promotes the user along a track", "/perms user <user> promote <track>", Permission.USER_PROMOTE); super("promote", "Promotes the user along a track", "/%s user <user> promote <track>", Permission.USER_PROMOTE);
} }
@Override @Override
protected void execute(LuckPermsPlugin plugin, Sender sender, User user, List<String> args) { protected void execute(LuckPermsPlugin plugin, Sender sender, User user, List<String> args, String label) {
final String trackName = args.get(0).toLowerCase(); final String trackName = args.get(0).toLowerCase();
plugin.getDatastore().loadTrack(trackName, success -> { plugin.getDatastore().loadTrack(trackName, success -> {

View File

@ -12,11 +12,11 @@ import java.util.List;
public class UserRemoveGroupCommand extends UserSubCommand { public class UserRemoveGroupCommand extends UserSubCommand {
public UserRemoveGroupCommand() { public UserRemoveGroupCommand() {
super("removegroup", "Removes a user from a group", "/perms user <user> removegroup <group> [server]", Permission.USER_REMOVEGROUP); super("removegroup", "Removes a user from a group", "/%s user <user> removegroup <group> [server]", Permission.USER_REMOVEGROUP);
} }
@Override @Override
protected void execute(LuckPermsPlugin plugin, Sender sender, User user, List<String> args) { protected void execute(LuckPermsPlugin plugin, Sender sender, User user, List<String> args, String label) {
String groupName = args.get(0).toLowerCase(); String groupName = args.get(0).toLowerCase();
if ((args.size() == 1 || (args.size() == 2 && args.get(1).equalsIgnoreCase("global"))) if ((args.size() == 1 || (args.size() == 2 && args.get(1).equalsIgnoreCase("global")))

View File

@ -14,16 +14,16 @@ import java.util.List;
public class UserSetPermissionCommand extends UserSubCommand { public class UserSetPermissionCommand extends UserSubCommand {
public UserSetPermissionCommand() { public UserSetPermissionCommand() {
super("set", "Sets a permission for a user", super("set", "Sets a permission for a user",
"/perms user <user> set <node> <true|false> [server]", Permission.USER_SETPERMISSION); "/%s user <user> set <node> <true|false> [server]", Permission.USER_SETPERMISSION);
} }
@Override @Override
protected void execute(LuckPermsPlugin plugin, Sender sender, User user, List<String> args) { protected void execute(LuckPermsPlugin plugin, Sender sender, User user, List<String> args, String label) {
String node = args.get(0); String node = args.get(0);
String bool = args.get(1).toLowerCase(); String bool = args.get(1).toLowerCase();
if (node.contains("/")) { if (node.contains("/")) {
sendUsage(sender); sendUsage(sender, label);
return; return;
} }
@ -33,7 +33,7 @@ public class UserSetPermissionCommand extends UserSubCommand {
} }
if (!bool.equalsIgnoreCase("true") && !bool.equalsIgnoreCase("false")) { if (!bool.equalsIgnoreCase("true") && !bool.equalsIgnoreCase("false")) {
sendUsage(sender); sendUsage(sender, label);
return; return;
} }

View File

@ -13,11 +13,11 @@ import java.util.List;
public class UserSetPrimaryGroupCommand extends UserSubCommand { public class UserSetPrimaryGroupCommand extends UserSubCommand {
public UserSetPrimaryGroupCommand() { public UserSetPrimaryGroupCommand() {
super("setprimarygroup", "Sets a users primary group", super("setprimarygroup", "Sets a users primary group",
"/perms user <user> setprimarygroup <group>", Permission.USER_SETPRIMARYGROUP); "/%s user <user> setprimarygroup <group>", Permission.USER_SETPRIMARYGROUP);
} }
@Override @Override
protected void execute(LuckPermsPlugin plugin, Sender sender, User user, List<String> args) { protected void execute(LuckPermsPlugin plugin, Sender sender, User user, List<String> args, String label) {
Group group = plugin.getGroupManager().getGroup(args.get(0).toLowerCase()); Group group = plugin.getGroupManager().getGroup(args.get(0).toLowerCase());
if (group == null) { if (group == null) {
Message.GROUP_DOES_NOT_EXIST.send(sender); Message.GROUP_DOES_NOT_EXIST.send(sender);
@ -30,7 +30,7 @@ public class UserSetPrimaryGroupCommand extends UserSubCommand {
} }
if (!user.isInGroup(group)) { if (!user.isInGroup(group)) {
Message.USER_PRIMARYGROUP_ERROR_NOTMEMBER.send(sender); Message.USER_PRIMARYGROUP_ERROR_NOTMEMBER.send(sender, label);
return; return;
} }

View File

@ -13,11 +13,11 @@ import java.util.List;
public class UserShowPosCommand extends UserSubCommand { public class UserShowPosCommand extends UserSubCommand {
public UserShowPosCommand() { public UserShowPosCommand() {
super("showpos", "Shows a users position on a track", "/perms user <user> showpos <track>", Permission.USER_SHOWPOS); super("showpos", "Shows a users position on a track", "/%s user <user> showpos <track>", Permission.USER_SHOWPOS);
} }
@Override @Override
protected void execute(LuckPermsPlugin plugin, Sender sender, User user, List<String> args) { protected void execute(LuckPermsPlugin plugin, Sender sender, User user, List<String> args, String label) {
final String trackName = args.get(0).toLowerCase(); final String trackName = args.get(0).toLowerCase();
plugin.getDatastore().loadTrack(trackName, success -> { plugin.getDatastore().loadTrack(trackName, success -> {

View File

@ -14,11 +14,12 @@ import java.util.stream.Collectors;
public class UserShowTracksCommand extends UserSubCommand { public class UserShowTracksCommand extends UserSubCommand {
public UserShowTracksCommand() { public UserShowTracksCommand() {
super("showtracks", "Lists the tracks that this user's primary group features on", "/perms user <user> showtracks", Permission.USER_SHOWTRACKS); super("showtracks", "Lists the tracks that this user's primary group features on", "/%s user <user> showtracks",
Permission.USER_SHOWTRACKS);
} }
@Override @Override
protected void execute(LuckPermsPlugin plugin, Sender sender, User user, List<String> args) { protected void execute(LuckPermsPlugin plugin, Sender sender, User user, List<String> args, String label) {
plugin.getDatastore().loadAllTracks(success -> { plugin.getDatastore().loadAllTracks(success -> {
if (!success) { if (!success) {
Message.TRACKS_LOAD_ERROR.send(sender); Message.TRACKS_LOAD_ERROR.send(sender);

View File

@ -14,15 +14,15 @@ import java.util.List;
public class UserUnSetPermissionCommand extends UserSubCommand { public class UserUnSetPermissionCommand extends UserSubCommand {
public UserUnSetPermissionCommand() { public UserUnSetPermissionCommand() {
super("unset", "Unsets a permission for a user", super("unset", "Unsets a permission for a user",
"/perms user <user> unset <node> [server]", Permission.USER_UNSETPERMISSION); "/%s user <user> unset <node> [server]", Permission.USER_UNSETPERMISSION);
} }
@Override @Override
protected void execute(LuckPermsPlugin plugin, Sender sender, User user, List<String> args) { protected void execute(LuckPermsPlugin plugin, Sender sender, User user, List<String> args, String label) {
String node = args.get(0); String node = args.get(0);
if (node.contains("/")) { if (node.contains("/")) {
sendUsage(sender); sendUsage(sender, label);
return; return;
} }

View File

@ -120,7 +120,7 @@ public enum Message {
PREFIX + "&d-> &eGroups: &6%s" + "\n" + PREFIX + "&d-> &eGroups: &6%s" + "\n" +
PREFIX + "&d-> &ePrimary Group: &6%s" + "\n" + PREFIX + "&d-> &ePrimary Group: &6%s" + "\n" +
PREFIX + "&d-> &ePermissions: &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 false
), ),
USER_GETUUID("&bThe UUID of &e%s&b is &e%s&b.", true), 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_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_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_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 <user> addgroup <group>", true), USER_PRIMARYGROUP_ERROR_NOTMEMBER("The user must be a member of the group first! Use &4/%s user <user> addgroup <group>", true),
USER_SHOWTRACKS_INFO("&aShowing tracks that contain the group '&b%s&a' (%s's primary group)", 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_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), 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( GROUP_INFO(
PREFIX + "&d-> &eGroup: &6%s" + "\n" + PREFIX + "&d-> &eGroup: &6%s" + "\n" +
PREFIX + "&d-> &ePermissions: &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 false
), ),
GROUP_SETINHERIT_SUCCESS("&b%s&a now inherits permissions from &b%s&a.", true), GROUP_SETINHERIT_SUCCESS("&b%s&a now inherits permissions from &b%s&a.", true),

View File

@ -7,7 +7,7 @@
<groupId>me.lucko</groupId> <groupId>me.lucko</groupId>
<artifactId>luckperms</artifactId> <artifactId>luckperms</artifactId>
<version>1.0-SNAPSHOT</version> <version>1.1</version>
<modules> <modules>
<module>bukkit</module> <module>bukkit</module>
<module>common</module> <module>common</module>