Add detailed command info system

This commit is contained in:
Luck 2016-09-28 20:59:08 +01:00
parent 385addfe08
commit 93d54373c6
No known key found for this signature in database
GPG Key ID: EFA9B3EC5FD90F8B
80 changed files with 578 additions and 349 deletions

View File

@ -0,0 +1,53 @@
/*
* Copyright (c) 2016 Lucko (Luck) <luck@lucko.me>
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package me.lucko.luckperms.commands;
import com.google.common.collect.ImmutableList;
import lombok.AccessLevel;
import lombok.AllArgsConstructor;
import lombok.Getter;
@Getter
@AllArgsConstructor(access = AccessLevel.PRIVATE)
public class Arg {
public static Arg create(String name, boolean required, String description) {
return new Arg(name, required, description);
}
public static ImmutableList<Arg> list(Arg... args) {
return ImmutableList.copyOf(args);
}
private final String name;
private final boolean required;
private final String description;
public String asPrettyString() {
if (required) {
return "&8<&7" + name + "&8>";
} else {
return "&8[&7" + name + "&8]";
}
}
}

View File

@ -98,7 +98,7 @@ public abstract class MainCommand<T> {
}
if (sub.getIsArgumentInvalid().test(strippedArgs.size())) {
sub.sendUsage(sender);
sub.sendDetailedUsage(sender);
return CommandResult.INVALID_ARGS;
}

View File

@ -22,6 +22,8 @@
package me.lucko.luckperms.commands;
import com.google.common.collect.ImmutableList;
import lombok.AllArgsConstructor;
import lombok.Getter;
import me.lucko.luckperms.LuckPermsPlugin;
import me.lucko.luckperms.constants.Message;
@ -41,6 +43,7 @@ import java.util.stream.Collectors;
* Abstract SubCommand class
*/
@Getter
@AllArgsConstructor
public abstract class SubCommand<T> {
/**
@ -53,11 +56,6 @@ public abstract class SubCommand<T> {
*/
private final String description;
/**
* The command usage
*/
private final String usage;
/**
* The permission needed to use this command
*/
@ -68,13 +66,7 @@ public abstract class SubCommand<T> {
*/
private final Predicate<? super Integer> isArgumentInvalid;
public SubCommand(String name, String description, String usage, Permission permission, Predicate<? super Integer> isArgumentInvalid) {
this.name = name;
this.description = description;
this.permission = permission;
this.isArgumentInvalid = isArgumentInvalid;
this.usage = usage.replace("<", "&8<&7").replace(">", "&8>&7").replace("[", "&8[&7").replace("]", "&8]&7");
}
private final ImmutableList<Arg> args;
/**
* Called when this sub command is ran
@ -103,7 +95,26 @@ public abstract class SubCommand<T> {
* @param sender the sender to send the usage to
*/
public void sendUsage(Sender sender) {
Util.sendPluginMessage(sender, "&3> &a" + getName() + (usage.isEmpty() ? "" : "&3 - &7" + getUsage()));
String usage = "";
if (args != null) {
usage += "&3 - &7";
for (Arg arg : args) {
usage += arg.asPrettyString() + " ";
}
}
Util.sendPluginMessage(sender, "&3> &a" + getName() + usage);
}
public void sendDetailedUsage(Sender sender) {
Util.sendPluginMessage(sender, "&3&lCommand Usage &3- &b" + getName());
Util.sendPluginMessage(sender, "&b> &7" + getDescription());
if (args != null) {
Util.sendPluginMessage(sender, "&3Arguments:");
for (Arg arg : args) {
Util.sendPluginMessage(sender, "&b- " + arg.asPrettyString() + "&3 -> &7" + arg.getDescription());
}
}
}
/**

View File

@ -23,10 +23,7 @@
package me.lucko.luckperms.commands.group.subcommands;
import me.lucko.luckperms.LuckPermsPlugin;
import me.lucko.luckperms.commands.CommandResult;
import me.lucko.luckperms.commands.Predicate;
import me.lucko.luckperms.commands.Sender;
import me.lucko.luckperms.commands.SubCommand;
import me.lucko.luckperms.commands.*;
import me.lucko.luckperms.constants.Message;
import me.lucko.luckperms.constants.Permission;
import me.lucko.luckperms.data.LogEntry;
@ -38,8 +35,14 @@ import java.util.List;
public class GroupAddPrefix extends SubCommand<Group> {
public GroupAddPrefix() {
super("addprefix", "Adds a prefix to the group", "<priority> <prefix> [server] [world]",
Permission.GROUP_ADDPREFIX, Predicate.notInRange(2, 4));
super("addprefix", "Adds a prefix to the group", Permission.GROUP_ADDPREFIX, Predicate.notInRange(2, 4),
Arg.list(
Arg.create("priority", true, "the priority to add the prefix at"),
Arg.create("prefix", true, "the prefix string"),
Arg.create("server", false, "the server to add the prefix on"),
Arg.create("world", false, "the world to add the prefix on")
)
);
}
@Override

View File

@ -23,10 +23,7 @@
package me.lucko.luckperms.commands.group.subcommands;
import me.lucko.luckperms.LuckPermsPlugin;
import me.lucko.luckperms.commands.CommandResult;
import me.lucko.luckperms.commands.Predicate;
import me.lucko.luckperms.commands.Sender;
import me.lucko.luckperms.commands.SubCommand;
import me.lucko.luckperms.commands.*;
import me.lucko.luckperms.constants.Message;
import me.lucko.luckperms.constants.Permission;
import me.lucko.luckperms.data.LogEntry;
@ -38,8 +35,14 @@ import java.util.List;
public class GroupAddSuffix extends SubCommand<Group> {
public GroupAddSuffix() {
super("addsuffix", "Adds a suffix to the group", "<priority> <suffix> [server] [world]",
Permission.GROUP_ADDSUFFIX, Predicate.notInRange(2, 4));
super("addsuffix", "Adds a suffix to the group", Permission.GROUP_ADDSUFFIX, Predicate.notInRange(2, 4),
Arg.list(
Arg.create("priority", true, "the priority to add the suffix at"),
Arg.create("suffix", true, "the suffix string"),
Arg.create("server", false, "the server to add the suffix on"),
Arg.create("world", false, "the world to add the suffix on")
)
);
}
@Override

View File

@ -23,10 +23,7 @@
package me.lucko.luckperms.commands.group.subcommands;
import me.lucko.luckperms.LuckPermsPlugin;
import me.lucko.luckperms.commands.CommandResult;
import me.lucko.luckperms.commands.Predicate;
import me.lucko.luckperms.commands.Sender;
import me.lucko.luckperms.commands.SubCommand;
import me.lucko.luckperms.commands.*;
import me.lucko.luckperms.constants.Message;
import me.lucko.luckperms.constants.Permission;
import me.lucko.luckperms.data.LogEntry;
@ -39,8 +36,15 @@ import java.util.List;
public class GroupAddTempPrefix extends SubCommand<Group> {
public GroupAddTempPrefix() {
super("addtempprefix", "Adds a prefix to the group temporarily", "<priority> <prefix> <duration> [server] [world]",
Permission.GROUP_ADD_TEMP_PREFIX, Predicate.notInRange(3, 5));
super("addtempprefix", "Adds a prefix to the group temporarily", Permission.GROUP_ADD_TEMP_PREFIX, Predicate.notInRange(3, 5),
Arg.list(
Arg.create("priority", true, "the priority to add the prefix at"),
Arg.create("prefix", true, "the prefix string"),
Arg.create("duration", true, "the duration until the prefix expires"),
Arg.create("server", false, "the server to add the prefix on"),
Arg.create("world", false, "the world to add the prefix on")
)
);
}
@Override

View File

@ -23,10 +23,7 @@
package me.lucko.luckperms.commands.group.subcommands;
import me.lucko.luckperms.LuckPermsPlugin;
import me.lucko.luckperms.commands.CommandResult;
import me.lucko.luckperms.commands.Predicate;
import me.lucko.luckperms.commands.Sender;
import me.lucko.luckperms.commands.SubCommand;
import me.lucko.luckperms.commands.*;
import me.lucko.luckperms.constants.Message;
import me.lucko.luckperms.constants.Permission;
import me.lucko.luckperms.data.LogEntry;
@ -39,8 +36,15 @@ import java.util.List;
public class GroupAddTempSuffix extends SubCommand<Group> {
public GroupAddTempSuffix() {
super("addtempsuffix", "Adds a suffix to the group temporarily", "<priority> <suffix> <duration> [server] [world]",
Permission.GROUP_ADD_TEMP_SUFFIX, Predicate.notInRange(3, 5));
super("addtempsuffix", "Adds a suffix to the group temporarily", Permission.GROUP_ADD_TEMP_SUFFIX, Predicate.notInRange(3, 5),
Arg.list(
Arg.create("priority", true, "the priority to add the suffix at"),
Arg.create("suffix", true, "the suffix string"),
Arg.create("duration", true, "the duration until the suffix expires"),
Arg.create("server", false, "the server to add the suffix on"),
Arg.create("world", false, "the world to add the suffix on")
)
);
}
@Override

View File

@ -24,10 +24,7 @@ package me.lucko.luckperms.commands.group.subcommands;
import me.lucko.luckperms.LuckPermsPlugin;
import me.lucko.luckperms.api.Node;
import me.lucko.luckperms.commands.CommandResult;
import me.lucko.luckperms.commands.Predicate;
import me.lucko.luckperms.commands.Sender;
import me.lucko.luckperms.commands.SubCommand;
import me.lucko.luckperms.commands.*;
import me.lucko.luckperms.constants.Message;
import me.lucko.luckperms.constants.Permission;
import me.lucko.luckperms.groups.Group;
@ -39,8 +36,13 @@ import java.util.Set;
public class GroupBulkChange extends SubCommand<Group> {
public GroupBulkChange() {
super("bulkchange", "Applies a bulk permission change to the groups permissions", "<server|world> <from> <to>",
Permission.GROUP_BULKCHANGE, Predicate.not(3));
super("bulkchange", "Applies a bulk permission change to the group's permissions", Permission.GROUP_BULKCHANGE, Predicate.not(3),
Arg.list(
Arg.create("server|world", true, "if the bulk change is modifying a 'server' or a 'world'"),
Arg.create("from", true, "the server/world to be changed from. can be 'global' or 'null' respectively"),
Arg.create("to", true, "the server/world to replace 'from' (can be 'null')")
)
);
}
@Override

View File

@ -34,7 +34,7 @@ import java.util.*;
public class GroupChatMeta extends SubCommand<Group> {
public GroupChatMeta() {
super("chatmeta", "Displays a groups chat meta", "", Permission.GROUP_CHATMETA, Predicate.alwaysFalse());
super("chatmeta", "Lists the group's chat meta", Permission.GROUP_CHATMETA, Predicate.alwaysFalse(), null);
}
@Override

View File

@ -36,7 +36,7 @@ import java.util.List;
public class GroupClear extends SubCommand<Group> {
public GroupClear() {
super("clear", "Clears a groups permissions", "", Permission.GROUP_CLEAR, Predicate.alwaysFalse());
super("clear", "Clears the group's permissions", Permission.GROUP_CLEAR, Predicate.alwaysFalse(), null);
}
@Override

View File

@ -33,8 +33,14 @@ import java.util.List;
public class GroupHasPerm extends SubCommand<Group> {
public GroupHasPerm() {
super("haspermission", "Checks to see if a group has a certain permission node", "<node> [server] [world]",
Permission.GROUP_HASPERMISSION, Predicate.notInRange(1, 3));
super("haspermission", "Checks to see if the group has a certain permission node", Permission.GROUP_HASPERMISSION,
Predicate.notInRange(1, 3),
Arg.list(
Arg.create("node", true, "the permission node to check for"),
Arg.create("server", false, "the server to check on"),
Arg.create("world", false, "the world to check on")
)
);
}
@Override

View File

@ -35,7 +35,7 @@ import java.util.List;
public class GroupInfo extends SubCommand<Group> {
public GroupInfo() {
super("info", "Gives info about the group", "", Permission.GROUP_INFO, Predicate.alwaysFalse());
super("info", "Gives info about the group", Permission.GROUP_INFO, Predicate.alwaysFalse(), null);
}
@Override

View File

@ -33,8 +33,14 @@ import java.util.List;
public class GroupInheritsPerm extends SubCommand<Group> {
public GroupInheritsPerm() {
super("inheritspermission", "Checks to see if a group inherits a certain permission node", "<node> [server] [world]",
Permission.GROUP_INHERITSPERMISSION, Predicate.notInRange(1, 3));
super("inheritspermission", "Checks to see if the group inherits a certain permission node",
Permission.GROUP_INHERITSPERMISSION, Predicate.notInRange(1, 3),
Arg.list(
Arg.create("node", true, "the permission node to check for"),
Arg.create("server", false, "the server to check on"),
Arg.create("world", false, "the world to check on")
)
);
}
@Override

View File

@ -32,7 +32,7 @@ import java.util.List;
public class GroupListNodes extends SubCommand<Group> {
public GroupListNodes() {
super("listnodes", "Lists the permission nodes the group has", "", Permission.GROUP_LISTNODES, Predicate.alwaysFalse());
super("listnodes", "Lists the permission nodes the group has", Permission.GROUP_LISTNODES, Predicate.alwaysFalse(), null);
}
@Override

View File

@ -32,7 +32,7 @@ import java.util.List;
public class GroupListParents extends SubCommand<Group> {
public GroupListParents() {
super("listparents", "Lists the groups that this group inherits from", "", Permission.GROUP_LISTPARENTS, Predicate.alwaysFalse());
super("listparents", "Lists the groups that this group inherits from", Permission.GROUP_LISTPARENTS, Predicate.alwaysFalse(), null);
}
@Override

View File

@ -23,10 +23,7 @@
package me.lucko.luckperms.commands.group.subcommands;
import me.lucko.luckperms.LuckPermsPlugin;
import me.lucko.luckperms.commands.CommandResult;
import me.lucko.luckperms.commands.Predicate;
import me.lucko.luckperms.commands.Sender;
import me.lucko.luckperms.commands.SubCommand;
import me.lucko.luckperms.commands.*;
import me.lucko.luckperms.constants.Message;
import me.lucko.luckperms.constants.Permission;
import me.lucko.luckperms.data.LogEntry;
@ -38,8 +35,14 @@ import java.util.List;
public class GroupRemovePrefix extends SubCommand<Group> {
public GroupRemovePrefix() {
super("removeprefix", "Removes a prefix from a group", "<priority> <prefix> [server] [world]",
Permission.GROUP_REMOVEPREFIX, Predicate.notInRange(2, 4));
super("removeprefix", "Removes a prefix from the group", Permission.GROUP_REMOVEPREFIX, Predicate.notInRange(2, 4),
Arg.list(
Arg.create("priority", true, "the priority to remove the prefix at"),
Arg.create("prefix", true, "the prefix string to remove"),
Arg.create("server", false, "the server to remove the prefix on"),
Arg.create("world", false, "the world to remove the prefix on")
)
);
}
@Override

View File

@ -23,10 +23,7 @@
package me.lucko.luckperms.commands.group.subcommands;
import me.lucko.luckperms.LuckPermsPlugin;
import me.lucko.luckperms.commands.CommandResult;
import me.lucko.luckperms.commands.Predicate;
import me.lucko.luckperms.commands.Sender;
import me.lucko.luckperms.commands.SubCommand;
import me.lucko.luckperms.commands.*;
import me.lucko.luckperms.constants.Message;
import me.lucko.luckperms.constants.Permission;
import me.lucko.luckperms.data.LogEntry;
@ -38,8 +35,14 @@ import java.util.List;
public class GroupRemoveSuffix extends SubCommand<Group> {
public GroupRemoveSuffix() {
super("removesuffix", "Removes a suffix from a group", "<priority> <suffix> [server] [world]",
Permission.GROUP_REMOVESUFFIX, Predicate.notInRange(2, 4));
super("removesuffix", "Removes a suffix from the group", Permission.GROUP_REMOVESUFFIX, Predicate.notInRange(2, 4),
Arg.list(
Arg.create("priority", true, "the priority to remove the suffix at"),
Arg.create("suffix", true, "the suffix string to remove"),
Arg.create("server", false, "the server to remove the suffix on"),
Arg.create("world", false, "the world to remove the suffix on")
)
);
}
@Override

View File

@ -23,10 +23,7 @@
package me.lucko.luckperms.commands.group.subcommands;
import me.lucko.luckperms.LuckPermsPlugin;
import me.lucko.luckperms.commands.CommandResult;
import me.lucko.luckperms.commands.Predicate;
import me.lucko.luckperms.commands.Sender;
import me.lucko.luckperms.commands.SubCommand;
import me.lucko.luckperms.commands.*;
import me.lucko.luckperms.constants.Message;
import me.lucko.luckperms.constants.Permission;
import me.lucko.luckperms.data.LogEntry;
@ -38,8 +35,15 @@ import java.util.List;
public class GroupRemoveTempPrefix extends SubCommand<Group> {
public GroupRemoveTempPrefix() {
super("removetempprefix", "Removes a temporary prefix from a group", "<priority> <prefix> [server] [world]",
Permission.GROUP_REMOVE_TEMP_PREFIX, Predicate.notInRange(2, 4));
super("removetempprefix", "Removes a temporary prefix from the group", Permission.GROUP_REMOVE_TEMP_PREFIX,
Predicate.notInRange(2, 4),
Arg.list(
Arg.create("priority", true, "the priority to remove the prefix at"),
Arg.create("prefix", true, "the prefix string to remove"),
Arg.create("server", false, "the server to remove the prefix on"),
Arg.create("world", false, "the world to remove the prefix on")
)
);
}
@Override

View File

@ -23,10 +23,7 @@
package me.lucko.luckperms.commands.group.subcommands;
import me.lucko.luckperms.LuckPermsPlugin;
import me.lucko.luckperms.commands.CommandResult;
import me.lucko.luckperms.commands.Predicate;
import me.lucko.luckperms.commands.Sender;
import me.lucko.luckperms.commands.SubCommand;
import me.lucko.luckperms.commands.*;
import me.lucko.luckperms.constants.Message;
import me.lucko.luckperms.constants.Permission;
import me.lucko.luckperms.data.LogEntry;
@ -38,8 +35,15 @@ import java.util.List;
public class GroupRemoveTempSuffix extends SubCommand<Group> {
public GroupRemoveTempSuffix() {
super("removetempsuffix", "Removes a temporary suffix from a group", "<priority> <suffix> [server] [world]",
Permission.GROUP_REMOVE_TEMP_SUFFIX, Predicate.notInRange(2, 4));
super("removetempsuffix", "Removes a temporary suffix from the group", Permission.GROUP_REMOVE_TEMP_SUFFIX,
Predicate.notInRange(2, 4),
Arg.list(
Arg.create("priority", true, "the priority to remove the suffix at"),
Arg.create("suffix", true, "the suffix string to remove"),
Arg.create("server", false, "the server to remove the suffix on"),
Arg.create("world", false, "the world to remove the suffix on")
)
);
}
@Override

View File

@ -23,10 +23,7 @@
package me.lucko.luckperms.commands.group.subcommands;
import me.lucko.luckperms.LuckPermsPlugin;
import me.lucko.luckperms.commands.CommandResult;
import me.lucko.luckperms.commands.Predicate;
import me.lucko.luckperms.commands.Sender;
import me.lucko.luckperms.commands.SubCommand;
import me.lucko.luckperms.commands.*;
import me.lucko.luckperms.constants.Message;
import me.lucko.luckperms.constants.Permission;
import me.lucko.luckperms.data.LogEntry;
@ -37,7 +34,9 @@ import java.util.List;
public class GroupRename extends SubCommand<Group> {
public GroupRename() {
super("rename", "Rename this group", "<new name>", Permission.TRACK_APPEND, Predicate.not(1));
super("rename", "Rename the group", Permission.TRACK_APPEND, Predicate.not(1),
Arg.list(Arg.create("name", true, "the new name"))
);
}
@Override

View File

@ -23,10 +23,7 @@
package me.lucko.luckperms.commands.group.subcommands;
import me.lucko.luckperms.LuckPermsPlugin;
import me.lucko.luckperms.commands.CommandResult;
import me.lucko.luckperms.commands.Predicate;
import me.lucko.luckperms.commands.Sender;
import me.lucko.luckperms.commands.SubCommand;
import me.lucko.luckperms.commands.*;
import me.lucko.luckperms.constants.Message;
import me.lucko.luckperms.constants.Permission;
import me.lucko.luckperms.data.LogEntry;
@ -38,8 +35,14 @@ import java.util.List;
public class GroupSetInherit extends SubCommand<Group> {
public GroupSetInherit() {
super("setinherit", "Sets another group for this group to inherit permissions from", "<group> [server] [world]",
Permission.GROUP_SETINHERIT, Predicate.notInRange(1, 3));
super("setinherit", "Sets another group for the group to inherit permissions from",
Permission.GROUP_SETINHERIT, Predicate.notInRange(1, 3),
Arg.list(
Arg.create("group", true, "the group to inherit from"),
Arg.create("server", false, "the server to inherit the group on"),
Arg.create("world", false, "the world to inherit the group on")
)
);
}
@Override
@ -47,7 +50,7 @@ public class GroupSetInherit extends SubCommand<Group> {
String groupName = args.get(0).toLowerCase();
if (ArgumentChecker.checkNode(groupName)) {
sendUsage(sender);
sendDetailedUsage(sender);
return CommandResult.INVALID_ARGS;
}

View File

@ -23,10 +23,7 @@
package me.lucko.luckperms.commands.group.subcommands;
import me.lucko.luckperms.LuckPermsPlugin;
import me.lucko.luckperms.commands.CommandResult;
import me.lucko.luckperms.commands.Predicate;
import me.lucko.luckperms.commands.Sender;
import me.lucko.luckperms.commands.SubCommand;
import me.lucko.luckperms.commands.*;
import me.lucko.luckperms.constants.Message;
import me.lucko.luckperms.constants.Permission;
import me.lucko.luckperms.data.LogEntry;
@ -38,8 +35,14 @@ import java.util.List;
public class GroupSetPermission extends SubCommand<Group> {
public GroupSetPermission() {
super("set", "Sets a permission for a group", "<node> <true|false> [server] [world]", Permission.GROUP_SETPERMISSION,
Predicate.notInRange(2, 4));
super("set", "Sets a permission for the group", Permission.GROUP_SETPERMISSION, Predicate.notInRange(2, 4),
Arg.list(
Arg.create("node", true, "the permission node to set"),
Arg.create("true|false", true, "the value of the node"),
Arg.create("server", false, "the server to add the permission node on"),
Arg.create("world", false, "the world to add the permission node on")
)
);
}
@Override
@ -48,7 +51,7 @@ public class GroupSetPermission extends SubCommand<Group> {
String bool = args.get(1).toLowerCase();
if (ArgumentChecker.checkNode(node)) {
sendUsage(sender);
sendDetailedUsage(sender);
return CommandResult.INVALID_ARGS;
}
@ -58,7 +61,7 @@ public class GroupSetPermission extends SubCommand<Group> {
}
if (!bool.equalsIgnoreCase("true") && !bool.equalsIgnoreCase("false")) {
sendUsage(sender);
sendDetailedUsage(sender);
return CommandResult.INVALID_ARGS;
}

View File

@ -23,10 +23,7 @@
package me.lucko.luckperms.commands.group.subcommands;
import me.lucko.luckperms.LuckPermsPlugin;
import me.lucko.luckperms.commands.CommandResult;
import me.lucko.luckperms.commands.Predicate;
import me.lucko.luckperms.commands.Sender;
import me.lucko.luckperms.commands.SubCommand;
import me.lucko.luckperms.commands.*;
import me.lucko.luckperms.constants.Message;
import me.lucko.luckperms.constants.Permission;
import me.lucko.luckperms.data.LogEntry;
@ -39,8 +36,15 @@ import java.util.List;
public class GroupSetTempInherit extends SubCommand<Group> {
public GroupSetTempInherit() {
super("settempinherit", "Sets another group for this group to inherit permissions from temporarily",
"<group> <duration> [server] [world]", Permission.GROUP_SET_TEMP_INHERIT, Predicate.notInRange(2, 4));
super("settempinherit", "Sets another group for the group to inherit permissions from temporarily",
Permission.GROUP_SET_TEMP_INHERIT, Predicate.notInRange(2, 4),
Arg.list(
Arg.create("group", true, "the group to inherit from"),
Arg.create("duration", true, "the duration of the group membership"),
Arg.create("server", false, "the server to add the group on"),
Arg.create("world", false, "the world to add the group on")
)
);
}
@Override
@ -48,7 +52,7 @@ public class GroupSetTempInherit extends SubCommand<Group> {
String groupName = args.get(0).toLowerCase();
if (ArgumentChecker.checkNode(groupName)) {
sendUsage(sender);
sendDetailedUsage(sender);
return CommandResult.INVALID_ARGS;
}

View File

@ -23,10 +23,7 @@
package me.lucko.luckperms.commands.group.subcommands;
import me.lucko.luckperms.LuckPermsPlugin;
import me.lucko.luckperms.commands.CommandResult;
import me.lucko.luckperms.commands.Predicate;
import me.lucko.luckperms.commands.Sender;
import me.lucko.luckperms.commands.SubCommand;
import me.lucko.luckperms.commands.*;
import me.lucko.luckperms.constants.Message;
import me.lucko.luckperms.constants.Permission;
import me.lucko.luckperms.data.LogEntry;
@ -39,8 +36,16 @@ import java.util.List;
public class GroupSetTempPermission extends SubCommand<Group> {
public GroupSetTempPermission() {
super("settemp", "Sets a temporary permission for a group", "<node> <true|false> <duration> [server] [world]",
Permission.GROUP_SET_TEMP_PERMISSION, Predicate.notInRange(3, 5));
super("settemp", "Sets a permission for the group temporarily", Permission.GROUP_SET_TEMP_PERMISSION,
Predicate.notInRange(3, 5),
Arg.list(
Arg.create("node", true, "the permission node to set"),
Arg.create("true|false", true, "the value of the node"),
Arg.create("duration", true, "the duration until the permission node expires"),
Arg.create("server", false, "the server to add the permission node on"),
Arg.create("world", false, "the world to add the permission node on")
)
);
}
@Override
@ -49,7 +54,7 @@ public class GroupSetTempPermission extends SubCommand<Group> {
String bool = args.get(1).toLowerCase();
if (ArgumentChecker.checkNode(node)) {
sendUsage(sender);
sendDetailedUsage(sender);
return CommandResult.INVALID_ARGS;
}
@ -59,7 +64,7 @@ public class GroupSetTempPermission extends SubCommand<Group> {
}
if (!bool.equalsIgnoreCase("true") && !bool.equalsIgnoreCase("false")) {
sendUsage(sender);
sendDetailedUsage(sender);
return CommandResult.INVALID_ARGS;
}

View File

@ -34,7 +34,7 @@ import java.util.stream.Collectors;
public class GroupShowTracks extends SubCommand<Group> {
public GroupShowTracks() {
super("showtracks", "Lists the tracks that this group features on", "", Permission.GROUP_SHOWTRACKS, Predicate.alwaysFalse());
super("showtracks", "Lists the tracks that the group features on", Permission.GROUP_SHOWTRACKS, Predicate.alwaysFalse(), null);
}
@Override

View File

@ -23,10 +23,7 @@
package me.lucko.luckperms.commands.group.subcommands;
import me.lucko.luckperms.LuckPermsPlugin;
import me.lucko.luckperms.commands.CommandResult;
import me.lucko.luckperms.commands.Predicate;
import me.lucko.luckperms.commands.Sender;
import me.lucko.luckperms.commands.SubCommand;
import me.lucko.luckperms.commands.*;
import me.lucko.luckperms.constants.Message;
import me.lucko.luckperms.constants.Permission;
import me.lucko.luckperms.data.LogEntry;
@ -38,8 +35,13 @@ import java.util.List;
public class GroupUnSetPermission extends SubCommand<Group> {
public GroupUnSetPermission() {
super("unset", "Unsets a permission for a group", "<node> [server] [world]", Permission.GROUP_UNSETPERMISSION,
Predicate.notInRange(1, 3));
super("unset", "Unsets a permission for the group", Permission.GROUP_UNSETPERMISSION, Predicate.notInRange(1, 3),
Arg.list(
Arg.create("node", true, "the permission node to unset"),
Arg.create("server", false, "the server to remove the permission node on"),
Arg.create("world", false, "the world to remove the permission node on")
)
);
}
@Override
@ -47,7 +49,7 @@ public class GroupUnSetPermission extends SubCommand<Group> {
String node = args.get(0).replace("{SPACE}", " ");
if (ArgumentChecker.checkNode(node)) {
sendUsage(sender);
sendDetailedUsage(sender);
return CommandResult.INVALID_ARGS;
}

View File

@ -23,10 +23,7 @@
package me.lucko.luckperms.commands.group.subcommands;
import me.lucko.luckperms.LuckPermsPlugin;
import me.lucko.luckperms.commands.CommandResult;
import me.lucko.luckperms.commands.Predicate;
import me.lucko.luckperms.commands.Sender;
import me.lucko.luckperms.commands.SubCommand;
import me.lucko.luckperms.commands.*;
import me.lucko.luckperms.constants.Message;
import me.lucko.luckperms.constants.Permission;
import me.lucko.luckperms.data.LogEntry;
@ -38,8 +35,14 @@ import java.util.List;
public class GroupUnsetInherit extends SubCommand<Group> {
public GroupUnsetInherit() {
super("unsetinherit", "Unsets another group for this group to inherit permissions from",
"<group> [server] [world]", Permission.GROUP_UNSETINHERIT, Predicate.notInRange(1, 3));
super("unsetinherit", "Removes a previously set inheritance rule", Permission.GROUP_UNSETINHERIT,
Predicate.notInRange(1, 3),
Arg.list(
Arg.create("group", true, "the group to uninherit"),
Arg.create("server", false, "the server to remove the group on"),
Arg.create("world", false, "the world to remove the group on")
)
);
}
@Override
@ -47,7 +50,7 @@ public class GroupUnsetInherit extends SubCommand<Group> {
String groupName = args.get(0).toLowerCase();
if (ArgumentChecker.checkNode(groupName)) {
sendUsage(sender);
sendDetailedUsage(sender);
return CommandResult.INVALID_ARGS;
}

View File

@ -23,10 +23,7 @@
package me.lucko.luckperms.commands.group.subcommands;
import me.lucko.luckperms.LuckPermsPlugin;
import me.lucko.luckperms.commands.CommandResult;
import me.lucko.luckperms.commands.Predicate;
import me.lucko.luckperms.commands.Sender;
import me.lucko.luckperms.commands.SubCommand;
import me.lucko.luckperms.commands.*;
import me.lucko.luckperms.constants.Message;
import me.lucko.luckperms.constants.Permission;
import me.lucko.luckperms.data.LogEntry;
@ -38,8 +35,14 @@ import java.util.List;
public class GroupUnsetTempInherit extends SubCommand<Group> {
public GroupUnsetTempInherit() {
super("unsettempinherit", "Unsets another group for this group to inherit permissions from",
"<group> [server] [world]", Permission.GROUP_UNSET_TEMP_INHERIT, Predicate.notInRange(1, 3));
super("unsettempinherit", "Removes a previously set temporary inheritance rule",
Permission.GROUP_UNSET_TEMP_INHERIT, Predicate.notInRange(1, 3),
Arg.list(
Arg.create("group", true, "the group to uninherit"),
Arg.create("server", false, "the server to remove the group on"),
Arg.create("world", false, "the world to remove the group on")
)
);
}
@Override
@ -47,7 +50,7 @@ public class GroupUnsetTempInherit extends SubCommand<Group> {
String groupName = args.get(0).toLowerCase();
if (ArgumentChecker.checkNode(groupName)) {
sendUsage(sender);
sendDetailedUsage(sender);
return CommandResult.INVALID_ARGS;
}

View File

@ -23,10 +23,7 @@
package me.lucko.luckperms.commands.group.subcommands;
import me.lucko.luckperms.LuckPermsPlugin;
import me.lucko.luckperms.commands.CommandResult;
import me.lucko.luckperms.commands.Predicate;
import me.lucko.luckperms.commands.Sender;
import me.lucko.luckperms.commands.SubCommand;
import me.lucko.luckperms.commands.*;
import me.lucko.luckperms.constants.Message;
import me.lucko.luckperms.constants.Permission;
import me.lucko.luckperms.data.LogEntry;
@ -38,8 +35,14 @@ import java.util.List;
public class GroupUnsetTempPermission extends SubCommand<Group> {
public GroupUnsetTempPermission() {
super("unsettemp", "Unsets a temporary permission for a group", "<node> [server] [world]",
Permission.GROUP_UNSET_TEMP_PERMISSION, Predicate.notInRange(1, 3));
super("unsettemp", "Unsets a temporary permission for the group", Permission.GROUP_UNSET_TEMP_PERMISSION,
Predicate.notInRange(1, 3),
Arg.list(
Arg.create("node", true, "the permission node to unset"),
Arg.create("server", false, "the server to remove the permission node on"),
Arg.create("world", false, "the world to remove the permission node on")
)
);
}
@Override
@ -47,7 +50,7 @@ public class GroupUnsetTempPermission extends SubCommand<Group> {
String node = args.get(0).replace("{SPACE}", " ");
if (ArgumentChecker.checkNode(node)) {
sendUsage(sender);
sendDetailedUsage(sender);
return CommandResult.INVALID_ARGS;
}

View File

@ -24,10 +24,7 @@ package me.lucko.luckperms.commands.log.subcommands;
import me.lucko.luckperms.LuckPermsPlugin;
import me.lucko.luckperms.api.LogEntry;
import me.lucko.luckperms.commands.CommandResult;
import me.lucko.luckperms.commands.Predicate;
import me.lucko.luckperms.commands.Sender;
import me.lucko.luckperms.commands.SubCommand;
import me.lucko.luckperms.commands.*;
import me.lucko.luckperms.constants.Message;
import me.lucko.luckperms.constants.Permission;
import me.lucko.luckperms.data.Log;
@ -41,7 +38,9 @@ import java.util.List;
public class LogExport extends SubCommand<Log> {
public LogExport() {
super("export", "Export the log to a file", "<file>", Permission.LOG_EXPORT, Predicate.not(1));
super("export", "Export the log to a file", Permission.LOG_EXPORT, Predicate.not(1),
Arg.list(Arg.create("file", true, "the name of the file"))
);
}
@Override

View File

@ -24,10 +24,7 @@ package me.lucko.luckperms.commands.log.subcommands;
import me.lucko.luckperms.LuckPermsPlugin;
import me.lucko.luckperms.api.LogEntry;
import me.lucko.luckperms.commands.CommandResult;
import me.lucko.luckperms.commands.Predicate;
import me.lucko.luckperms.commands.Sender;
import me.lucko.luckperms.commands.SubCommand;
import me.lucko.luckperms.commands.*;
import me.lucko.luckperms.constants.Message;
import me.lucko.luckperms.constants.Permission;
import me.lucko.luckperms.data.Log;
@ -40,8 +37,12 @@ import java.util.SortedMap;
public class LogGroupHistory extends SubCommand<Log> {
public LogGroupHistory() {
super("grouphistory", "View an objects history", "<group> [page]", Permission.LOG_GROUP_HISTORY,
Predicate.notInRange(1, 2));
super("grouphistory", "View an group's history", Permission.LOG_GROUP_HISTORY, Predicate.notInRange(1, 2),
Arg.list(
Arg.create("group", true, "the name of the group"),
Arg.create("page", false, "the page number to view")
)
);
}
@Override

View File

@ -23,10 +23,7 @@
package me.lucko.luckperms.commands.log.subcommands;
import me.lucko.luckperms.LuckPermsPlugin;
import me.lucko.luckperms.commands.CommandResult;
import me.lucko.luckperms.commands.Predicate;
import me.lucko.luckperms.commands.Sender;
import me.lucko.luckperms.commands.SubCommand;
import me.lucko.luckperms.commands.*;
import me.lucko.luckperms.constants.Message;
import me.lucko.luckperms.constants.Permission;
import me.lucko.luckperms.data.Log;
@ -37,7 +34,9 @@ import java.util.UUID;
public class LogNotify extends SubCommand<Log> {
public LogNotify() {
super("notify", "Toggle notifications", "[on|off]", Permission.LOG_NOTIFY, Predicate.notInRange(0, 1));
super("notify", "Toggle notifications", Permission.LOG_NOTIFY, Predicate.notInRange(0, 1),
Arg.list(Arg.create("on|off", false, "whether to toggle on or off"))
);
}
@Override

View File

@ -38,7 +38,12 @@ import java.util.UUID;
public class LogRecent extends SubCommand<Log> {
public LogRecent() {
super("recent", "View recent actions", "[user] [page]", Permission.LOG_RECENT, Predicate.notInRange(0, 2));
super("recent", "View recent actions", Permission.LOG_RECENT, Predicate.notInRange(0, 2),
Arg.list(
Arg.create("user", false, "the name/uuid of the user to filter by"),
Arg.create("page", false, "the page number to view")
)
);
}
@Override

View File

@ -24,10 +24,7 @@ package me.lucko.luckperms.commands.log.subcommands;
import me.lucko.luckperms.LuckPermsPlugin;
import me.lucko.luckperms.api.LogEntry;
import me.lucko.luckperms.commands.CommandResult;
import me.lucko.luckperms.commands.Predicate;
import me.lucko.luckperms.commands.Sender;
import me.lucko.luckperms.commands.SubCommand;
import me.lucko.luckperms.commands.*;
import me.lucko.luckperms.constants.Message;
import me.lucko.luckperms.constants.Permission;
import me.lucko.luckperms.data.Log;
@ -40,7 +37,12 @@ import java.util.stream.Collectors;
public class LogSearch extends SubCommand<Log> {
public LogSearch() {
super("search", "Search the log for an entry", "<query> [page]", Permission.LOG_SEARCH, Predicate.is(0));
super("search", "Search the log for an entry", Permission.LOG_SEARCH, Predicate.is(0),
Arg.list(
Arg.create("query", true, "the query to search by"),
Arg.create("page", false, "the page number to view")
)
);
}
@Override

View File

@ -24,10 +24,7 @@ package me.lucko.luckperms.commands.log.subcommands;
import me.lucko.luckperms.LuckPermsPlugin;
import me.lucko.luckperms.api.LogEntry;
import me.lucko.luckperms.commands.CommandResult;
import me.lucko.luckperms.commands.Predicate;
import me.lucko.luckperms.commands.Sender;
import me.lucko.luckperms.commands.SubCommand;
import me.lucko.luckperms.commands.*;
import me.lucko.luckperms.constants.Message;
import me.lucko.luckperms.constants.Permission;
import me.lucko.luckperms.data.Log;
@ -40,7 +37,12 @@ import java.util.SortedMap;
public class LogTrackHistory extends SubCommand<Log> {
public LogTrackHistory() {
super("trackhistory", "View an objects history", "<track> [page]", Permission.LOG_TRACK_HISTORY, Predicate.notInRange(1, 2));
super("trackhistory", "View a track's history", Permission.LOG_TRACK_HISTORY, Predicate.notInRange(1, 2),
Arg.list(
Arg.create("track", true, "the name of the track"),
Arg.create("page", false, "the page number to view")
)
);
}
@Override

View File

@ -38,7 +38,12 @@ import java.util.UUID;
public class LogUserHistory extends SubCommand<Log> {
public LogUserHistory() {
super("userhistory", "View an objects history", "<user> [page]", Permission.LOG_USER_HISTORY, Predicate.notInRange(1, 2));
super("userhistory", "View a user's history", Permission.LOG_USER_HISTORY, Predicate.notInRange(1, 2),
Arg.list(
Arg.create("user", true, "the name/uuid of the user"),
Arg.create("page", false, "the page number to view")
)
);
}
@Override

View File

@ -82,7 +82,7 @@ public class MigrationBPermissions extends SubCommand<Object> {
}
public MigrationBPermissions() {
super("bpermissions", "Migration from bPermissions", "", MIGRATION, Predicate.alwaysFalse());
super("bpermissions", "Migration from bPermissions", MIGRATION, Predicate.alwaysFalse(), null);
}
@Override

View File

@ -43,7 +43,7 @@ import java.util.Map;
*/
public class MigrationBungeePerms extends SubCommand<Object> {
public MigrationBungeePerms() {
super("bungeeperms", "Migration from BungeePerms", "", Permission.MIGRATION, Predicate.alwaysFalse());
super("bungeeperms", "Migration from BungeePerms", Permission.MIGRATION, Predicate.alwaysFalse(), null);
}
@Override

View File

@ -24,10 +24,7 @@ package me.lucko.luckperms.commands.migration.subcommands;
import me.lucko.luckperms.LuckPermsPlugin;
import me.lucko.luckperms.api.Logger;
import me.lucko.luckperms.commands.CommandResult;
import me.lucko.luckperms.commands.Predicate;
import me.lucko.luckperms.commands.Sender;
import me.lucko.luckperms.commands.SubCommand;
import me.lucko.luckperms.commands.*;
import me.lucko.luckperms.constants.Constants;
import me.lucko.luckperms.constants.Permission;
import me.lucko.luckperms.data.LogEntry;
@ -45,7 +42,9 @@ import java.util.stream.Collectors;
public class MigrationGroupManager extends SubCommand<Object> {
public MigrationGroupManager() {
super("groupmanager", "Migration from GroupManager", "[world names...]", Permission.MIGRATION, Predicate.is(0));
super("groupmanager", "Migration from GroupManager", Permission.MIGRATION, Predicate.is(0),
Arg.list(Arg.create("world names...", false, "a list of worlds to migrate permissions from"))
);
}
@Override

View File

@ -25,10 +25,7 @@ package me.lucko.luckperms.commands.migration.subcommands;
import me.lucko.luckperms.LuckPermsPlugin;
import me.lucko.luckperms.api.Logger;
import me.lucko.luckperms.api.PlatformType;
import me.lucko.luckperms.commands.CommandResult;
import me.lucko.luckperms.commands.Predicate;
import me.lucko.luckperms.commands.Sender;
import me.lucko.luckperms.commands.SubCommand;
import me.lucko.luckperms.commands.*;
import me.lucko.luckperms.constants.Constants;
import me.lucko.luckperms.constants.Permission;
import me.lucko.luckperms.data.LogEntry;
@ -50,7 +47,9 @@ import java.util.stream.Collectors;
public class MigrationPermissionsEx extends SubCommand<Object> {
public MigrationPermissionsEx() {
super("permissionsex", "Migration from PermissionsEx", "[world names...]", Permission.MIGRATION, Predicate.alwaysFalse());
super("permissionsex", "Migration from PermissionsEx", Permission.MIGRATION, Predicate.alwaysFalse(),
Arg.list(Arg.create("world names...", false, "a list of worlds to migrate permissions from"))
);
}
@SuppressWarnings("deprecation")

View File

@ -29,10 +29,7 @@ import lombok.Cleanup;
import me.lucko.luckperms.LuckPermsPlugin;
import me.lucko.luckperms.api.Logger;
import me.lucko.luckperms.api.data.Callback;
import me.lucko.luckperms.commands.CommandResult;
import me.lucko.luckperms.commands.Predicate;
import me.lucko.luckperms.commands.Sender;
import me.lucko.luckperms.commands.SubCommand;
import me.lucko.luckperms.commands.*;
import me.lucko.luckperms.commands.migration.subcommands.utils.LPResultRunnable;
import me.lucko.luckperms.constants.Constants;
import me.lucko.luckperms.core.PermissionHolder;
@ -119,8 +116,15 @@ public class MigrationPowerfulPerms extends SubCommand<Object> {
public MigrationPowerfulPerms() {
super("powerfulperms", "Migration from PowerfulPerms", "<address> <database> <username> <password> <db table>",
MIGRATION, Predicate.not(5));
super("powerfulperms", "Migration from PowerfulPerms", MIGRATION, Predicate.not(5),
Arg.list(
Arg.create("address", true, "the address of the PP database"),
Arg.create("database", true, "the name of the PP database"),
Arg.create("username", true, "the username to log into the DB"),
Arg.create("password", true, "the password to log into the DB"),
Arg.create("db table", true, "the name of the PP table where player data is stored")
)
);
}
@Override

View File

@ -24,10 +24,7 @@ package me.lucko.luckperms.commands.migration.subcommands;
import me.lucko.luckperms.LuckPermsPlugin;
import me.lucko.luckperms.api.Logger;
import me.lucko.luckperms.commands.CommandResult;
import me.lucko.luckperms.commands.Predicate;
import me.lucko.luckperms.commands.Sender;
import me.lucko.luckperms.commands.SubCommand;
import me.lucko.luckperms.commands.*;
import me.lucko.luckperms.constants.Constants;
import me.lucko.luckperms.constants.Permission;
import me.lucko.luckperms.data.LogEntry;
@ -49,7 +46,9 @@ import java.util.stream.Collectors;
*/
public class MigrationZPermissions extends SubCommand<Object> {
public MigrationZPermissions() {
super("zpermissions", "Migration from zPermissions", "[world names...]", Permission.MIGRATION, Predicate.alwaysFalse());
super("zpermissions", "Migration from zPermissions", Permission.MIGRATION, Predicate.alwaysFalse(),
Arg.list(Arg.create("world names...", false, "a list of worlds to migrate permissions from"))
);
}
@Override

View File

@ -36,7 +36,9 @@ import java.util.List;
public class TrackAppend extends SubCommand<Track> {
public TrackAppend() {
super("append", "Appends a group onto the end of the track", "<group>", Permission.TRACK_APPEND, Predicate.not(1));
super("append", "Appends a group onto the end of the track", Permission.TRACK_APPEND, Predicate.not(1),
Arg.list(Arg.create("group", true, "the group to append"))
);
}
@Override
@ -44,7 +46,7 @@ public class TrackAppend extends SubCommand<Track> {
String groupName = args.get(0).toLowerCase();
if (ArgumentChecker.checkNode(groupName)) {
sendUsage(sender);
sendDetailedUsage(sender);
return CommandResult.INVALID_ARGS;
}

View File

@ -36,7 +36,7 @@ import java.util.List;
public class TrackClear extends SubCommand<Track> {
public TrackClear() {
super("clear", "Clears the groups on the track", "", Permission.TRACK_CLEAR, Predicate.alwaysFalse());
super("clear", "Clears the groups on the track", Permission.TRACK_CLEAR, Predicate.alwaysFalse(), null);
}
@Override

View File

@ -32,7 +32,7 @@ import java.util.List;
public class TrackInfo extends SubCommand<Track> {
public TrackInfo() {
super("info", "Gives info about the track", "", Permission.TRACK_INFO, Predicate.alwaysFalse());
super("info", "Gives info about the track", Permission.TRACK_INFO, Predicate.alwaysFalse(), null);
}
@Override

View File

@ -36,8 +36,12 @@ import java.util.List;
public class TrackInsert extends SubCommand<Track> {
public TrackInsert() {
super("insert", "Inserts a group at a given position along the track", "<group> <position>",
Permission.TRACK_INSERT, Predicate.not(2));
super("insert", "Inserts a group at a given position along the track", Permission.TRACK_INSERT, Predicate.not(2),
Arg.list(
Arg.create("group", true, "the group to insert"),
Arg.create("position", true, "the position to insert the group at (the first position on the track is 1)")
)
);
}
@Override
@ -45,7 +49,7 @@ public class TrackInsert extends SubCommand<Track> {
String groupName = args.get(0).toLowerCase();
if (ArgumentChecker.checkNode(groupName)) {
sendUsage(sender);
sendDetailedUsage(sender);
return CommandResult.INVALID_ARGS;
}

View File

@ -35,7 +35,9 @@ import java.util.List;
public class TrackRemove extends SubCommand<Track> {
public TrackRemove() {
super("remove", "Removes a group from the track", "<group>", Permission.TRACK_REMOVE, Predicate.not(1));
super("remove", "Removes a group from the track", Permission.TRACK_REMOVE, Predicate.not(1),
Arg.list(Arg.create("group", true, "the group to remove"))
);
}
@Override
@ -43,7 +45,7 @@ public class TrackRemove extends SubCommand<Track> {
String groupName = args.get(0).toLowerCase();
if (ArgumentChecker.checkNode(groupName)) {
sendUsage(sender);
sendDetailedUsage(sender);
return CommandResult.INVALID_ARGS;
}

View File

@ -23,10 +23,7 @@
package me.lucko.luckperms.commands.track.subcommands;
import me.lucko.luckperms.LuckPermsPlugin;
import me.lucko.luckperms.commands.CommandResult;
import me.lucko.luckperms.commands.Predicate;
import me.lucko.luckperms.commands.Sender;
import me.lucko.luckperms.commands.SubCommand;
import me.lucko.luckperms.commands.*;
import me.lucko.luckperms.constants.Message;
import me.lucko.luckperms.constants.Permission;
import me.lucko.luckperms.data.LogEntry;
@ -37,7 +34,9 @@ import java.util.List;
public class TrackRename extends SubCommand<Track> {
public TrackRename() {
super("rename", "Rename this track", "<new name>", Permission.TRACK_APPEND, Predicate.not(1));
super("rename", "Rename the track", Permission.TRACK_APPEND, Predicate.not(1),
Arg.list(Arg.create("name", true, "the new name"))
);
}
@Override

View File

@ -23,10 +23,7 @@
package me.lucko.luckperms.commands.user.subcommands;
import me.lucko.luckperms.LuckPermsPlugin;
import me.lucko.luckperms.commands.CommandResult;
import me.lucko.luckperms.commands.Predicate;
import me.lucko.luckperms.commands.Sender;
import me.lucko.luckperms.commands.SubCommand;
import me.lucko.luckperms.commands.*;
import me.lucko.luckperms.constants.Message;
import me.lucko.luckperms.constants.Permission;
import me.lucko.luckperms.data.LogEntry;
@ -39,7 +36,13 @@ import java.util.List;
public class UserAddGroup extends SubCommand<User> {
public UserAddGroup() {
super("addgroup", "Adds the user to a group", "<group> [server] [world]", Permission.USER_ADDGROUP, Predicate.notInRange(1, 3));
super("addgroup", "Adds the user to a group", Permission.USER_ADDGROUP, Predicate.notInRange(1, 3),
Arg.list(
Arg.create("group", true, "the group to add the user to"),
Arg.create("server", false, "the server to add the group on"),
Arg.create("world", false, "the world to add the group on")
)
);
}
@Override
@ -47,7 +50,7 @@ public class UserAddGroup extends SubCommand<User> {
String groupName = args.get(0).toLowerCase();
if (ArgumentChecker.checkNode(groupName)) {
sendUsage(sender);
sendDetailedUsage(sender);
return CommandResult.INVALID_ARGS;
}

View File

@ -23,10 +23,7 @@
package me.lucko.luckperms.commands.user.subcommands;
import me.lucko.luckperms.LuckPermsPlugin;
import me.lucko.luckperms.commands.CommandResult;
import me.lucko.luckperms.commands.Predicate;
import me.lucko.luckperms.commands.Sender;
import me.lucko.luckperms.commands.SubCommand;
import me.lucko.luckperms.commands.*;
import me.lucko.luckperms.constants.Message;
import me.lucko.luckperms.constants.Permission;
import me.lucko.luckperms.data.LogEntry;
@ -38,8 +35,14 @@ import java.util.List;
public class UserAddPrefix extends SubCommand<User> {
public UserAddPrefix() {
super("addprefix", "Adds a prefix to the user", "<priority> <prefix> [server] [world]", Permission.USER_ADDPREFIX,
Predicate.notInRange(2, 4));
super("addprefix", "Adds a prefix to the user", Permission.USER_ADDPREFIX, Predicate.notInRange(2, 4),
Arg.list(
Arg.create("priority", true, "the priority to add the prefix at"),
Arg.create("prefix", true, "the prefix string"),
Arg.create("server", false, "the server to add the prefix on"),
Arg.create("world", false, "the world to add the prefix on")
)
);
}
@Override

View File

@ -23,10 +23,7 @@
package me.lucko.luckperms.commands.user.subcommands;
import me.lucko.luckperms.LuckPermsPlugin;
import me.lucko.luckperms.commands.CommandResult;
import me.lucko.luckperms.commands.Predicate;
import me.lucko.luckperms.commands.Sender;
import me.lucko.luckperms.commands.SubCommand;
import me.lucko.luckperms.commands.*;
import me.lucko.luckperms.constants.Message;
import me.lucko.luckperms.constants.Permission;
import me.lucko.luckperms.data.LogEntry;
@ -38,8 +35,14 @@ import java.util.List;
public class UserAddSuffix extends SubCommand<User> {
public UserAddSuffix() {
super("addsuffix", "Adds a suffix to the user", "<priority> <suffix> [server] [world]", Permission.USER_ADDSUFFIX,
Predicate.notInRange(2, 4));
super("addsuffix", "Adds a suffix to the user", Permission.USER_ADDSUFFIX, Predicate.notInRange(2, 4),
Arg.list(
Arg.create("priority", true, "the priority to add the suffix at"),
Arg.create("suffix", true, "the suffix string"),
Arg.create("server", false, "the server to add the suffix on"),
Arg.create("world", false, "the world to add the suffix on")
)
);
}
@Override

View File

@ -23,10 +23,7 @@
package me.lucko.luckperms.commands.user.subcommands;
import me.lucko.luckperms.LuckPermsPlugin;
import me.lucko.luckperms.commands.CommandResult;
import me.lucko.luckperms.commands.Predicate;
import me.lucko.luckperms.commands.Sender;
import me.lucko.luckperms.commands.SubCommand;
import me.lucko.luckperms.commands.*;
import me.lucko.luckperms.constants.Message;
import me.lucko.luckperms.constants.Permission;
import me.lucko.luckperms.data.LogEntry;
@ -40,8 +37,14 @@ import java.util.List;
public class UserAddTempGroup extends SubCommand<User> {
public UserAddTempGroup() {
super("addtempgroup", "Adds the user to a group temporarily", "<group> <duration> [server] [world]",
Permission.USER_ADDTEMPGROUP, Predicate.notInRange(2, 4));
super("addtempgroup", "Adds the user to a group temporarily", Permission.USER_ADDTEMPGROUP, Predicate.notInRange(2, 4),
Arg.list(
Arg.create("group", true, "the group to add the user to"),
Arg.create("duration", true, "the duration of the group membership"),
Arg.create("server", false, "the server to add the group on"),
Arg.create("world", false, "the world to add the group on")
)
);
}
@Override
@ -49,7 +52,7 @@ public class UserAddTempGroup extends SubCommand<User> {
String groupName = args.get(0).toLowerCase();
if (ArgumentChecker.checkNode(groupName)) {
sendUsage(sender);
sendDetailedUsage(sender);
return CommandResult.INVALID_ARGS;
}

View File

@ -23,10 +23,7 @@
package me.lucko.luckperms.commands.user.subcommands;
import me.lucko.luckperms.LuckPermsPlugin;
import me.lucko.luckperms.commands.CommandResult;
import me.lucko.luckperms.commands.Predicate;
import me.lucko.luckperms.commands.Sender;
import me.lucko.luckperms.commands.SubCommand;
import me.lucko.luckperms.commands.*;
import me.lucko.luckperms.constants.Message;
import me.lucko.luckperms.constants.Permission;
import me.lucko.luckperms.data.LogEntry;
@ -39,8 +36,15 @@ import java.util.List;
public class UserAddTempPrefix extends SubCommand<User> {
public UserAddTempPrefix() {
super("addtempprefix", "Adds a prefix to the user temporarily", "<priority> <prefix> <duration> [server] [world]",
Permission.USER_ADD_TEMP_PREFIX, Predicate.notInRange(3, 5));
super("addtempprefix", "Adds a prefix to the user temporarily", Permission.USER_ADD_TEMP_PREFIX, Predicate.notInRange(3, 5),
Arg.list(
Arg.create("priority", true, "the priority to add the prefix at"),
Arg.create("prefix", true, "the prefix string"),
Arg.create("duration", true, "the duration until the prefix expires"),
Arg.create("server", false, "the server to add the prefix on"),
Arg.create("world", false, "the world to add the prefix on")
)
);
}
@Override

View File

@ -23,10 +23,7 @@
package me.lucko.luckperms.commands.user.subcommands;
import me.lucko.luckperms.LuckPermsPlugin;
import me.lucko.luckperms.commands.CommandResult;
import me.lucko.luckperms.commands.Predicate;
import me.lucko.luckperms.commands.Sender;
import me.lucko.luckperms.commands.SubCommand;
import me.lucko.luckperms.commands.*;
import me.lucko.luckperms.constants.Message;
import me.lucko.luckperms.constants.Permission;
import me.lucko.luckperms.data.LogEntry;
@ -39,8 +36,15 @@ import java.util.List;
public class UserAddTempSuffix extends SubCommand<User> {
public UserAddTempSuffix() {
super("addtempsuffix", "Adds a suffix to the user temporarily", "<priority> <suffix> <duration> [server] [world]",
Permission.USER_ADD_TEMP_SUFFIX, Predicate.notInRange(3, 5));
super("addtempsuffix", "Adds a suffix to the user temporarily", Permission.USER_ADD_TEMP_SUFFIX, Predicate.notInRange(3, 5),
Arg.list(
Arg.create("priority", true, "the priority to add the suffix at"),
Arg.create("suffix", true, "the suffix string"),
Arg.create("duration", true, "the duration until the suffix expires"),
Arg.create("server", false, "the server to add the suffix on"),
Arg.create("world", false, "the world to add the suffix on")
)
);
}
@Override

View File

@ -24,10 +24,7 @@ package me.lucko.luckperms.commands.user.subcommands;
import me.lucko.luckperms.LuckPermsPlugin;
import me.lucko.luckperms.api.Node;
import me.lucko.luckperms.commands.CommandResult;
import me.lucko.luckperms.commands.Predicate;
import me.lucko.luckperms.commands.Sender;
import me.lucko.luckperms.commands.SubCommand;
import me.lucko.luckperms.commands.*;
import me.lucko.luckperms.constants.Message;
import me.lucko.luckperms.constants.Permission;
import me.lucko.luckperms.users.User;
@ -39,8 +36,13 @@ import java.util.Set;
public class UserBulkChange extends SubCommand<User> {
public UserBulkChange() {
super("bulkchange", "Applies a bulk permission change to the users permissions", "<server|world> <from> <to>",
Permission.USER_BULKCHANGE, Predicate.not(3));
super("bulkchange", "Applies a bulk permission change to the user's permissions", Permission.USER_BULKCHANGE, Predicate.not(3),
Arg.list(
Arg.create("server|world", true, "if the bulk change is modifying a 'server' or a 'world'"),
Arg.create("from", true, "the server/world to be changed from. can be 'global' or 'null' respectively"),
Arg.create("to", true, "the server/world to replace 'from' (can be 'null')")
)
);
}
@Override

View File

@ -38,7 +38,7 @@ import java.util.TreeSet;
public class UserChatMeta extends SubCommand<User> {
public UserChatMeta() {
super("chatmeta", "Displays a users chat meta", "", Permission.USER_CHATMETA, Predicate.alwaysFalse());
super("chatmeta", "Lists the user's chat meta", Permission.USER_CHATMETA, Predicate.alwaysFalse(), null);
}
@Override

View File

@ -36,7 +36,7 @@ import java.util.List;
public class UserClear extends SubCommand<User> {
public UserClear() {
super("clear", "Clears a users permissions and groups", "", Permission.USER_CLEAR, Predicate.alwaysFalse());
super("clear", "Clears the user's permissions and groups", Permission.USER_CLEAR, Predicate.alwaysFalse(), null);
}
@Override

View File

@ -41,7 +41,9 @@ import java.util.List;
public class UserDemote extends SubCommand<User> {
public UserDemote() {
super("demote", "Demotes a user along a track", "<track>", Permission.USER_DEMOTE, Predicate.not(1));
super("demote", "Demotes the user down a track", Permission.USER_DEMOTE, Predicate.not(1),
Arg.list(Arg.create("track", true, "the track to demote the user down"))
);
}
@Override

View File

@ -35,7 +35,7 @@ import java.util.List;
public class UserGetUUID extends SubCommand<User> {
public UserGetUUID() {
super("getuuid", "Get the UUID of a user", "", Permission.USER_GETUUID, Predicate.alwaysFalse());
super("getuuid", "Displays the user's internal LuckPerms unique id", Permission.USER_GETUUID, Predicate.alwaysFalse(), null);
}
@Override

View File

@ -33,8 +33,14 @@ import java.util.List;
public class UserHasPerm extends SubCommand<User> {
public UserHasPerm() {
super("haspermission", "Checks to see if a user has a certain permission node", "<node> [server] [world]",
Permission.USER_HASPERMISSION, Predicate.notInRange(1, 3));
super("haspermission", "Checks to see if the user has a certain permission node", Permission.USER_HASPERMISSION,
Predicate.notInRange(1, 3),
Arg.list(
Arg.create("node", true, "the permission node to check for"),
Arg.create("server", false, "the server to check on"),
Arg.create("world", false, "the world to check on")
)
);
}
@Override

View File

@ -35,7 +35,7 @@ import java.util.List;
public class UserInfo extends SubCommand<User> {
public UserInfo() {
super("info", "Gives info about the user", "", Permission.USER_INFO, Predicate.alwaysFalse());
super("info", "Shows info about the user", Permission.USER_INFO, Predicate.alwaysFalse(), null);
}
@Override

View File

@ -33,8 +33,14 @@ import java.util.List;
public class UserInheritsPerm extends SubCommand<User> {
public UserInheritsPerm() {
super("inheritspermission", "Checks to see if a user inherits a certain permission node",
"<node> [server] [world]", Permission.USER_INHERITSPERMISSION, Predicate.notInRange(1, 3));
super("inheritspermission", "Checks to see if the user inherits a certain permission node",
Permission.USER_INHERITSPERMISSION, Predicate.notInRange(1, 3),
Arg.list(
Arg.create("node", true, "the permission node to check for"),
Arg.create("server", false, "the server to check on"),
Arg.create("world", false, "the world to check on")
)
);
}
@Override

View File

@ -32,7 +32,7 @@ import java.util.List;
public class UserListGroups extends SubCommand<User> {
public UserListGroups() {
super("listgroups", "Lists the groups a user is in", "", Permission.USER_LISTGROUPS, Predicate.alwaysFalse());
super("listgroups", "Lists the groups the user is a member of", Permission.USER_LISTGROUPS, Predicate.alwaysFalse(), null);
}
@Override

View File

@ -32,7 +32,7 @@ import java.util.List;
public class UserListNodes extends SubCommand<User> {
public UserListNodes() {
super("listnodes", "Lists the permission nodes the user has", "", Permission.USER_LISTNODES, Predicate.alwaysFalse());
super("listnodes", "Lists the permission nodes the user has", Permission.USER_LISTNODES, Predicate.alwaysFalse(), null);
}
@Override

View File

@ -41,7 +41,9 @@ import java.util.List;
public class UserPromote extends SubCommand<User> {
public UserPromote() {
super("promote", "Promotes the user along a track", "<track>", Permission.USER_PROMOTE, Predicate.not(1));
super("promote", "Promotes the user up a track", Permission.USER_PROMOTE, Predicate.not(1),
Arg.list(Arg.create("track", true, "the track to promote the user up"))
);
}
@Override

View File

@ -23,10 +23,7 @@
package me.lucko.luckperms.commands.user.subcommands;
import me.lucko.luckperms.LuckPermsPlugin;
import me.lucko.luckperms.commands.CommandResult;
import me.lucko.luckperms.commands.Predicate;
import me.lucko.luckperms.commands.Sender;
import me.lucko.luckperms.commands.SubCommand;
import me.lucko.luckperms.commands.*;
import me.lucko.luckperms.constants.Message;
import me.lucko.luckperms.constants.Permission;
import me.lucko.luckperms.data.LogEntry;
@ -38,8 +35,13 @@ import java.util.List;
public class UserRemoveGroup extends SubCommand<User> {
public UserRemoveGroup() {
super("removegroup", "Removes a user from a group", "<group> [server] [world]", Permission.USER_REMOVEGROUP,
Predicate.notInRange(1, 3));
super("removegroup", "Removes the user from a group", Permission.USER_REMOVEGROUP, Predicate.notInRange(1, 3),
Arg.list(
Arg.create("group", true, "the group to remove the user from"),
Arg.create("server", false, "the server to remove the group on"),
Arg.create("world", false, "the world to remove the group on")
)
);
}
@Override
@ -47,7 +49,7 @@ public class UserRemoveGroup extends SubCommand<User> {
String groupName = args.get(0).toLowerCase();
if (ArgumentChecker.checkNode(groupName)) {
sendUsage(sender);
sendDetailedUsage(sender);
return CommandResult.INVALID_ARGS;
}

View File

@ -23,10 +23,7 @@
package me.lucko.luckperms.commands.user.subcommands;
import me.lucko.luckperms.LuckPermsPlugin;
import me.lucko.luckperms.commands.CommandResult;
import me.lucko.luckperms.commands.Predicate;
import me.lucko.luckperms.commands.Sender;
import me.lucko.luckperms.commands.SubCommand;
import me.lucko.luckperms.commands.*;
import me.lucko.luckperms.constants.Message;
import me.lucko.luckperms.constants.Permission;
import me.lucko.luckperms.data.LogEntry;
@ -38,8 +35,14 @@ import java.util.List;
public class UserRemovePrefix extends SubCommand<User> {
public UserRemovePrefix() {
super("removeprefix", "Removes a prefix from a user", "<priority> <prefix> [server] [world]",
Permission.USER_REMOVEPREFIX, Predicate.notInRange(2, 4));
super("removeprefix", "Removes a prefix from the user", Permission.USER_REMOVEPREFIX, Predicate.notInRange(2, 4),
Arg.list(
Arg.create("priority", true, "the priority to remove the prefix at"),
Arg.create("prefix", true, "the prefix string to remove"),
Arg.create("server", false, "the server to remove the prefix on"),
Arg.create("world", false, "the world to remove the prefix on")
)
);
}
@Override

View File

@ -23,10 +23,7 @@
package me.lucko.luckperms.commands.user.subcommands;
import me.lucko.luckperms.LuckPermsPlugin;
import me.lucko.luckperms.commands.CommandResult;
import me.lucko.luckperms.commands.Predicate;
import me.lucko.luckperms.commands.Sender;
import me.lucko.luckperms.commands.SubCommand;
import me.lucko.luckperms.commands.*;
import me.lucko.luckperms.constants.Message;
import me.lucko.luckperms.constants.Permission;
import me.lucko.luckperms.data.LogEntry;
@ -38,8 +35,14 @@ import java.util.List;
public class UserRemoveSuffix extends SubCommand<User> {
public UserRemoveSuffix() {
super("removesuffix", "Removes a suffix from a user", "<priority> <suffix> [server] [world]",
Permission.USER_REMOVESUFFIX, Predicate.notInRange(2, 4));
super("removesuffix", "Removes a suffix from the user", Permission.USER_REMOVESUFFIX, Predicate.notInRange(2, 4),
Arg.list(
Arg.create("priority", true, "the priority to remove the suffix at"),
Arg.create("suffix", true, "the suffix string to remove"),
Arg.create("server", false, "the server to remove the suffix on"),
Arg.create("world", false, "the world to remove the suffix on")
)
);
}
@Override

View File

@ -23,10 +23,7 @@
package me.lucko.luckperms.commands.user.subcommands;
import me.lucko.luckperms.LuckPermsPlugin;
import me.lucko.luckperms.commands.CommandResult;
import me.lucko.luckperms.commands.Predicate;
import me.lucko.luckperms.commands.Sender;
import me.lucko.luckperms.commands.SubCommand;
import me.lucko.luckperms.commands.*;
import me.lucko.luckperms.constants.Message;
import me.lucko.luckperms.constants.Permission;
import me.lucko.luckperms.data.LogEntry;
@ -38,8 +35,13 @@ import java.util.List;
public class UserRemoveTempGroup extends SubCommand<User> {
public UserRemoveTempGroup() {
super("removetempgroup", "Removes a user from a temporary group", "<group> [server] [world]",
Permission.USER_REMOVETEMPGROUP, Predicate.notInRange(1, 3));
super("removetempgroup", "Removes the user from a temporary group", Permission.USER_REMOVETEMPGROUP, Predicate.notInRange(1, 3),
Arg.list(
Arg.create("group", true, "the group to remove the user from"),
Arg.create("server", false, "the server to remove the group on"),
Arg.create("world", false, "the world to remove the group on")
)
);
}
@Override
@ -47,7 +49,7 @@ public class UserRemoveTempGroup extends SubCommand<User> {
String groupName = args.get(0).toLowerCase();
if (ArgumentChecker.checkNode(groupName)) {
sendUsage(sender);
sendDetailedUsage(sender);
return CommandResult.INVALID_ARGS;
}

View File

@ -23,10 +23,7 @@
package me.lucko.luckperms.commands.user.subcommands;
import me.lucko.luckperms.LuckPermsPlugin;
import me.lucko.luckperms.commands.CommandResult;
import me.lucko.luckperms.commands.Predicate;
import me.lucko.luckperms.commands.Sender;
import me.lucko.luckperms.commands.SubCommand;
import me.lucko.luckperms.commands.*;
import me.lucko.luckperms.constants.Message;
import me.lucko.luckperms.constants.Permission;
import me.lucko.luckperms.data.LogEntry;
@ -38,8 +35,15 @@ import java.util.List;
public class UserRemoveTempPrefix extends SubCommand<User> {
public UserRemoveTempPrefix() {
super("removetempprefix", "Removes a temporary prefix from a user", "<priority> <prefix> [server] [world]",
Permission.USER_REMOVE_TEMP_PREFIX, Predicate.notInRange(2, 4));
super("removetempprefix", "Removes the temporary prefix from a user", Permission.USER_REMOVE_TEMP_PREFIX,
Predicate.notInRange(2, 4),
Arg.list(
Arg.create("priority", true, "the priority to remove the prefix at"),
Arg.create("prefix", true, "the prefix string to remove"),
Arg.create("server", false, "the server to remove the prefix on"),
Arg.create("world", false, "the world to remove the prefix on")
)
);
}
@Override

View File

@ -23,10 +23,7 @@
package me.lucko.luckperms.commands.user.subcommands;
import me.lucko.luckperms.LuckPermsPlugin;
import me.lucko.luckperms.commands.CommandResult;
import me.lucko.luckperms.commands.Predicate;
import me.lucko.luckperms.commands.Sender;
import me.lucko.luckperms.commands.SubCommand;
import me.lucko.luckperms.commands.*;
import me.lucko.luckperms.constants.Message;
import me.lucko.luckperms.constants.Permission;
import me.lucko.luckperms.data.LogEntry;
@ -38,8 +35,15 @@ import java.util.List;
public class UserRemoveTempSuffix extends SubCommand<User> {
public UserRemoveTempSuffix() {
super("removetempsuffix", "Removes a temporary suffix from a user", "<priority> <suffix> [server] [world]",
Permission.USER_REMOVE_TEMP_SUFFIX, Predicate.notInRange(2, 4));
super("removetempsuffix", "Removes the temporary suffix from a user", Permission.USER_REMOVE_TEMP_SUFFIX,
Predicate.notInRange(2, 4),
Arg.list(
Arg.create("priority", true, "the priority to remove the suffix at"),
Arg.create("suffix", true, "the suffix string to remove"),
Arg.create("server", false, "the server to remove the suffix on"),
Arg.create("world", false, "the world to remove the suffix on")
)
);
}
@Override

View File

@ -23,10 +23,7 @@
package me.lucko.luckperms.commands.user.subcommands;
import me.lucko.luckperms.LuckPermsPlugin;
import me.lucko.luckperms.commands.CommandResult;
import me.lucko.luckperms.commands.Predicate;
import me.lucko.luckperms.commands.Sender;
import me.lucko.luckperms.commands.SubCommand;
import me.lucko.luckperms.commands.*;
import me.lucko.luckperms.constants.Message;
import me.lucko.luckperms.constants.Permission;
import me.lucko.luckperms.data.LogEntry;
@ -38,8 +35,14 @@ import java.util.List;
public class UserSetPermission extends SubCommand<User> {
public UserSetPermission() {
super("set", "Sets a permission for a user", "<node> <true|false> [server] [world]", Permission.USER_SETPERMISSION,
Predicate.notInRange(2, 4));
super("set", "Sets a permission for the user", Permission.USER_SETPERMISSION, Predicate.notInRange(2, 4),
Arg.list(
Arg.create("node", true, "the permission node to set"),
Arg.create("true|false", true, "the value of the node"),
Arg.create("server", false, "the server to add the permission node on"),
Arg.create("world", false, "the world to add the permission node on")
)
);
}
@Override
@ -48,7 +51,7 @@ public class UserSetPermission extends SubCommand<User> {
String bool = args.get(1).toLowerCase();
if (ArgumentChecker.checkNode(node)) {
sendUsage(sender);
sendDetailedUsage(sender);
return CommandResult.INVALID_ARGS;
}
@ -58,7 +61,7 @@ public class UserSetPermission extends SubCommand<User> {
}
if (!bool.equalsIgnoreCase("true") && !bool.equalsIgnoreCase("false")) {
sendUsage(sender);
sendDetailedUsage(sender);
return CommandResult.INVALID_ARGS;
}

View File

@ -23,10 +23,7 @@
package me.lucko.luckperms.commands.user.subcommands;
import me.lucko.luckperms.LuckPermsPlugin;
import me.lucko.luckperms.commands.CommandResult;
import me.lucko.luckperms.commands.Predicate;
import me.lucko.luckperms.commands.Sender;
import me.lucko.luckperms.commands.SubCommand;
import me.lucko.luckperms.commands.*;
import me.lucko.luckperms.constants.Message;
import me.lucko.luckperms.constants.Permission;
import me.lucko.luckperms.data.LogEntry;
@ -38,7 +35,9 @@ import java.util.List;
public class UserSetPrimaryGroup extends SubCommand<User> {
public UserSetPrimaryGroup() {
super("setprimarygroup", "Sets a users primary group", "<group>", Permission.USER_SETPRIMARYGROUP, Predicate.not(1));
super("setprimarygroup", "Sets the user's primary group", Permission.USER_SETPRIMARYGROUP, Predicate.not(1),
Arg.list(Arg.create("group", true, "the group to set as the primary group"))
);
}
@Override

View File

@ -23,10 +23,7 @@
package me.lucko.luckperms.commands.user.subcommands;
import me.lucko.luckperms.LuckPermsPlugin;
import me.lucko.luckperms.commands.CommandResult;
import me.lucko.luckperms.commands.Predicate;
import me.lucko.luckperms.commands.Sender;
import me.lucko.luckperms.commands.SubCommand;
import me.lucko.luckperms.commands.*;
import me.lucko.luckperms.constants.Message;
import me.lucko.luckperms.constants.Permission;
import me.lucko.luckperms.data.LogEntry;
@ -39,8 +36,16 @@ import java.util.List;
public class UserSetTempPermission extends SubCommand<User> {
public UserSetTempPermission() {
super("settemp", "Sets a temporary permission for a user", "<node> <true|false> <duration> [server] [world]",
Permission.USER_SET_TEMP_PERMISSION, Predicate.notInRange(3, 5));
super("settemp", "Sets a permission for the user temporarily", Permission.USER_SET_TEMP_PERMISSION,
Predicate.notInRange(3, 5),
Arg.list(
Arg.create("node", true, "the permission node to set"),
Arg.create("true|false", true, "the value of the node"),
Arg.create("duration", true, "the duration until the permission node expires"),
Arg.create("server", false, "the server to add the permission node on"),
Arg.create("world", false, "the world to add the permission node on")
)
);
}
@Override
@ -49,7 +54,7 @@ public class UserSetTempPermission extends SubCommand<User> {
String bool = args.get(1).toLowerCase();
if (ArgumentChecker.checkNode(node)) {
sendUsage(sender);
sendDetailedUsage(sender);
return CommandResult.INVALID_ARGS;
}
@ -59,7 +64,7 @@ public class UserSetTempPermission extends SubCommand<User> {
}
if (!bool.equalsIgnoreCase("true") && !bool.equalsIgnoreCase("false")) {
sendUsage(sender);
sendDetailedUsage(sender);
return CommandResult.INVALID_ARGS;
}

View File

@ -34,7 +34,9 @@ import java.util.List;
public class UserShowPos extends SubCommand<User> {
public UserShowPos() {
super("showpos", "Shows a users position on a track", "<track>", Permission.USER_SHOWPOS, Predicate.not(1));
super("showpos", "Shows the user's position on a track", Permission.USER_SHOWPOS, Predicate.not(1),
Arg.list(Arg.create("track", true, "the track name"))
);
}
@Override

View File

@ -34,8 +34,8 @@ import java.util.stream.Collectors;
public class UserShowTracks extends SubCommand<User> {
public UserShowTracks() {
super("showtracks", "Lists the tracks that this user's primary group features on", "", Permission.USER_SHOWTRACKS,
Predicate.alwaysFalse());
super("showtracks", "Lists the tracks that the user's primary group features on", Permission.USER_SHOWTRACKS,
Predicate.alwaysFalse(), null);
}
@Override

View File

@ -23,10 +23,7 @@
package me.lucko.luckperms.commands.user.subcommands;
import me.lucko.luckperms.LuckPermsPlugin;
import me.lucko.luckperms.commands.CommandResult;
import me.lucko.luckperms.commands.Predicate;
import me.lucko.luckperms.commands.Sender;
import me.lucko.luckperms.commands.SubCommand;
import me.lucko.luckperms.commands.*;
import me.lucko.luckperms.constants.Message;
import me.lucko.luckperms.constants.Permission;
import me.lucko.luckperms.data.LogEntry;
@ -38,8 +35,13 @@ import java.util.List;
public class UserUnSetPermission extends SubCommand<User> {
public UserUnSetPermission() {
super("unset", "Unsets a permission for a user", "<node> [server] [world]", Permission.USER_UNSETPERMISSION,
Predicate.notInRange(1, 3));
super("unset", "Unsets a permission for the user", Permission.USER_UNSETPERMISSION, Predicate.notInRange(1, 3),
Arg.list(
Arg.create("node", true, "the permission node to unset"),
Arg.create("server", false, "the server to remove the permission node on"),
Arg.create("world", false, "the world to remove the permission node on")
)
);
}
@Override
@ -47,7 +49,7 @@ public class UserUnSetPermission extends SubCommand<User> {
String node = args.get(0).replace("{SPACE}", " ");
if (ArgumentChecker.checkNode(node)) {
sendUsage(sender);
sendDetailedUsage(sender);
return CommandResult.INVALID_ARGS;
}

View File

@ -23,10 +23,7 @@
package me.lucko.luckperms.commands.user.subcommands;
import me.lucko.luckperms.LuckPermsPlugin;
import me.lucko.luckperms.commands.CommandResult;
import me.lucko.luckperms.commands.Predicate;
import me.lucko.luckperms.commands.Sender;
import me.lucko.luckperms.commands.SubCommand;
import me.lucko.luckperms.commands.*;
import me.lucko.luckperms.constants.Message;
import me.lucko.luckperms.constants.Permission;
import me.lucko.luckperms.data.LogEntry;
@ -38,8 +35,14 @@ import java.util.List;
public class UserUnsetTempPermission extends SubCommand<User> {
public UserUnsetTempPermission() {
super("unsettemp", "Unsets a temporary permission for a user", "<node> [server] [world]",
Permission.USER_UNSET_TEMP_PERMISSION, Predicate.notInRange(1, 3));
super("unsettemp", "Unsets a temporary permission for the user", Permission.USER_UNSET_TEMP_PERMISSION,
Predicate.notInRange(1, 3),
Arg.list(
Arg.create("node", true, "the permission node to unset"),
Arg.create("server", false, "the server to remove the permission node on"),
Arg.create("world", false, "the world to remove the permission node on")
)
);
}
@Override
@ -47,7 +50,7 @@ public class UserUnsetTempPermission extends SubCommand<User> {
String node = args.get(0).replace("{SPACE}", " ");
if (ArgumentChecker.checkNode(node)) {
sendUsage(sender);
sendDetailedUsage(sender);
return CommandResult.INVALID_ARGS;
}

View File

@ -24,10 +24,7 @@ package me.lucko.luckperms.commands.usersbulkedit.subcommands;
import me.lucko.luckperms.LuckPermsPlugin;
import me.lucko.luckperms.api.Node;
import me.lucko.luckperms.commands.CommandResult;
import me.lucko.luckperms.commands.Predicate;
import me.lucko.luckperms.commands.Sender;
import me.lucko.luckperms.commands.SubCommand;
import me.lucko.luckperms.commands.*;
import me.lucko.luckperms.constants.Message;
import me.lucko.luckperms.constants.Permission;
import me.lucko.luckperms.storage.Datastore;
@ -35,10 +32,17 @@ import me.lucko.luckperms.users.User;
import java.util.*;
// "<group|null> <server|world> <from> <to>",
public class BulkEditGroup extends SubCommand<Datastore> {
public BulkEditGroup() {
super("group", "Bulk edit group memberships", "<group|null> <server|world> <from> <to>", Permission.USER_BULKCHANGE,
Predicate.not(4));
super("group", "Bulk edit group memberships", Permission.USER_BULKCHANGE, Predicate.not(4),
Arg.list(
Arg.create("group|null", true, "the group to edit ('null' to select and edit all groups)"),
Arg.create("server|world", true, "if the bulk change is modifying a 'server' or a 'world'"),
Arg.create("from", true, "the server/world to be changed from. can be 'global' or 'null' respectively"),
Arg.create("to", true, "the server/world to replace 'from' (can be 'null')")
)
);
}
@Override

View File

@ -24,10 +24,7 @@ package me.lucko.luckperms.commands.usersbulkedit.subcommands;
import me.lucko.luckperms.LuckPermsPlugin;
import me.lucko.luckperms.api.Node;
import me.lucko.luckperms.commands.CommandResult;
import me.lucko.luckperms.commands.Predicate;
import me.lucko.luckperms.commands.Sender;
import me.lucko.luckperms.commands.SubCommand;
import me.lucko.luckperms.commands.*;
import me.lucko.luckperms.constants.Message;
import me.lucko.luckperms.constants.Permission;
import me.lucko.luckperms.storage.Datastore;
@ -37,8 +34,14 @@ import java.util.*;
public class BulkEditPermission extends SubCommand<Datastore> {
public BulkEditPermission() {
super("permission", "Bulk edit permissions", "<node|null> <server|world> <from> <to>", Permission.USER_BULKCHANGE,
Predicate.not(4));
super("permission", "Bulk edit permissions", Permission.USER_BULKCHANGE, Predicate.not(4),
Arg.list(
Arg.create("node|null", true, "the node to edit ('null' to select and edit all nodes)"),
Arg.create("server|world", true, "if the bulk change is modifying a 'server' or a 'world'"),
Arg.create("from", true, "the server/world to be changed from. can be 'global' or 'null' respectively"),
Arg.create("to", true, "the server/world to replace 'from' (can be 'null')")
)
);
}
@Override