Make command defintion/usage messages translatable
This commit is contained in:
parent
e50fa17f7c
commit
cf5318b92b
@ -288,3 +288,443 @@ import-end-error-header: >
|
||||
{PREFIX}&b(Import) &fOutput:
|
||||
import-end-error-content: "&b(Import) &b-> &c{0}"
|
||||
import-end-error-footer: "&b(Import) &7<------------------------------------------>"
|
||||
|
||||
command-specs:
|
||||
user:
|
||||
description: "User commands"
|
||||
usage: "/%s user <user>"
|
||||
group:
|
||||
description: "Group commands"
|
||||
usage: "/%s group <group>"
|
||||
track:
|
||||
description: "Track commands"
|
||||
usage: "/%s track <track>"
|
||||
log:
|
||||
description: "Log commands"
|
||||
usage: "/%s log"
|
||||
sync:
|
||||
description: "Sync changes with the storage"
|
||||
usage: "/%s sync"
|
||||
info:
|
||||
description: "Print general plugin info"
|
||||
usage: "/%s info"
|
||||
verbose:
|
||||
description: "Manage verbose permission checking"
|
||||
usage: "/%s verbose <true|false> [filter]"
|
||||
args:
|
||||
"on|record|off|paste": "whether to enable/disable logging, or to paste the logged output"
|
||||
"filter": "the filter to match entries against"
|
||||
tree:
|
||||
description: "Generate a tree view of permissions"
|
||||
usage: "/%s tree [selection] [max level] [player]"
|
||||
args:
|
||||
"selection": "the root of the tree. specify \".\" to include all permissions"
|
||||
"max level": "how many branch levels should be returned"
|
||||
"player": "the name of an online player to check against"
|
||||
search:
|
||||
description: "Search for users/groups with a specific permission"
|
||||
usage: "/%s search <permission>"
|
||||
args:
|
||||
"permission": "the permission to search for"
|
||||
"page": "the page to view"
|
||||
check:
|
||||
description: "Perform a standard permission check on an online player"
|
||||
usage: "/%s check <user> <permission>"
|
||||
args:
|
||||
"user": "the user to check"
|
||||
"permission": "the permission to check for"
|
||||
network-sync:
|
||||
description: "Sync changes with the storage and request that all other servers on the network do the same"
|
||||
usage: "/%s networksync"
|
||||
import:
|
||||
description: "Import data from a file"
|
||||
usage: "/%s import <file>"
|
||||
args:
|
||||
"file": "the file to import from"
|
||||
export:
|
||||
description: "Export data to a file"
|
||||
usage: "/%s export <file>"
|
||||
args:
|
||||
"file": "the file to export to"
|
||||
reload-config:
|
||||
description: "Reload some of the config options"
|
||||
usage: "/%s reloadconfig"
|
||||
bulk-update:
|
||||
description: "Execute bulk change queries on all data"
|
||||
usage: "/%s bulkupdate"
|
||||
args:
|
||||
"data type": "the type of data being changed. ('all', 'users' or 'groups')"
|
||||
"action": "the action to perform on the data. ('update' or 'delete')"
|
||||
"action field": "the field to act upon. only required for 'update'. ('permission', 'server' or 'world')"
|
||||
"action value": "the value to replace with. only required for 'update'."
|
||||
"constraint...": "the constraints required for the update"
|
||||
migration:
|
||||
description: "Migration commands"
|
||||
usage: "/%s migration"
|
||||
apply-edits:
|
||||
description: "Applies permission changes made from the web editor"
|
||||
usage: "/%s applyedits <code> [target]"
|
||||
args:
|
||||
"code": "the unique code for the data"
|
||||
"target": "who to apply the data to"
|
||||
create-group:
|
||||
description: "Create a new group"
|
||||
usage: "/%s creategroup <group>"
|
||||
args:
|
||||
"name": "the name of the group"
|
||||
delete-group:
|
||||
description: "Delete a group"
|
||||
usage: "/%s deletegroup <group>"
|
||||
args:
|
||||
"name": "the name of the group"
|
||||
list-groups:
|
||||
description: "List all groups on the platform"
|
||||
usage: "/%s listgroups"
|
||||
create-track:
|
||||
description: "Create a new track"
|
||||
usage: "/%s createtrack <track>"
|
||||
args:
|
||||
"name": "the name of the track"
|
||||
delete-track:
|
||||
description: "Delete a track"
|
||||
usage: "/%s deletetrack <track>"
|
||||
args:
|
||||
"name": "the name of the track"
|
||||
list-tracks:
|
||||
description: "List all tracks on the platform"
|
||||
usage: "/%s listtracks"
|
||||
user-info:
|
||||
description: "Shows info about the user"
|
||||
user-switchprimarygroup:
|
||||
description: "Switches the user's primary group"
|
||||
args:
|
||||
"group": "the group to switch to"
|
||||
user-promote:
|
||||
description: "Promotes the user up a track"
|
||||
args:
|
||||
"track": "the track to promote the user up"
|
||||
"context...": "the contexts to promote the user in"
|
||||
user-demote:
|
||||
description: "Demotes the user down a track"
|
||||
args:
|
||||
"track": "the track to demote the user down"
|
||||
"context...": "the contexts to demote the user in"
|
||||
group-info:
|
||||
description: "Gives info about the group"
|
||||
group-listmembers:
|
||||
description: "Show the users/groups who inherit from this group"
|
||||
args:
|
||||
"page": "the page to view"
|
||||
group-setweight:
|
||||
description: "Set the groups weight"
|
||||
args:
|
||||
"weight": "the weight to set"
|
||||
group-rename:
|
||||
description: "Rename the group"
|
||||
args:
|
||||
"name": "the new name"
|
||||
group-clone:
|
||||
description: "Clone the group"
|
||||
args:
|
||||
"name": "the name of the group to clone onto"
|
||||
holder-editor:
|
||||
description: "Opens the web permission editor"
|
||||
holder-showtracks:
|
||||
description: "Lists the tracks that the object is on"
|
||||
holder-clear:
|
||||
description: "Removes all permissions, parents and meta"
|
||||
args:
|
||||
"context...": "the contexts to filter by"
|
||||
permission:
|
||||
description: "Edit permissions"
|
||||
parent:
|
||||
description: "Edit inheritances"
|
||||
meta:
|
||||
description: "Edit metadata values"
|
||||
permission-info:
|
||||
description: "Lists the permission nodes the object has"
|
||||
args:
|
||||
"page": "the page to view"
|
||||
"filter": "the string to filter by"
|
||||
permission-set:
|
||||
description: "Sets a permission for the object"
|
||||
args:
|
||||
"node": "the permission node to set"
|
||||
"true|false": "the value of the node"
|
||||
"context...": "the contexts to add the permission in"
|
||||
permission-unset:
|
||||
description: "Unsets a permission for the object"
|
||||
args:
|
||||
"node": "the permission node to unset"
|
||||
"context...": "the contexts to remove the permission in"
|
||||
permission-settemp:
|
||||
description: "Sets a permission for the object temporarily"
|
||||
args:
|
||||
"node": "the permission node to set"
|
||||
"true|false": "the value of the node"
|
||||
"duration": "the duration until the permission node expires"
|
||||
"context...": "the contexts to add the permission in"
|
||||
permission-unsettemp:
|
||||
description: "Unsets a temporary permission for the object"
|
||||
args:
|
||||
"node": "the permission node to unset"
|
||||
"context...": "the contexts to remove the permission in"
|
||||
permission-check:
|
||||
description: "Checks to see if the object has a certain permission node"
|
||||
args:
|
||||
"node": "the permission node to check for"
|
||||
"context...": "the contexts to check in"
|
||||
permission-check-inherits:
|
||||
description: "Checks to see if the object inherits a certain permission node"
|
||||
args:
|
||||
"node": "the permission node to check for"
|
||||
"context...": "the contexts to check in"
|
||||
parent-info:
|
||||
description: "Lists the groups that this object inherits from"
|
||||
parent-set:
|
||||
description: "Removes all other groups the object inherits already and adds them to the one given"
|
||||
args:
|
||||
"group": "the group to set to"
|
||||
"context...": "the contexts to set the group in"
|
||||
parent-add:
|
||||
description: "Sets another group for the object to inherit permissions from"
|
||||
args:
|
||||
"group": "the group to inherit from"
|
||||
"context...": "the contexts to inherit the group in"
|
||||
parent-remove:
|
||||
description: "Removes a previously set inheritance rule"
|
||||
args:
|
||||
"group": "the group to remove"
|
||||
"context...": "the contexts to remove the group in"
|
||||
parent-set-track:
|
||||
description: "Removes all other groups the object inherits from already on the given track and adds them to the one given"
|
||||
args:
|
||||
"track": "the track to set on"
|
||||
"group": "the group to set to, or a number relating to the position of the group on the given track"
|
||||
"context...": "the contexts to set the group in"
|
||||
parent-add-temp:
|
||||
description: "Sets another group for the object to inherit permissions from temporarily"
|
||||
args:
|
||||
"group": "the group to inherit from"
|
||||
"duration": "the duration of the group membership"
|
||||
"context...": "the contexts to inherit the group in"
|
||||
parent-remove-temp:
|
||||
description: "Removes a previously set temporary inheritance rule"
|
||||
args:
|
||||
"group": "the group to remove"
|
||||
"context...": "the contexts to remove the group in"
|
||||
parent-clear:
|
||||
description: "Clears all parents"
|
||||
args:
|
||||
"context...": "the contexts to filter by"
|
||||
parent-clear-track:
|
||||
description: "Clears all parents on a given track"
|
||||
args:
|
||||
"track": "the track to remove on"
|
||||
"context...": "the contexts to filter by"
|
||||
meta-info:
|
||||
description: "Shows all chat meta"
|
||||
meta-set:
|
||||
description: "Sets a meta value"
|
||||
args:
|
||||
"key": "the key to set"
|
||||
"value": "the value to set"
|
||||
"context...": "the contexts to add the meta pair in"
|
||||
meta-unset:
|
||||
description: "Unsets a meta value"
|
||||
args:
|
||||
"key": "the key to unset"
|
||||
"context...": "the contexts to remove the meta pair in"
|
||||
meta-settemp:
|
||||
description: "Sets a meta value temporarily"
|
||||
args:
|
||||
"key": "the key to set"
|
||||
"value": "the value to set"
|
||||
"duration": "the duration until the meta value expires"
|
||||
"context...": "the contexts to add the meta pair in"
|
||||
meta-unsettemp:
|
||||
description: "Unsets a temporary meta value"
|
||||
args:
|
||||
"key": "the key to unset"
|
||||
"context...": "the contexts to remove the meta pair in"
|
||||
meta-addprefix:
|
||||
description: "Adds a prefix"
|
||||
args:
|
||||
"priority": "the priority to add the prefix at"
|
||||
"prefix": "the prefix string"
|
||||
"context...": "the contexts to add the prefix in"
|
||||
meta-addsuffix:
|
||||
description: "Adds a suffix"
|
||||
args:
|
||||
"priority": "the priority to add the suffix at"
|
||||
"suffix": "the suffix string"
|
||||
"context...": "the contexts to add the suffix in"
|
||||
meta-removeprefix:
|
||||
description: "Removes a prefix"
|
||||
args:
|
||||
"priority": "the priority to remove the prefix at"
|
||||
"prefix": "the prefix string"
|
||||
"context...": "the contexts to remove the prefix in"
|
||||
meta-removesuffix:
|
||||
description: "Removes a suffix"
|
||||
args:
|
||||
"priority": "the priority to remove the suffix at"
|
||||
"suffix": "the suffix string"
|
||||
"context...": "the contexts to remove the suffix in"
|
||||
meta-addtemp-prefix:
|
||||
description: "Adds a prefix temporarily"
|
||||
args:
|
||||
"priority": "the priority to add the prefix at"
|
||||
"prefix": "the prefix string"
|
||||
"duration": "the duration until the prefix expires"
|
||||
"context...": "the contexts to add the prefix in"
|
||||
meta-addtemp-suffix:
|
||||
description: "Adds a suffix temporarily"
|
||||
args:
|
||||
"priority": "the priority to add the suffix at"
|
||||
"suffix": "the suffix string"
|
||||
"duration": "the duration until the suffix expires"
|
||||
"context...": "the contexts to add the suffix in"
|
||||
meta-removetemp-prefix:
|
||||
description: "Removes a temporary prefix"
|
||||
args:
|
||||
"priority": "the priority to remove the prefix at"
|
||||
"prefix": "the prefix string"
|
||||
"context...": "the contexts to remove the prefix in"
|
||||
meta-removetemp-suffix:
|
||||
description: "Removes a temporary suffix"
|
||||
args:
|
||||
"priority": "the priority to remove the suffix at"
|
||||
"suffix": "the suffix string"
|
||||
"context...": "the contexts to remove the suffix in"
|
||||
meta-clear:
|
||||
description: "Clears all chat meta"
|
||||
args:
|
||||
"context...": "the contexts to filter by"
|
||||
track-info:
|
||||
description: "Gives info about the track"
|
||||
track-append:
|
||||
description: "Appends a group onto the end of the track"
|
||||
args:
|
||||
"group": "the group to append"
|
||||
track-insert:
|
||||
description: "Inserts a group at a given position along the track"
|
||||
args:
|
||||
"group": "the group to insert"
|
||||
"position": "the position to insert the group at (the first position on the track is 1)"
|
||||
track-remove:
|
||||
description: "Removes a group from the track"
|
||||
args:
|
||||
"group": "the group to remove"
|
||||
track-clear:
|
||||
description: "Clears the groups on the track"
|
||||
track-rename:
|
||||
description: "Rename the track"
|
||||
args:
|
||||
"name": "the new name"
|
||||
track-clone:
|
||||
description: "Clone the track"
|
||||
args:
|
||||
"name": "the name of the track to clone onto"
|
||||
log-recent:
|
||||
description: "View recent actions"
|
||||
args:
|
||||
"user": "the name/uuid of the user to filter by"
|
||||
"page": "the page number to view"
|
||||
log-search:
|
||||
description: "Search the log for an entry"
|
||||
args:
|
||||
"query": "the query to search by"
|
||||
"page": "the page number to view"
|
||||
log-notify:
|
||||
description: "Toggle log notifications"
|
||||
args:
|
||||
"on|off": "whether to toggle on or off"
|
||||
log-user-history:
|
||||
description: "View a user's history"
|
||||
args:
|
||||
"user": "the name/uuid of the user"
|
||||
"page": "the page number to view"
|
||||
log-group-history:
|
||||
description: "View an group's history"
|
||||
args:
|
||||
"group": "the name of the group"
|
||||
"page": "the page number to view"
|
||||
log-track-history:
|
||||
description: "View a track's history"
|
||||
args:
|
||||
"track": "the name of the track"
|
||||
"page": "the page number to view"
|
||||
sponge:
|
||||
description: "Edit extra Sponge data"
|
||||
usage: "/%s sponge <collection> <subject>"
|
||||
args:
|
||||
"collection": "the collection to query"
|
||||
"subject": "the subject to modify"
|
||||
sponge-permission-info:
|
||||
description: "Shows info about the subject's permissions"
|
||||
args:
|
||||
"contexts...": "the contexts to filter by"
|
||||
sponge-permission-set:
|
||||
description: "Sets a permission for the Subject"
|
||||
args:
|
||||
"node": "the permission node to set"
|
||||
"tristate": "the value to set the permission to"
|
||||
"contexts...": "the contexts to set the permission in"
|
||||
sponge-permission-clear:
|
||||
description: "Clears the Subjects permissions"
|
||||
args:
|
||||
"contexts...": "the contexts to clear permissions in"
|
||||
sponge-parent-info:
|
||||
description: "Shows info about the subject's parents"
|
||||
args:
|
||||
"contexts...": "the contexts to filter by"
|
||||
sponge-parent-add:
|
||||
description: "Adds a parent to the Subject"
|
||||
args:
|
||||
"collection": "the subject collection where the parent Subject is"
|
||||
"subject": "the name of the parent Subject"
|
||||
"contexts...": "the contexts to add the parent in"
|
||||
sponge-parent-remove:
|
||||
description: "Removes a parent from the Subject"
|
||||
args:
|
||||
"collection": "the subject collection where the parent Subject is"
|
||||
"subject": "the name of the parent Subject"
|
||||
"contexts...": "the contexts to remove the parent in"
|
||||
sponge-parent-clear:
|
||||
description: "Clears the Subjects parents"
|
||||
args:
|
||||
"contexts...": "the contexts to clear parents in"
|
||||
sponge-option-info:
|
||||
description: "Shows info about the subject's options"
|
||||
args:
|
||||
"contexts...": "the contexts to filter by"
|
||||
sponge-option-set:
|
||||
description: "Sets an option for the Subject"
|
||||
args:
|
||||
"key": "the key to set"
|
||||
"value": "the value to set the key to"
|
||||
"contexts...": "the contexts to set the option in"
|
||||
sponge-option-unset:
|
||||
description: "Unsets an option for the Subject"
|
||||
args:
|
||||
"key": "the key to unset"
|
||||
"contexts...": "the contexts to unset the key in"
|
||||
sponge-option-clear:
|
||||
description: "Clears the Subjects options"
|
||||
args:
|
||||
"contexts...": "the contexts to clear options in"
|
||||
migration-command:
|
||||
description: "Migration command"
|
||||
migration-groupmanager:
|
||||
description: "Migration command"
|
||||
args:
|
||||
"migrate as global": "if world permissions should be ignored, and just migrated as global"
|
||||
migration-powerfulperms:
|
||||
description: "Migration command"
|
||||
args:
|
||||
"address": "the address of the PP database"
|
||||
"database": "the name of the PP database"
|
||||
"username": "the username to log into the DB"
|
||||
"password": "the password to log into the DB"
|
||||
"db table": "the name of the PP table where player data is stored"
|
||||
|
@ -30,8 +30,8 @@ import lombok.RequiredArgsConstructor;
|
||||
import me.lucko.luckperms.bukkit.model.Injector;
|
||||
import me.lucko.luckperms.bukkit.model.LPPermissible;
|
||||
import me.lucko.luckperms.common.config.ConfigKeys;
|
||||
import me.lucko.luckperms.common.constants.Message;
|
||||
import me.lucko.luckperms.common.core.model.User;
|
||||
import me.lucko.luckperms.common.locale.Message;
|
||||
import me.lucko.luckperms.common.utils.LoginHelper;
|
||||
|
||||
import org.bukkit.entity.Player;
|
||||
|
@ -42,6 +42,8 @@ import me.lucko.luckperms.common.commands.sender.Sender;
|
||||
import me.lucko.luckperms.common.core.NodeFactory;
|
||||
import me.lucko.luckperms.common.core.model.PermissionHolder;
|
||||
import me.lucko.luckperms.common.core.model.User;
|
||||
import me.lucko.luckperms.common.locale.CommandSpec;
|
||||
import me.lucko.luckperms.common.locale.LocaleManager;
|
||||
import me.lucko.luckperms.common.plugin.LuckPermsPlugin;
|
||||
import me.lucko.luckperms.common.utils.Predicates;
|
||||
import me.lucko.luckperms.common.utils.ProgressLogger;
|
||||
@ -70,8 +72,8 @@ public class MigrationBPermissions extends SubCommand<Object> {
|
||||
}
|
||||
}
|
||||
|
||||
public MigrationBPermissions() {
|
||||
super("bpermissions", "Migration from bPermissions", MIGRATION, Predicates.alwaysFalse(), null);
|
||||
public MigrationBPermissions(LocaleManager locale) {
|
||||
super(CommandSpec.MIGRATION_COMMAND.spec(locale), "bpermissions", MIGRATION, Predicates.alwaysFalse());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -28,7 +28,6 @@ package me.lucko.luckperms.bukkit.migration;
|
||||
import me.lucko.luckperms.api.ChatMetaType;
|
||||
import me.lucko.luckperms.api.Node;
|
||||
import me.lucko.luckperms.api.event.cause.CreationCause;
|
||||
import me.lucko.luckperms.common.commands.Arg;
|
||||
import me.lucko.luckperms.common.commands.CommandException;
|
||||
import me.lucko.luckperms.common.commands.CommandResult;
|
||||
import me.lucko.luckperms.common.commands.abstraction.SubCommand;
|
||||
@ -36,6 +35,8 @@ import me.lucko.luckperms.common.commands.impl.migration.MigrationUtils;
|
||||
import me.lucko.luckperms.common.commands.sender.Sender;
|
||||
import me.lucko.luckperms.common.constants.Permission;
|
||||
import me.lucko.luckperms.common.core.NodeFactory;
|
||||
import me.lucko.luckperms.common.locale.CommandSpec;
|
||||
import me.lucko.luckperms.common.locale.LocaleManager;
|
||||
import me.lucko.luckperms.common.plugin.LuckPermsPlugin;
|
||||
import me.lucko.luckperms.common.utils.Predicates;
|
||||
import me.lucko.luckperms.common.utils.ProgressLogger;
|
||||
@ -60,10 +61,8 @@ import java.util.function.Function;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
public class MigrationGroupManager extends SubCommand<Object> {
|
||||
public MigrationGroupManager() {
|
||||
super("groupmanager", "Migration from GroupManager", Permission.MIGRATION, Predicates.is(0),
|
||||
Arg.list(Arg.create("migrate as global", true, "if world permissions should be ignored, and just migrated as global"))
|
||||
);
|
||||
public MigrationGroupManager(LocaleManager locale) {
|
||||
super(CommandSpec.MIGRATION_GROUPMANAGER.spec(locale), "groupmanager", Permission.MIGRATION, Predicates.is(0));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -36,6 +36,8 @@ import me.lucko.luckperms.common.core.NodeFactory;
|
||||
import me.lucko.luckperms.common.core.model.Group;
|
||||
import me.lucko.luckperms.common.core.model.PermissionHolder;
|
||||
import me.lucko.luckperms.common.core.model.User;
|
||||
import me.lucko.luckperms.common.locale.CommandSpec;
|
||||
import me.lucko.luckperms.common.locale.LocaleManager;
|
||||
import me.lucko.luckperms.common.plugin.LuckPermsPlugin;
|
||||
import me.lucko.luckperms.common.utils.Predicates;
|
||||
import me.lucko.luckperms.common.utils.ProgressLogger;
|
||||
@ -56,8 +58,8 @@ import java.util.UUID;
|
||||
import java.util.concurrent.atomic.AtomicInteger;
|
||||
|
||||
public class MigrationPermissionsEx extends SubCommand<Object> {
|
||||
public MigrationPermissionsEx() {
|
||||
super("permissionsex", "Migration from PermissionsEx", Permission.MIGRATION, Predicates.alwaysFalse(), null);
|
||||
public MigrationPermissionsEx(LocaleManager locale) {
|
||||
super(CommandSpec.MIGRATION_COMMAND.spec(locale), "permissionsex", Permission.MIGRATION, Predicates.alwaysFalse());
|
||||
}
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
|
@ -35,7 +35,6 @@ import com.github.cheesesoftware.PowerfulPermsAPI.PowerfulPermsPlugin;
|
||||
|
||||
import me.lucko.luckperms.api.Node;
|
||||
import me.lucko.luckperms.api.event.cause.CreationCause;
|
||||
import me.lucko.luckperms.common.commands.Arg;
|
||||
import me.lucko.luckperms.common.commands.CommandException;
|
||||
import me.lucko.luckperms.common.commands.CommandResult;
|
||||
import me.lucko.luckperms.common.commands.abstraction.SubCommand;
|
||||
@ -46,6 +45,8 @@ import me.lucko.luckperms.common.core.NodeFactory;
|
||||
import me.lucko.luckperms.common.core.model.PermissionHolder;
|
||||
import me.lucko.luckperms.common.core.model.User;
|
||||
import me.lucko.luckperms.common.dependencies.DependencyManager;
|
||||
import me.lucko.luckperms.common.locale.CommandSpec;
|
||||
import me.lucko.luckperms.common.locale.LocaleManager;
|
||||
import me.lucko.luckperms.common.plugin.LuckPermsPlugin;
|
||||
import me.lucko.luckperms.common.storage.StorageType;
|
||||
import me.lucko.luckperms.common.utils.HikariSupplier;
|
||||
@ -71,16 +72,8 @@ import static me.lucko.luckperms.common.constants.Permission.MIGRATION;
|
||||
|
||||
// Only supports the latest versions of the PP API. (it seems to change randomly almost every release)
|
||||
public class MigrationPowerfulPerms extends SubCommand<Object> {
|
||||
public MigrationPowerfulPerms() {
|
||||
super("powerfulperms", "Migration from PowerfulPerms", MIGRATION, Predicates.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")
|
||||
)
|
||||
);
|
||||
public MigrationPowerfulPerms(LocaleManager locale) {
|
||||
super(CommandSpec.MIGRATION_POWERFULPERMS.spec(locale), "powerfulperms", MIGRATION, Predicates.not(5));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -40,6 +40,8 @@ import me.lucko.luckperms.common.core.model.Group;
|
||||
import me.lucko.luckperms.common.core.model.PermissionHolder;
|
||||
import me.lucko.luckperms.common.core.model.Track;
|
||||
import me.lucko.luckperms.common.core.model.User;
|
||||
import me.lucko.luckperms.common.locale.CommandSpec;
|
||||
import me.lucko.luckperms.common.locale.LocaleManager;
|
||||
import me.lucko.luckperms.common.plugin.LuckPermsPlugin;
|
||||
import me.lucko.luckperms.common.utils.Predicates;
|
||||
import me.lucko.luckperms.common.utils.ProgressLogger;
|
||||
@ -62,8 +64,8 @@ import java.util.UUID;
|
||||
import java.util.concurrent.atomic.AtomicInteger;
|
||||
|
||||
public class MigrationZPermissions extends SubCommand<Object> {
|
||||
public MigrationZPermissions() {
|
||||
super("zpermissions", "Migration from zPermissions", Permission.MIGRATION, Predicates.alwaysFalse(), null);
|
||||
public MigrationZPermissions(LocaleManager locale) {
|
||||
super(CommandSpec.MIGRATION_COMMAND.spec(locale), "zpermissions", Permission.MIGRATION, Predicates.alwaysFalse());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -31,8 +31,8 @@ import me.lucko.luckperms.api.Contexts;
|
||||
import me.lucko.luckperms.api.Tristate;
|
||||
import me.lucko.luckperms.api.context.MutableContextSet;
|
||||
import me.lucko.luckperms.common.config.ConfigKeys;
|
||||
import me.lucko.luckperms.common.constants.Message;
|
||||
import me.lucko.luckperms.common.core.model.User;
|
||||
import me.lucko.luckperms.common.locale.Message;
|
||||
import me.lucko.luckperms.common.utils.LoginHelper;
|
||||
|
||||
import net.md_5.bungee.api.chat.TextComponent;
|
||||
|
@ -34,6 +34,8 @@ import me.lucko.luckperms.common.commands.sender.Sender;
|
||||
import me.lucko.luckperms.common.constants.Permission;
|
||||
import me.lucko.luckperms.common.core.NodeFactory;
|
||||
import me.lucko.luckperms.common.core.model.PermissionHolder;
|
||||
import me.lucko.luckperms.common.locale.CommandSpec;
|
||||
import me.lucko.luckperms.common.locale.LocaleManager;
|
||||
import me.lucko.luckperms.common.plugin.LuckPermsPlugin;
|
||||
import me.lucko.luckperms.common.utils.Predicates;
|
||||
import me.lucko.luckperms.common.utils.ProgressLogger;
|
||||
@ -50,8 +52,8 @@ import java.util.Map;
|
||||
import java.util.concurrent.atomic.AtomicInteger;
|
||||
|
||||
public class MigrationBungeePerms extends SubCommand<Object> {
|
||||
public MigrationBungeePerms() {
|
||||
super("bungeeperms", "Migration from BungeePerms", Permission.MIGRATION, Predicates.alwaysFalse(), null);
|
||||
public MigrationBungeePerms(LocaleManager locale) {
|
||||
super(CommandSpec.MIGRATION_COMMAND.spec(locale), "bungeeperms", Permission.MIGRATION, Predicates.alwaysFalse());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -57,8 +57,9 @@ import me.lucko.luckperms.common.commands.sender.Sender;
|
||||
import me.lucko.luckperms.common.commands.utils.ArgumentUtils;
|
||||
import me.lucko.luckperms.common.commands.utils.Util;
|
||||
import me.lucko.luckperms.common.constants.Constants;
|
||||
import me.lucko.luckperms.common.constants.Message;
|
||||
import me.lucko.luckperms.common.constants.Permission;
|
||||
import me.lucko.luckperms.common.locale.LocaleManager;
|
||||
import me.lucko.luckperms.common.locale.Message;
|
||||
import me.lucko.luckperms.common.plugin.LuckPermsPlugin;
|
||||
import me.lucko.luckperms.common.utils.TextUtils;
|
||||
|
||||
@ -92,31 +93,33 @@ public class CommandManager {
|
||||
this.plugin = plugin;
|
||||
this.executor = Executors.newSingleThreadExecutor();
|
||||
|
||||
LocaleManager locale = plugin.getLocaleManager();
|
||||
|
||||
mainCommands = ImmutableList.<Command>builder()
|
||||
.add(new UserMainCommand())
|
||||
.add(new GroupMainCommand())
|
||||
.add(new TrackMainCommand())
|
||||
.add(new UserMainCommand(locale))
|
||||
.add(new GroupMainCommand(locale))
|
||||
.add(new TrackMainCommand(locale))
|
||||
.addAll(plugin.getExtraCommands())
|
||||
.add(new LogMainCommand())
|
||||
.add(new SyncCommand())
|
||||
.add(new InfoCommand())
|
||||
.add(new VerboseCommand())
|
||||
.add(new TreeCommand())
|
||||
.add(new SearchCommand())
|
||||
.add(new CheckCommand())
|
||||
.add(new NetworkSyncCommand())
|
||||
.add(new ImportCommand())
|
||||
.add(new ExportCommand())
|
||||
.add(new ReloadConfigCommand())
|
||||
.add(new BulkUpdateCommand())
|
||||
.add(new MigrationMainCommand())
|
||||
.add(new ApplyEditsCommand())
|
||||
.add(new CreateGroup())
|
||||
.add(new DeleteGroup())
|
||||
.add(new ListGroups())
|
||||
.add(new CreateTrack())
|
||||
.add(new DeleteTrack())
|
||||
.add(new ListTracks())
|
||||
.add(new LogMainCommand(locale))
|
||||
.add(new SyncCommand(locale))
|
||||
.add(new InfoCommand(locale))
|
||||
.add(new VerboseCommand(locale))
|
||||
.add(new TreeCommand(locale))
|
||||
.add(new SearchCommand(locale))
|
||||
.add(new CheckCommand(locale))
|
||||
.add(new NetworkSyncCommand(locale))
|
||||
.add(new ImportCommand(locale))
|
||||
.add(new ExportCommand(locale))
|
||||
.add(new ReloadConfigCommand(locale))
|
||||
.add(new BulkUpdateCommand(locale))
|
||||
.add(new MigrationMainCommand(locale))
|
||||
.add(new ApplyEditsCommand(locale))
|
||||
.add(new CreateGroup(locale))
|
||||
.add(new DeleteGroup(locale))
|
||||
.add(new ListGroups(locale))
|
||||
.add(new CreateTrack(locale))
|
||||
.add(new DeleteTrack(locale))
|
||||
.add(new ListTracks(locale))
|
||||
.build();
|
||||
}
|
||||
|
||||
|
@ -34,6 +34,7 @@ import me.lucko.luckperms.common.commands.CommandException;
|
||||
import me.lucko.luckperms.common.commands.CommandResult;
|
||||
import me.lucko.luckperms.common.commands.sender.Sender;
|
||||
import me.lucko.luckperms.common.constants.Permission;
|
||||
import me.lucko.luckperms.common.locale.LocalizedSpec;
|
||||
import me.lucko.luckperms.common.plugin.LuckPermsPlugin;
|
||||
|
||||
import java.util.Collections;
|
||||
@ -49,18 +50,15 @@ import java.util.function.Predicate;
|
||||
*/
|
||||
public abstract class Command<T, S> {
|
||||
|
||||
@Getter
|
||||
private final LocalizedSpec spec;
|
||||
|
||||
/**
|
||||
* The name of the command. Should be properly capitalised.
|
||||
*/
|
||||
@Getter
|
||||
private final String name;
|
||||
|
||||
/**
|
||||
* A brief description of this command
|
||||
*/
|
||||
@Getter
|
||||
private final String description;
|
||||
|
||||
/**
|
||||
* The permission required to use this command. Nullable.
|
||||
*/
|
||||
@ -72,32 +70,25 @@ public abstract class Command<T, S> {
|
||||
@Getter
|
||||
private final Predicate<Integer> argumentCheck;
|
||||
|
||||
/**
|
||||
* A list of arguments required for the command. These are just here for informational purposes, and aren't used
|
||||
* for argument validation.
|
||||
*/
|
||||
private final List<Arg> args;
|
||||
|
||||
/**
|
||||
* Child commands. Nullable.
|
||||
*/
|
||||
private final List<Command<S, ?>> children;
|
||||
|
||||
public Command(String name, String description, Permission permission, Predicate<Integer> argumentCheck, List<Arg> args, List<Command<S, ?>> children) {
|
||||
public Command(LocalizedSpec spec, String name, Permission permission, Predicate<Integer> argumentCheck, List<Command<S, ?>> children) {
|
||||
this.spec = spec;
|
||||
this.name = name;
|
||||
this.description = description;
|
||||
this.permission = permission;
|
||||
this.argumentCheck = argumentCheck;
|
||||
this.args = args == null ? null : ImmutableList.copyOf(args);
|
||||
this.children = children == null ? null : ImmutableList.copyOf(children);
|
||||
}
|
||||
|
||||
public Command(String name, String description, Permission permission, Predicate<Integer> argumentCheck, List<Arg> args) {
|
||||
this(name, description, permission, argumentCheck, args, null);
|
||||
public Command(LocalizedSpec spec, String name, Permission permission, Predicate<Integer> argumentCheck) {
|
||||
this(spec, name, permission, argumentCheck, null);
|
||||
}
|
||||
|
||||
public Command(String name, String description, Predicate<Integer> argumentCheck) {
|
||||
this(name, description, null, argumentCheck, null, null);
|
||||
public Command(LocalizedSpec spec, String name, Predicate<Integer> argumentCheck) {
|
||||
this(spec, name, null, argumentCheck, null);
|
||||
}
|
||||
|
||||
public abstract CommandResult execute(LuckPermsPlugin plugin, Sender sender, T t, List<String> args, String label) throws CommandException;
|
||||
@ -147,13 +138,18 @@ public abstract class Command<T, S> {
|
||||
return true;
|
||||
}
|
||||
|
||||
public String getDescription() {
|
||||
return spec.description();
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the usage of this command. Will only return a non empty result for main commands.
|
||||
*
|
||||
* @return the usage of this command.
|
||||
*/
|
||||
public String getUsage() {
|
||||
return "";
|
||||
String usage = spec.usage();
|
||||
return usage == null ? "" : usage;
|
||||
}
|
||||
|
||||
public Optional<Permission> getPermission() {
|
||||
@ -161,7 +157,7 @@ public abstract class Command<T, S> {
|
||||
}
|
||||
|
||||
public Optional<List<Arg>> getArgs() {
|
||||
return Optional.ofNullable(args);
|
||||
return Optional.ofNullable(spec.args());
|
||||
}
|
||||
|
||||
public Optional<List<Command<S, ?>>> getChildren() {
|
||||
|
@ -25,14 +25,13 @@
|
||||
|
||||
package me.lucko.luckperms.common.commands.abstraction;
|
||||
|
||||
import lombok.Getter;
|
||||
|
||||
import me.lucko.luckperms.common.commands.CommandException;
|
||||
import me.lucko.luckperms.common.commands.CommandManager;
|
||||
import me.lucko.luckperms.common.commands.CommandResult;
|
||||
import me.lucko.luckperms.common.commands.sender.Sender;
|
||||
import me.lucko.luckperms.common.commands.utils.Util;
|
||||
import me.lucko.luckperms.common.constants.Message;
|
||||
import me.lucko.luckperms.common.locale.LocalizedSpec;
|
||||
import me.lucko.luckperms.common.locale.Message;
|
||||
import me.lucko.luckperms.common.plugin.LuckPermsPlugin;
|
||||
import me.lucko.luckperms.common.utils.Predicates;
|
||||
|
||||
@ -44,13 +43,10 @@ import java.util.stream.Collectors;
|
||||
|
||||
public abstract class MainCommand<T> extends Command<Void, T> {
|
||||
|
||||
@Getter
|
||||
private final String usage;
|
||||
private final int minArgs; // equals 1 if the command doesn't take a mid argument, e.g. /lp user <USER> sub-command....
|
||||
|
||||
public MainCommand(String name, String description, String usage, int minArgs, List<Command<T, ?>> children) {
|
||||
super(name, description, null, Predicates.alwaysFalse(), null, children);
|
||||
this.usage = usage;
|
||||
public MainCommand(LocalizedSpec spec, String name, int minArgs, List<Command<T, ?>> children) {
|
||||
super(spec, name, null, Predicates.alwaysFalse(), children);
|
||||
this.minArgs = minArgs;
|
||||
}
|
||||
|
||||
@ -160,7 +156,7 @@ public abstract class MainCommand<T> extends Command<Void, T> {
|
||||
.collect(Collectors.toList());
|
||||
|
||||
if (subs.size() > 0) {
|
||||
Util.sendPluginMessage(sender, "&b" + getName() + " Sub Commands: &7(" + String.format(usage, label) + " ...)");
|
||||
Util.sendPluginMessage(sender, "&b" + getName() + " Sub Commands: &7(" + String.format(getUsage(), label) + " ...)");
|
||||
|
||||
for (Command s : subs) {
|
||||
s.sendUsage(sender, label);
|
||||
|
@ -30,8 +30,9 @@ import me.lucko.luckperms.common.commands.CommandResult;
|
||||
import me.lucko.luckperms.common.commands.sender.Sender;
|
||||
import me.lucko.luckperms.common.commands.utils.ArgumentUtils;
|
||||
import me.lucko.luckperms.common.commands.utils.Util;
|
||||
import me.lucko.luckperms.common.constants.Message;
|
||||
import me.lucko.luckperms.common.core.model.PermissionHolder;
|
||||
import me.lucko.luckperms.common.locale.LocalizedSpec;
|
||||
import me.lucko.luckperms.common.locale.Message;
|
||||
import me.lucko.luckperms.common.plugin.LuckPermsPlugin;
|
||||
import me.lucko.luckperms.common.utils.Predicates;
|
||||
|
||||
@ -55,8 +56,8 @@ public class SharedMainCommand<T extends PermissionHolder> extends SubCommand<T>
|
||||
*/
|
||||
private boolean user;
|
||||
|
||||
public SharedMainCommand(String name, String description, boolean user, List<SharedSubCommand> secondaryCommands) {
|
||||
super(name, description, null, Predicates.alwaysFalse(), null);
|
||||
public SharedMainCommand(LocalizedSpec spec, String name, boolean user, List<SharedSubCommand> secondaryCommands) {
|
||||
super(spec, name, null, Predicates.alwaysFalse());
|
||||
this.secondaryCommands = secondaryCommands;
|
||||
this.user = user;
|
||||
}
|
||||
@ -89,7 +90,7 @@ public class SharedMainCommand<T extends PermissionHolder> extends SubCommand<T>
|
||||
strippedArgs.addAll(args.subList(1, args.size()));
|
||||
}
|
||||
|
||||
if (sub.getIsArgumentInvalid().test(strippedArgs.size())) {
|
||||
if (sub.getArgumentCheck().test(strippedArgs.size())) {
|
||||
sub.sendDetailedUsage(sender);
|
||||
return CommandResult.INVALID_ARGS;
|
||||
}
|
||||
|
@ -25,11 +25,8 @@
|
||||
|
||||
package me.lucko.luckperms.common.commands.abstraction;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Getter;
|
||||
|
||||
import com.google.common.collect.ImmutableList;
|
||||
|
||||
import me.lucko.luckperms.common.commands.Arg;
|
||||
import me.lucko.luckperms.common.commands.CommandException;
|
||||
import me.lucko.luckperms.common.commands.CommandResult;
|
||||
@ -39,6 +36,7 @@ import me.lucko.luckperms.common.constants.Permission;
|
||||
import me.lucko.luckperms.common.core.model.Group;
|
||||
import me.lucko.luckperms.common.core.model.PermissionHolder;
|
||||
import me.lucko.luckperms.common.core.model.User;
|
||||
import me.lucko.luckperms.common.locale.LocalizedSpec;
|
||||
import me.lucko.luckperms.common.plugin.LuckPermsPlugin;
|
||||
|
||||
import java.util.Collections;
|
||||
@ -50,19 +48,15 @@ import java.util.function.Predicate;
|
||||
* This doesn't extend the other Command or SubCommand classes to avoid generics hell.
|
||||
*/
|
||||
@Getter
|
||||
@AllArgsConstructor
|
||||
public abstract class SharedSubCommand {
|
||||
|
||||
private final LocalizedSpec spec;
|
||||
|
||||
/**
|
||||
* The name of the sub command
|
||||
*/
|
||||
private final String name;
|
||||
|
||||
/**
|
||||
* A brief description of what the sub command does
|
||||
*/
|
||||
private final String description;
|
||||
|
||||
/**
|
||||
* The permission needed to use this command
|
||||
*/
|
||||
@ -72,8 +66,15 @@ public abstract class SharedSubCommand {
|
||||
/**
|
||||
* Predicate to test if the argument length given is invalid
|
||||
*/
|
||||
private final Predicate<? super Integer> isArgumentInvalid;
|
||||
private final ImmutableList<Arg> args;
|
||||
private final Predicate<? super Integer> argumentCheck;
|
||||
|
||||
public SharedSubCommand(LocalizedSpec spec, String name, Permission userPermission, Permission groupPermission, Predicate<? super Integer> argumentCheck) {
|
||||
this.spec = spec;
|
||||
this.name = name;
|
||||
this.userPermission = userPermission;
|
||||
this.groupPermission = groupPermission;
|
||||
this.argumentCheck = argumentCheck;
|
||||
}
|
||||
|
||||
public abstract CommandResult execute(LuckPermsPlugin plugin, Sender sender, PermissionHolder holder, List<String> args, String label) throws CommandException;
|
||||
|
||||
@ -83,9 +84,9 @@ public abstract class SharedSubCommand {
|
||||
|
||||
public void sendUsage(Sender sender) {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
if (args != null) {
|
||||
if (getArgs() != null) {
|
||||
sb.append("&3 - &7");
|
||||
for (Arg arg : args) {
|
||||
for (Arg arg : getArgs()) {
|
||||
sb.append(arg.asPrettyString()).append(" ");
|
||||
}
|
||||
}
|
||||
@ -96,9 +97,9 @@ public abstract class SharedSubCommand {
|
||||
public void sendDetailedUsage(Sender sender) {
|
||||
Util.sendPluginMessage(sender, "&3&lCommand Usage &3- &b" + getName());
|
||||
Util.sendPluginMessage(sender, "&b> &7" + getDescription());
|
||||
if (args != null) {
|
||||
if (getArgs() != null) {
|
||||
Util.sendPluginMessage(sender, "&3Arguments:");
|
||||
for (Arg arg : args) {
|
||||
for (Arg arg : getArgs()) {
|
||||
Util.sendPluginMessage(sender, "&b- " + arg.asPrettyString() + "&3 -> &7" + arg.getDescription());
|
||||
}
|
||||
}
|
||||
@ -108,6 +109,14 @@ public abstract class SharedSubCommand {
|
||||
return user ? userPermission.isAuthorized(sender) : groupPermission.isAuthorized(sender);
|
||||
}
|
||||
|
||||
public String getDescription() {
|
||||
return spec.description();
|
||||
}
|
||||
|
||||
public List<Arg> getArgs() {
|
||||
return spec.args();
|
||||
}
|
||||
|
||||
public static void save(PermissionHolder holder, Sender sender, LuckPermsPlugin plugin) {
|
||||
if (holder instanceof User) {
|
||||
User user = ((User) holder);
|
||||
|
@ -25,14 +25,13 @@
|
||||
|
||||
package me.lucko.luckperms.common.commands.abstraction;
|
||||
|
||||
import lombok.Getter;
|
||||
|
||||
import me.lucko.luckperms.common.commands.Arg;
|
||||
import me.lucko.luckperms.common.commands.CommandException;
|
||||
import me.lucko.luckperms.common.commands.CommandResult;
|
||||
import me.lucko.luckperms.common.commands.sender.Sender;
|
||||
import me.lucko.luckperms.common.commands.utils.Util;
|
||||
import me.lucko.luckperms.common.constants.Permission;
|
||||
import me.lucko.luckperms.common.locale.LocalizedSpec;
|
||||
import me.lucko.luckperms.common.plugin.LuckPermsPlugin;
|
||||
|
||||
import java.util.List;
|
||||
@ -43,12 +42,8 @@ import java.util.function.Predicate;
|
||||
*/
|
||||
public abstract class SingleCommand extends Command<Void, Void> {
|
||||
|
||||
@Getter
|
||||
private final String usage;
|
||||
|
||||
public SingleCommand(String name, String description, String usage, Permission permission, Predicate<Integer> argumentCheck, List<Arg> args) {
|
||||
super(name, description, permission, argumentCheck, args, null);
|
||||
this.usage = usage;
|
||||
public SingleCommand(LocalizedSpec spec, String name, Permission permission, Predicate<Integer> argumentCheck) {
|
||||
super(spec, name, permission, argumentCheck, null);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -33,11 +33,12 @@ import me.lucko.luckperms.common.commands.Arg;
|
||||
import me.lucko.luckperms.common.commands.sender.Sender;
|
||||
import me.lucko.luckperms.common.commands.utils.Util;
|
||||
import me.lucko.luckperms.common.config.ConfigKeys;
|
||||
import me.lucko.luckperms.common.constants.Message;
|
||||
import me.lucko.luckperms.common.constants.Permission;
|
||||
import me.lucko.luckperms.common.core.model.Group;
|
||||
import me.lucko.luckperms.common.core.model.Track;
|
||||
import me.lucko.luckperms.common.core.model.User;
|
||||
import me.lucko.luckperms.common.locale.LocalizedSpec;
|
||||
import me.lucko.luckperms.common.locale.Message;
|
||||
import me.lucko.luckperms.common.messaging.InternalMessagingService;
|
||||
import me.lucko.luckperms.common.messaging.NoopMessagingService;
|
||||
import me.lucko.luckperms.common.plugin.LuckPermsPlugin;
|
||||
@ -58,8 +59,8 @@ import java.util.stream.Collectors;
|
||||
@Getter
|
||||
public abstract class SubCommand<T> extends Command<T, Void> {
|
||||
|
||||
public SubCommand(String name, String description, Permission permission, Predicate<Integer> argumentCheck, List<Arg> args) {
|
||||
super(name, description, permission, argumentCheck, args);
|
||||
public SubCommand(LocalizedSpec spec, String name, Permission permission, Predicate<Integer> argumentCheck) {
|
||||
super(spec, name, permission, argumentCheck);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -31,24 +31,26 @@ import me.lucko.luckperms.api.ChatMetaType;
|
||||
import me.lucko.luckperms.common.commands.abstraction.SharedMainCommand;
|
||||
import me.lucko.luckperms.common.commands.abstraction.SharedSubCommand;
|
||||
import me.lucko.luckperms.common.core.model.PermissionHolder;
|
||||
import me.lucko.luckperms.common.locale.CommandSpec;
|
||||
import me.lucko.luckperms.common.locale.LocaleManager;
|
||||
|
||||
public class CommandMeta<T extends PermissionHolder> extends SharedMainCommand<T> {
|
||||
public CommandMeta(boolean user) {
|
||||
super("Meta", "Edit metadata values", user, ImmutableList.<SharedSubCommand>builder()
|
||||
.add(new MetaInfo())
|
||||
.add(new MetaSet())
|
||||
.add(new MetaUnset())
|
||||
.add(new MetaSetTemp())
|
||||
.add(new MetaUnsetTemp())
|
||||
.add(new MetaAddChatMeta(ChatMetaType.PREFIX))
|
||||
.add(new MetaAddChatMeta(ChatMetaType.SUFFIX))
|
||||
.add(new MetaRemoveChatMeta(ChatMetaType.PREFIX))
|
||||
.add(new MetaRemoveChatMeta(ChatMetaType.SUFFIX))
|
||||
.add(new MetaAddTempChatMeta(ChatMetaType.PREFIX))
|
||||
.add(new MetaAddTempChatMeta(ChatMetaType.SUFFIX))
|
||||
.add(new MetaRemoveTempChatMeta(ChatMetaType.PREFIX))
|
||||
.add(new MetaRemoveTempChatMeta(ChatMetaType.SUFFIX))
|
||||
.add(new MetaClear())
|
||||
public CommandMeta(LocaleManager locale, boolean user) {
|
||||
super(CommandSpec.META.spec(locale), "Meta", user, ImmutableList.<SharedSubCommand>builder()
|
||||
.add(new MetaInfo(locale))
|
||||
.add(new MetaSet(locale))
|
||||
.add(new MetaUnset(locale))
|
||||
.add(new MetaSetTemp(locale))
|
||||
.add(new MetaUnsetTemp(locale))
|
||||
.add(new MetaAddChatMeta(locale, ChatMetaType.PREFIX))
|
||||
.add(new MetaAddChatMeta(locale, ChatMetaType.SUFFIX))
|
||||
.add(new MetaRemoveChatMeta(locale, ChatMetaType.PREFIX))
|
||||
.add(new MetaRemoveChatMeta(locale, ChatMetaType.SUFFIX))
|
||||
.add(new MetaAddTempChatMeta(locale, ChatMetaType.PREFIX))
|
||||
.add(new MetaAddTempChatMeta(locale, ChatMetaType.SUFFIX))
|
||||
.add(new MetaRemoveTempChatMeta(locale, ChatMetaType.PREFIX))
|
||||
.add(new MetaRemoveTempChatMeta(locale, ChatMetaType.SUFFIX))
|
||||
.add(new MetaClear(locale))
|
||||
.build());
|
||||
}
|
||||
}
|
||||
|
@ -28,18 +28,19 @@ package me.lucko.luckperms.common.commands.impl.generic.meta;
|
||||
import me.lucko.luckperms.api.ChatMetaType;
|
||||
import me.lucko.luckperms.api.DataMutateResult;
|
||||
import me.lucko.luckperms.api.context.MutableContextSet;
|
||||
import me.lucko.luckperms.common.commands.Arg;
|
||||
import me.lucko.luckperms.common.commands.CommandException;
|
||||
import me.lucko.luckperms.common.commands.CommandResult;
|
||||
import me.lucko.luckperms.common.commands.abstraction.SharedSubCommand;
|
||||
import me.lucko.luckperms.common.commands.sender.Sender;
|
||||
import me.lucko.luckperms.common.commands.utils.ArgumentUtils;
|
||||
import me.lucko.luckperms.common.commands.utils.Util;
|
||||
import me.lucko.luckperms.common.constants.Message;
|
||||
import me.lucko.luckperms.common.constants.Permission;
|
||||
import me.lucko.luckperms.common.core.NodeFactory;
|
||||
import me.lucko.luckperms.common.core.model.PermissionHolder;
|
||||
import me.lucko.luckperms.common.data.LogEntry;
|
||||
import me.lucko.luckperms.common.locale.CommandSpec;
|
||||
import me.lucko.luckperms.common.locale.LocaleManager;
|
||||
import me.lucko.luckperms.common.locale.Message;
|
||||
import me.lucko.luckperms.common.plugin.LuckPermsPlugin;
|
||||
import me.lucko.luckperms.common.utils.Predicates;
|
||||
|
||||
@ -49,17 +50,13 @@ import java.util.stream.Collectors;
|
||||
public class MetaAddChatMeta extends SharedSubCommand {
|
||||
private final ChatMetaType type;
|
||||
|
||||
public MetaAddChatMeta(ChatMetaType type) {
|
||||
super("add" + type.name().toLowerCase(),
|
||||
"Adds a " + type.name().toLowerCase(),
|
||||
public MetaAddChatMeta(LocaleManager locale, ChatMetaType type) {
|
||||
super(
|
||||
type == ChatMetaType.PREFIX ? CommandSpec.META_ADDPREFIX.spec(locale) : CommandSpec.META_ADDSUFFIX.spec(locale),
|
||||
"add" + type.name().toLowerCase(),
|
||||
type == ChatMetaType.PREFIX ? Permission.USER_META_ADDPREFIX : Permission.USER_META_ADDSUFFIX,
|
||||
type == ChatMetaType.PREFIX ? Permission.GROUP_META_ADDPREFIX : Permission.GROUP_META_ADDSUFFIX,
|
||||
Predicates.inRange(0, 1),
|
||||
Arg.list(
|
||||
Arg.create("priority", true, "the priority to add the " + type.name().toLowerCase() + " at"),
|
||||
Arg.create(type.name().toLowerCase(), true, "the " + type.name().toLowerCase() + " string"),
|
||||
Arg.create("context...", false, "the contexts to add the " + type.name().toLowerCase() + " in")
|
||||
)
|
||||
Predicates.inRange(0, 1)
|
||||
);
|
||||
this.type = type;
|
||||
}
|
||||
|
@ -29,7 +29,6 @@ import me.lucko.luckperms.api.ChatMetaType;
|
||||
import me.lucko.luckperms.api.DataMutateResult;
|
||||
import me.lucko.luckperms.api.Node;
|
||||
import me.lucko.luckperms.api.context.MutableContextSet;
|
||||
import me.lucko.luckperms.common.commands.Arg;
|
||||
import me.lucko.luckperms.common.commands.CommandException;
|
||||
import me.lucko.luckperms.common.commands.CommandResult;
|
||||
import me.lucko.luckperms.common.commands.abstraction.SharedSubCommand;
|
||||
@ -37,12 +36,14 @@ import me.lucko.luckperms.common.commands.sender.Sender;
|
||||
import me.lucko.luckperms.common.commands.utils.ArgumentUtils;
|
||||
import me.lucko.luckperms.common.commands.utils.Util;
|
||||
import me.lucko.luckperms.common.config.ConfigKeys;
|
||||
import me.lucko.luckperms.common.constants.Message;
|
||||
import me.lucko.luckperms.common.constants.Permission;
|
||||
import me.lucko.luckperms.common.core.NodeFactory;
|
||||
import me.lucko.luckperms.common.core.TemporaryModifier;
|
||||
import me.lucko.luckperms.common.core.model.PermissionHolder;
|
||||
import me.lucko.luckperms.common.data.LogEntry;
|
||||
import me.lucko.luckperms.common.locale.CommandSpec;
|
||||
import me.lucko.luckperms.common.locale.LocaleManager;
|
||||
import me.lucko.luckperms.common.locale.Message;
|
||||
import me.lucko.luckperms.common.plugin.LuckPermsPlugin;
|
||||
import me.lucko.luckperms.common.utils.DateUtil;
|
||||
import me.lucko.luckperms.common.utils.Predicates;
|
||||
@ -54,18 +55,13 @@ import java.util.stream.Collectors;
|
||||
public class MetaAddTempChatMeta extends SharedSubCommand {
|
||||
private final ChatMetaType type;
|
||||
|
||||
public MetaAddTempChatMeta(ChatMetaType type) {
|
||||
super("addtemp" + type.name().toLowerCase(),
|
||||
"Adds a " + type.name().toLowerCase() + " temporarily",
|
||||
public MetaAddTempChatMeta(LocaleManager locale, ChatMetaType type) {
|
||||
super(
|
||||
type == ChatMetaType.PREFIX ? CommandSpec.META_ADDTEMP_PREFIX.spec(locale) : CommandSpec.META_ADDTEMP_SUFFIX.spec(locale),
|
||||
"addtemp" + type.name().toLowerCase(),
|
||||
type == ChatMetaType.PREFIX ? Permission.USER_META_ADDTEMP_PREFIX : Permission.USER_META_ADDTEMP_SUFFIX,
|
||||
type == ChatMetaType.PREFIX ? Permission.GROUP_META_ADDTEMP_PREFIX : Permission.GROUP_META_ADDTEMP_SUFFIX,
|
||||
Predicates.inRange(0, 2),
|
||||
Arg.list(
|
||||
Arg.create("priority", true, "the priority to add the " + type.name().toLowerCase() + " at"),
|
||||
Arg.create(type.name().toLowerCase(), true, "the " + type.name().toLowerCase() + " string"),
|
||||
Arg.create("duration", true, "the duration until the " + type.name().toLowerCase() + " expires"),
|
||||
Arg.create("context...", false, "the contexts to add the " + type.name().toLowerCase() + " in")
|
||||
)
|
||||
Predicates.inRange(0, 2)
|
||||
);
|
||||
this.type = type;
|
||||
}
|
||||
|
@ -26,17 +26,18 @@
|
||||
package me.lucko.luckperms.common.commands.impl.generic.meta;
|
||||
|
||||
import me.lucko.luckperms.api.context.MutableContextSet;
|
||||
import me.lucko.luckperms.common.commands.Arg;
|
||||
import me.lucko.luckperms.common.commands.CommandException;
|
||||
import me.lucko.luckperms.common.commands.CommandResult;
|
||||
import me.lucko.luckperms.common.commands.abstraction.SharedSubCommand;
|
||||
import me.lucko.luckperms.common.commands.sender.Sender;
|
||||
import me.lucko.luckperms.common.commands.utils.ArgumentUtils;
|
||||
import me.lucko.luckperms.common.commands.utils.Util;
|
||||
import me.lucko.luckperms.common.constants.Message;
|
||||
import me.lucko.luckperms.common.constants.Permission;
|
||||
import me.lucko.luckperms.common.core.model.PermissionHolder;
|
||||
import me.lucko.luckperms.common.data.LogEntry;
|
||||
import me.lucko.luckperms.common.locale.CommandSpec;
|
||||
import me.lucko.luckperms.common.locale.LocaleManager;
|
||||
import me.lucko.luckperms.common.locale.Message;
|
||||
import me.lucko.luckperms.common.plugin.LuckPermsPlugin;
|
||||
import me.lucko.luckperms.common.utils.Predicates;
|
||||
|
||||
@ -44,12 +45,8 @@ import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
public class MetaClear extends SharedSubCommand {
|
||||
public MetaClear() {
|
||||
super("clear", "Clears all chat meta", Permission.USER_META_CLEAR, Permission.GROUP_META_CLEAR, Predicates.alwaysFalse(),
|
||||
Arg.list(
|
||||
Arg.create("context...", false, "the contexts to filter by")
|
||||
)
|
||||
);
|
||||
public MetaClear(LocaleManager locale) {
|
||||
super(CommandSpec.META_CLEAR.spec(locale), "clear", Permission.USER_META_CLEAR, Permission.GROUP_META_CLEAR, Predicates.alwaysFalse());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -32,9 +32,11 @@ import me.lucko.luckperms.common.commands.abstraction.SharedSubCommand;
|
||||
import me.lucko.luckperms.common.commands.sender.Sender;
|
||||
import me.lucko.luckperms.common.commands.utils.MetaComparator;
|
||||
import me.lucko.luckperms.common.commands.utils.Util;
|
||||
import me.lucko.luckperms.common.constants.Message;
|
||||
import me.lucko.luckperms.common.constants.Permission;
|
||||
import me.lucko.luckperms.common.core.model.PermissionHolder;
|
||||
import me.lucko.luckperms.common.locale.CommandSpec;
|
||||
import me.lucko.luckperms.common.locale.LocaleManager;
|
||||
import me.lucko.luckperms.common.locale.Message;
|
||||
import me.lucko.luckperms.common.plugin.LuckPermsPlugin;
|
||||
import me.lucko.luckperms.common.utils.Predicates;
|
||||
|
||||
@ -55,8 +57,8 @@ public class MetaInfo extends SharedSubCommand {
|
||||
return val.replace("&", "{color char}");
|
||||
}
|
||||
|
||||
public MetaInfo() {
|
||||
super("info", "Shows all chat meta", Permission.USER_META_INFO, Permission.GROUP_META_INFO, Predicates.alwaysFalse(), null);
|
||||
public MetaInfo(LocaleManager locale) {
|
||||
super(CommandSpec.META_INFO.spec(locale), "info", Permission.USER_META_INFO, Permission.GROUP_META_INFO, Predicates.alwaysFalse());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -28,18 +28,19 @@ package me.lucko.luckperms.common.commands.impl.generic.meta;
|
||||
import me.lucko.luckperms.api.ChatMetaType;
|
||||
import me.lucko.luckperms.api.DataMutateResult;
|
||||
import me.lucko.luckperms.api.context.MutableContextSet;
|
||||
import me.lucko.luckperms.common.commands.Arg;
|
||||
import me.lucko.luckperms.common.commands.CommandException;
|
||||
import me.lucko.luckperms.common.commands.CommandResult;
|
||||
import me.lucko.luckperms.common.commands.abstraction.SharedSubCommand;
|
||||
import me.lucko.luckperms.common.commands.sender.Sender;
|
||||
import me.lucko.luckperms.common.commands.utils.ArgumentUtils;
|
||||
import me.lucko.luckperms.common.commands.utils.Util;
|
||||
import me.lucko.luckperms.common.constants.Message;
|
||||
import me.lucko.luckperms.common.constants.Permission;
|
||||
import me.lucko.luckperms.common.core.NodeFactory;
|
||||
import me.lucko.luckperms.common.core.model.PermissionHolder;
|
||||
import me.lucko.luckperms.common.data.LogEntry;
|
||||
import me.lucko.luckperms.common.locale.CommandSpec;
|
||||
import me.lucko.luckperms.common.locale.LocaleManager;
|
||||
import me.lucko.luckperms.common.locale.Message;
|
||||
import me.lucko.luckperms.common.plugin.LuckPermsPlugin;
|
||||
import me.lucko.luckperms.common.utils.Predicates;
|
||||
|
||||
@ -49,17 +50,13 @@ import java.util.stream.Collectors;
|
||||
public class MetaRemoveChatMeta extends SharedSubCommand {
|
||||
private final ChatMetaType type;
|
||||
|
||||
public MetaRemoveChatMeta(ChatMetaType type) {
|
||||
super("remove" + type.name().toLowerCase(),
|
||||
"Removes a " + type.name().toLowerCase(),
|
||||
public MetaRemoveChatMeta(LocaleManager locale, ChatMetaType type) {
|
||||
super(
|
||||
type == ChatMetaType.PREFIX ? CommandSpec.META_REMOVEPREFIX.spec(locale) : CommandSpec.META_REMOVESUFFIX.spec(locale),
|
||||
"remove" + type.name().toLowerCase(),
|
||||
type == ChatMetaType.PREFIX ? Permission.USER_META_REMOVEPREFIX : Permission.USER_META_REMOVESUFFIX,
|
||||
type == ChatMetaType.PREFIX ? Permission.GROUP_META_REMOVEPREFIX : Permission.GROUP_META_REMOVESUFFIX,
|
||||
Predicates.is(0),
|
||||
Arg.list(
|
||||
Arg.create("priority", true, "the priority to remove the " + type.name().toLowerCase() + " at"),
|
||||
Arg.create(type.name().toLowerCase(), false, "the " + type.name().toLowerCase() + " string"),
|
||||
Arg.create("context...", false, "the contexts to remove the " + type.name().toLowerCase() + " in")
|
||||
)
|
||||
Predicates.is(0)
|
||||
);
|
||||
this.type = type;
|
||||
}
|
||||
|
@ -28,18 +28,19 @@ package me.lucko.luckperms.common.commands.impl.generic.meta;
|
||||
import me.lucko.luckperms.api.ChatMetaType;
|
||||
import me.lucko.luckperms.api.DataMutateResult;
|
||||
import me.lucko.luckperms.api.context.MutableContextSet;
|
||||
import me.lucko.luckperms.common.commands.Arg;
|
||||
import me.lucko.luckperms.common.commands.CommandException;
|
||||
import me.lucko.luckperms.common.commands.CommandResult;
|
||||
import me.lucko.luckperms.common.commands.abstraction.SharedSubCommand;
|
||||
import me.lucko.luckperms.common.commands.sender.Sender;
|
||||
import me.lucko.luckperms.common.commands.utils.ArgumentUtils;
|
||||
import me.lucko.luckperms.common.commands.utils.Util;
|
||||
import me.lucko.luckperms.common.constants.Message;
|
||||
import me.lucko.luckperms.common.constants.Permission;
|
||||
import me.lucko.luckperms.common.core.NodeFactory;
|
||||
import me.lucko.luckperms.common.core.model.PermissionHolder;
|
||||
import me.lucko.luckperms.common.data.LogEntry;
|
||||
import me.lucko.luckperms.common.locale.CommandSpec;
|
||||
import me.lucko.luckperms.common.locale.LocaleManager;
|
||||
import me.lucko.luckperms.common.locale.Message;
|
||||
import me.lucko.luckperms.common.plugin.LuckPermsPlugin;
|
||||
import me.lucko.luckperms.common.utils.Predicates;
|
||||
|
||||
@ -49,17 +50,13 @@ import java.util.stream.Collectors;
|
||||
public class MetaRemoveTempChatMeta extends SharedSubCommand {
|
||||
private final ChatMetaType type;
|
||||
|
||||
public MetaRemoveTempChatMeta(ChatMetaType type) {
|
||||
super("removetemp" +type.name().toLowerCase(),
|
||||
"Removes a temporary " + type.name().toLowerCase(),
|
||||
public MetaRemoveTempChatMeta(LocaleManager locale, ChatMetaType type) {
|
||||
super(
|
||||
type == ChatMetaType.PREFIX ? CommandSpec.META_REMOVETEMP_PREFIX.spec(locale) : CommandSpec.META_REMOVETEMP_SUFFIX.spec(locale),
|
||||
"removetemp" + type.name().toLowerCase(),
|
||||
type == ChatMetaType.PREFIX ? Permission.USER_META_REMOVETEMP_PREFIX : Permission.USER_META_REMOVETEMP_SUFFIX,
|
||||
type == ChatMetaType.PREFIX ? Permission.GROUP_META_REMOVETEMP_PREFIX : Permission.GROUP_META_REMOVETEMP_SUFFIX,
|
||||
Predicates.is(0),
|
||||
Arg.list(
|
||||
Arg.create("priority", true, "the priority to remove the " + type.name().toLowerCase() + " at"),
|
||||
Arg.create(type.name().toLowerCase(), false, "the " +type.name().toLowerCase() + " string"),
|
||||
Arg.create("context...", false, "the contexts to remove the " + type.name().toLowerCase() + " in")
|
||||
)
|
||||
Predicates.is(0)
|
||||
);
|
||||
this.type = type;
|
||||
}
|
||||
|
@ -27,18 +27,19 @@ package me.lucko.luckperms.common.commands.impl.generic.meta;
|
||||
|
||||
import me.lucko.luckperms.api.Node;
|
||||
import me.lucko.luckperms.api.context.MutableContextSet;
|
||||
import me.lucko.luckperms.common.commands.Arg;
|
||||
import me.lucko.luckperms.common.commands.CommandException;
|
||||
import me.lucko.luckperms.common.commands.CommandResult;
|
||||
import me.lucko.luckperms.common.commands.abstraction.SharedSubCommand;
|
||||
import me.lucko.luckperms.common.commands.sender.Sender;
|
||||
import me.lucko.luckperms.common.commands.utils.ArgumentUtils;
|
||||
import me.lucko.luckperms.common.commands.utils.Util;
|
||||
import me.lucko.luckperms.common.constants.Message;
|
||||
import me.lucko.luckperms.common.constants.Permission;
|
||||
import me.lucko.luckperms.common.core.NodeFactory;
|
||||
import me.lucko.luckperms.common.core.model.PermissionHolder;
|
||||
import me.lucko.luckperms.common.data.LogEntry;
|
||||
import me.lucko.luckperms.common.locale.CommandSpec;
|
||||
import me.lucko.luckperms.common.locale.LocaleManager;
|
||||
import me.lucko.luckperms.common.locale.Message;
|
||||
import me.lucko.luckperms.common.plugin.LuckPermsPlugin;
|
||||
import me.lucko.luckperms.common.utils.Predicates;
|
||||
|
||||
@ -46,14 +47,8 @@ import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
public class MetaSet extends SharedSubCommand {
|
||||
public MetaSet() {
|
||||
super("set", "Sets a meta value", Permission.USER_META_SET, Permission.GROUP_META_SET, Predicates.inRange(0, 1),
|
||||
Arg.list(
|
||||
Arg.create("key", true, "the key to set"),
|
||||
Arg.create("value", true, "the value to set"),
|
||||
Arg.create("context...", false, "the contexts to add the meta pair in")
|
||||
)
|
||||
);
|
||||
public MetaSet(LocaleManager locale) {
|
||||
super(CommandSpec.META_SET.spec(locale), "set", Permission.USER_META_SET, Permission.GROUP_META_SET, Predicates.inRange(0, 1));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -27,7 +27,6 @@ package me.lucko.luckperms.common.commands.impl.generic.meta;
|
||||
|
||||
import me.lucko.luckperms.api.Node;
|
||||
import me.lucko.luckperms.api.context.MutableContextSet;
|
||||
import me.lucko.luckperms.common.commands.Arg;
|
||||
import me.lucko.luckperms.common.commands.CommandException;
|
||||
import me.lucko.luckperms.common.commands.CommandResult;
|
||||
import me.lucko.luckperms.common.commands.abstraction.SharedSubCommand;
|
||||
@ -35,12 +34,14 @@ import me.lucko.luckperms.common.commands.sender.Sender;
|
||||
import me.lucko.luckperms.common.commands.utils.ArgumentUtils;
|
||||
import me.lucko.luckperms.common.commands.utils.Util;
|
||||
import me.lucko.luckperms.common.config.ConfigKeys;
|
||||
import me.lucko.luckperms.common.constants.Message;
|
||||
import me.lucko.luckperms.common.constants.Permission;
|
||||
import me.lucko.luckperms.common.core.NodeFactory;
|
||||
import me.lucko.luckperms.common.core.TemporaryModifier;
|
||||
import me.lucko.luckperms.common.core.model.PermissionHolder;
|
||||
import me.lucko.luckperms.common.data.LogEntry;
|
||||
import me.lucko.luckperms.common.locale.CommandSpec;
|
||||
import me.lucko.luckperms.common.locale.LocaleManager;
|
||||
import me.lucko.luckperms.common.locale.Message;
|
||||
import me.lucko.luckperms.common.plugin.LuckPermsPlugin;
|
||||
import me.lucko.luckperms.common.utils.DateUtil;
|
||||
import me.lucko.luckperms.common.utils.Predicates;
|
||||
@ -49,15 +50,8 @@ import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
public class MetaSetTemp extends SharedSubCommand {
|
||||
public MetaSetTemp() {
|
||||
super("settemp", "Sets a meta value temporarily", Permission.USER_META_SETTEMP, Permission.GROUP_META_SETTEMP, Predicates.inRange(0, 2),
|
||||
Arg.list(
|
||||
Arg.create("key", true, "the key to set"),
|
||||
Arg.create("value", true, "the value to set"),
|
||||
Arg.create("duration", true, "the duration until the meta value expires"),
|
||||
Arg.create("context...", false, "the contexts to add the meta pair in")
|
||||
)
|
||||
);
|
||||
public MetaSetTemp(LocaleManager locale) {
|
||||
super(CommandSpec.META_SETTEMP.spec(locale), "settemp", Permission.USER_META_SETTEMP, Permission.GROUP_META_SETTEMP, Predicates.inRange(0, 2));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -26,17 +26,18 @@
|
||||
package me.lucko.luckperms.common.commands.impl.generic.meta;
|
||||
|
||||
import me.lucko.luckperms.api.context.MutableContextSet;
|
||||
import me.lucko.luckperms.common.commands.Arg;
|
||||
import me.lucko.luckperms.common.commands.CommandException;
|
||||
import me.lucko.luckperms.common.commands.CommandResult;
|
||||
import me.lucko.luckperms.common.commands.abstraction.SharedSubCommand;
|
||||
import me.lucko.luckperms.common.commands.sender.Sender;
|
||||
import me.lucko.luckperms.common.commands.utils.ArgumentUtils;
|
||||
import me.lucko.luckperms.common.commands.utils.Util;
|
||||
import me.lucko.luckperms.common.constants.Message;
|
||||
import me.lucko.luckperms.common.constants.Permission;
|
||||
import me.lucko.luckperms.common.core.model.PermissionHolder;
|
||||
import me.lucko.luckperms.common.data.LogEntry;
|
||||
import me.lucko.luckperms.common.locale.CommandSpec;
|
||||
import me.lucko.luckperms.common.locale.LocaleManager;
|
||||
import me.lucko.luckperms.common.locale.Message;
|
||||
import me.lucko.luckperms.common.plugin.LuckPermsPlugin;
|
||||
import me.lucko.luckperms.common.utils.Predicates;
|
||||
|
||||
@ -44,14 +45,8 @@ import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
public class MetaUnset extends SharedSubCommand {
|
||||
public MetaUnset() {
|
||||
super("unset", "Unsets a meta value", Permission.USER_META_UNSET, Permission.GROUP_META_UNSET,
|
||||
Predicates.is(0),
|
||||
Arg.list(
|
||||
Arg.create("key", true, "the key to unset"),
|
||||
Arg.create("context...", false, "the contexts to remove the meta pair in")
|
||||
)
|
||||
);
|
||||
public MetaUnset(LocaleManager locale) {
|
||||
super(CommandSpec.META_UNSET.spec(locale), "unset", Permission.USER_META_UNSET, Permission.GROUP_META_UNSET, Predicates.is(0));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -26,17 +26,18 @@
|
||||
package me.lucko.luckperms.common.commands.impl.generic.meta;
|
||||
|
||||
import me.lucko.luckperms.api.context.MutableContextSet;
|
||||
import me.lucko.luckperms.common.commands.Arg;
|
||||
import me.lucko.luckperms.common.commands.CommandException;
|
||||
import me.lucko.luckperms.common.commands.CommandResult;
|
||||
import me.lucko.luckperms.common.commands.abstraction.SharedSubCommand;
|
||||
import me.lucko.luckperms.common.commands.sender.Sender;
|
||||
import me.lucko.luckperms.common.commands.utils.ArgumentUtils;
|
||||
import me.lucko.luckperms.common.commands.utils.Util;
|
||||
import me.lucko.luckperms.common.constants.Message;
|
||||
import me.lucko.luckperms.common.constants.Permission;
|
||||
import me.lucko.luckperms.common.core.model.PermissionHolder;
|
||||
import me.lucko.luckperms.common.data.LogEntry;
|
||||
import me.lucko.luckperms.common.locale.CommandSpec;
|
||||
import me.lucko.luckperms.common.locale.LocaleManager;
|
||||
import me.lucko.luckperms.common.locale.Message;
|
||||
import me.lucko.luckperms.common.plugin.LuckPermsPlugin;
|
||||
import me.lucko.luckperms.common.utils.Predicates;
|
||||
|
||||
@ -44,14 +45,8 @@ import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
public class MetaUnsetTemp extends SharedSubCommand {
|
||||
public MetaUnsetTemp() {
|
||||
super("unsettemp", "Unsets a temporary meta value", Permission.USER_META_UNSETTEMP, Permission.GROUP_META_UNSETTEMP,
|
||||
Predicates.is(0),
|
||||
Arg.list(
|
||||
Arg.create("key", true, "the key to unset"),
|
||||
Arg.create("context...", false, "the contexts to remove the meta pair in")
|
||||
)
|
||||
);
|
||||
public MetaUnsetTemp(LocaleManager locale) {
|
||||
super(CommandSpec.META_UNSETTEMP.spec(locale), "unsettemp", Permission.USER_META_UNSETTEMP, Permission.GROUP_META_UNSETTEMP, Predicates.is(0));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -26,19 +26,20 @@
|
||||
package me.lucko.luckperms.common.commands.impl.generic.other;
|
||||
|
||||
import me.lucko.luckperms.api.context.MutableContextSet;
|
||||
import me.lucko.luckperms.common.commands.Arg;
|
||||
import me.lucko.luckperms.common.commands.CommandException;
|
||||
import me.lucko.luckperms.common.commands.CommandResult;
|
||||
import me.lucko.luckperms.common.commands.abstraction.SubCommand;
|
||||
import me.lucko.luckperms.common.commands.sender.Sender;
|
||||
import me.lucko.luckperms.common.commands.utils.ArgumentUtils;
|
||||
import me.lucko.luckperms.common.commands.utils.Util;
|
||||
import me.lucko.luckperms.common.constants.Message;
|
||||
import me.lucko.luckperms.common.constants.Permission;
|
||||
import me.lucko.luckperms.common.core.model.Group;
|
||||
import me.lucko.luckperms.common.core.model.PermissionHolder;
|
||||
import me.lucko.luckperms.common.core.model.User;
|
||||
import me.lucko.luckperms.common.data.LogEntry;
|
||||
import me.lucko.luckperms.common.locale.CommandSpec;
|
||||
import me.lucko.luckperms.common.locale.LocaleManager;
|
||||
import me.lucko.luckperms.common.locale.Message;
|
||||
import me.lucko.luckperms.common.plugin.LuckPermsPlugin;
|
||||
import me.lucko.luckperms.common.utils.Predicates;
|
||||
|
||||
@ -46,13 +47,8 @@ import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
public class HolderClear<T extends PermissionHolder> extends SubCommand<T> {
|
||||
public HolderClear(boolean user) {
|
||||
super("clear", "Removes all permissions, parents and meta", user ? Permission.USER_CLEAR : Permission.GROUP_CLEAR,
|
||||
Predicates.alwaysFalse(),
|
||||
Arg.list(
|
||||
Arg.create("context...", false, "the contexts to filter by")
|
||||
)
|
||||
);
|
||||
public HolderClear(LocaleManager locale, boolean user) {
|
||||
super(CommandSpec.HOLDER_CLEAR.spec(locale), "clear", user ? Permission.USER_CLEAR : Permission.GROUP_CLEAR, Predicates.alwaysFalse());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -37,12 +37,14 @@ import me.lucko.luckperms.common.commands.CommandResult;
|
||||
import me.lucko.luckperms.common.commands.abstraction.SubCommand;
|
||||
import me.lucko.luckperms.common.commands.sender.Sender;
|
||||
import me.lucko.luckperms.common.config.ConfigKeys;
|
||||
import me.lucko.luckperms.common.constants.Message;
|
||||
import me.lucko.luckperms.common.constants.Permission;
|
||||
import me.lucko.luckperms.common.core.NodeModel;
|
||||
import me.lucko.luckperms.common.core.model.Group;
|
||||
import me.lucko.luckperms.common.core.model.PermissionHolder;
|
||||
import me.lucko.luckperms.common.core.model.User;
|
||||
import me.lucko.luckperms.common.locale.CommandSpec;
|
||||
import me.lucko.luckperms.common.locale.LocaleManager;
|
||||
import me.lucko.luckperms.common.locale.Message;
|
||||
import me.lucko.luckperms.common.plugin.LuckPermsPlugin;
|
||||
import me.lucko.luckperms.common.utils.Predicates;
|
||||
|
||||
@ -68,10 +70,8 @@ public class HolderEditor<T extends PermissionHolder> extends SubCommand<T> {
|
||||
private static final String GROUP_ID_PATTERN = "group/";
|
||||
private static final String FILE_NAME = "luckperms-data.json";
|
||||
|
||||
public HolderEditor(boolean user) {
|
||||
super("editor", "Opens the web permission editor", user ? Permission.USER_EDITOR : Permission.GROUP_EDITOR,
|
||||
Predicates.alwaysFalse(), null
|
||||
);
|
||||
public HolderEditor(LocaleManager locale, boolean user) {
|
||||
super(CommandSpec.HOLDER_EDITOR.spec(locale), "editor", user ? Permission.USER_EDITOR : Permission.GROUP_EDITOR, Predicates.alwaysFalse());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -31,9 +31,11 @@ import me.lucko.luckperms.common.commands.CommandResult;
|
||||
import me.lucko.luckperms.common.commands.abstraction.SubCommand;
|
||||
import me.lucko.luckperms.common.commands.sender.Sender;
|
||||
import me.lucko.luckperms.common.commands.utils.Util;
|
||||
import me.lucko.luckperms.common.constants.Message;
|
||||
import me.lucko.luckperms.common.constants.Permission;
|
||||
import me.lucko.luckperms.common.core.model.PermissionHolder;
|
||||
import me.lucko.luckperms.common.locale.CommandSpec;
|
||||
import me.lucko.luckperms.common.locale.LocaleManager;
|
||||
import me.lucko.luckperms.common.locale.Message;
|
||||
import me.lucko.luckperms.common.plugin.LuckPermsPlugin;
|
||||
import me.lucko.luckperms.common.utils.Predicates;
|
||||
|
||||
@ -42,9 +44,8 @@ import java.util.Set;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
public class HolderShowTracks<T extends PermissionHolder> extends SubCommand<T> {
|
||||
public HolderShowTracks(boolean user) {
|
||||
super("showtracks", "Lists the tracks that the object is on",
|
||||
user ? Permission.USER_SHOWTRACKS : Permission.GROUP_SHOWTRACKS, Predicates.alwaysFalse(), null);
|
||||
public HolderShowTracks(LocaleManager locale, boolean user) {
|
||||
super(CommandSpec.HOLDER_SHOWTRACKS.spec(locale), "showtracks", user ? Permission.USER_SHOWTRACKS : Permission.GROUP_SHOWTRACKS, Predicates.alwaysFalse());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -30,19 +30,21 @@ import com.google.common.collect.ImmutableList;
|
||||
import me.lucko.luckperms.common.commands.abstraction.SharedMainCommand;
|
||||
import me.lucko.luckperms.common.commands.abstraction.SharedSubCommand;
|
||||
import me.lucko.luckperms.common.core.model.PermissionHolder;
|
||||
import me.lucko.luckperms.common.locale.CommandSpec;
|
||||
import me.lucko.luckperms.common.locale.LocaleManager;
|
||||
|
||||
public class CommandParent<T extends PermissionHolder> extends SharedMainCommand<T> {
|
||||
public CommandParent(boolean user) {
|
||||
super("Parent", "Edit inheritances", user, ImmutableList.<SharedSubCommand>builder()
|
||||
.add(new ParentInfo())
|
||||
.add(new ParentSet())
|
||||
.add(new ParentAdd())
|
||||
.add(new ParentRemove())
|
||||
.add(new ParentSetTrack())
|
||||
.add(new ParentAddTemp())
|
||||
.add(new ParentRemoveTemp())
|
||||
.add(new ParentClear())
|
||||
.add(new ParentClearTrack())
|
||||
public CommandParent(LocaleManager locale, boolean user) {
|
||||
super(CommandSpec.PARENT.spec(locale), "Parent", user, ImmutableList.<SharedSubCommand>builder()
|
||||
.add(new ParentInfo(locale))
|
||||
.add(new ParentSet(locale))
|
||||
.add(new ParentAdd(locale))
|
||||
.add(new ParentRemove(locale))
|
||||
.add(new ParentSetTrack(locale))
|
||||
.add(new ParentAddTemp(locale))
|
||||
.add(new ParentRemoveTemp(locale))
|
||||
.add(new ParentClear(locale))
|
||||
.add(new ParentClearTrack(locale))
|
||||
.build());
|
||||
}
|
||||
}
|
||||
|
@ -27,18 +27,19 @@ package me.lucko.luckperms.common.commands.impl.generic.parent;
|
||||
|
||||
import me.lucko.luckperms.api.DataMutateResult;
|
||||
import me.lucko.luckperms.api.context.MutableContextSet;
|
||||
import me.lucko.luckperms.common.commands.Arg;
|
||||
import me.lucko.luckperms.common.commands.CommandException;
|
||||
import me.lucko.luckperms.common.commands.CommandResult;
|
||||
import me.lucko.luckperms.common.commands.abstraction.SharedSubCommand;
|
||||
import me.lucko.luckperms.common.commands.sender.Sender;
|
||||
import me.lucko.luckperms.common.commands.utils.ArgumentUtils;
|
||||
import me.lucko.luckperms.common.commands.utils.Util;
|
||||
import me.lucko.luckperms.common.constants.Message;
|
||||
import me.lucko.luckperms.common.constants.Permission;
|
||||
import me.lucko.luckperms.common.core.model.Group;
|
||||
import me.lucko.luckperms.common.core.model.PermissionHolder;
|
||||
import me.lucko.luckperms.common.data.LogEntry;
|
||||
import me.lucko.luckperms.common.locale.CommandSpec;
|
||||
import me.lucko.luckperms.common.locale.LocaleManager;
|
||||
import me.lucko.luckperms.common.locale.Message;
|
||||
import me.lucko.luckperms.common.plugin.LuckPermsPlugin;
|
||||
import me.lucko.luckperms.common.utils.Predicates;
|
||||
|
||||
@ -48,14 +49,8 @@ import java.util.stream.Collectors;
|
||||
import static me.lucko.luckperms.common.commands.abstraction.SubCommand.getGroupTabComplete;
|
||||
|
||||
public class ParentAdd extends SharedSubCommand {
|
||||
public ParentAdd() {
|
||||
super("add", "Sets another group for the object to inherit permissions from", Permission.USER_PARENT_ADD,
|
||||
Permission.GROUP_PARENT_ADD, Predicates.is(0),
|
||||
Arg.list(
|
||||
Arg.create("group", true, "the group to inherit from"),
|
||||
Arg.create("context...", false, "the contexts to inherit the group in")
|
||||
)
|
||||
);
|
||||
public ParentAdd(LocaleManager locale) {
|
||||
super(CommandSpec.PARENT_ADD.spec(locale), "add", Permission.USER_PARENT_ADD, Permission.GROUP_PARENT_ADD, Predicates.is(0));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -28,7 +28,6 @@ package me.lucko.luckperms.common.commands.impl.generic.parent;
|
||||
import me.lucko.luckperms.api.DataMutateResult;
|
||||
import me.lucko.luckperms.api.Node;
|
||||
import me.lucko.luckperms.api.context.MutableContextSet;
|
||||
import me.lucko.luckperms.common.commands.Arg;
|
||||
import me.lucko.luckperms.common.commands.CommandException;
|
||||
import me.lucko.luckperms.common.commands.CommandResult;
|
||||
import me.lucko.luckperms.common.commands.abstraction.SharedSubCommand;
|
||||
@ -36,13 +35,15 @@ import me.lucko.luckperms.common.commands.sender.Sender;
|
||||
import me.lucko.luckperms.common.commands.utils.ArgumentUtils;
|
||||
import me.lucko.luckperms.common.commands.utils.Util;
|
||||
import me.lucko.luckperms.common.config.ConfigKeys;
|
||||
import me.lucko.luckperms.common.constants.Message;
|
||||
import me.lucko.luckperms.common.constants.Permission;
|
||||
import me.lucko.luckperms.common.core.NodeFactory;
|
||||
import me.lucko.luckperms.common.core.TemporaryModifier;
|
||||
import me.lucko.luckperms.common.core.model.Group;
|
||||
import me.lucko.luckperms.common.core.model.PermissionHolder;
|
||||
import me.lucko.luckperms.common.data.LogEntry;
|
||||
import me.lucko.luckperms.common.locale.CommandSpec;
|
||||
import me.lucko.luckperms.common.locale.LocaleManager;
|
||||
import me.lucko.luckperms.common.locale.Message;
|
||||
import me.lucko.luckperms.common.plugin.LuckPermsPlugin;
|
||||
import me.lucko.luckperms.common.utils.DateUtil;
|
||||
import me.lucko.luckperms.common.utils.Predicates;
|
||||
@ -54,15 +55,8 @@ import java.util.stream.Collectors;
|
||||
import static me.lucko.luckperms.common.commands.abstraction.SubCommand.getGroupTabComplete;
|
||||
|
||||
public class ParentAddTemp extends SharedSubCommand {
|
||||
public ParentAddTemp() {
|
||||
super("addtemp", "Sets another group for the object to inherit permissions from temporarily",
|
||||
Permission.USER_PARENT_ADDTEMP, Permission.GROUP_PARENT_ADDTEMP, Predicates.inRange(0, 1),
|
||||
Arg.list(
|
||||
Arg.create("group", true, "the group to inherit from"),
|
||||
Arg.create("duration", true, "the duration of the group membership"),
|
||||
Arg.create("context...", false, "the contexts to inherit the group in")
|
||||
)
|
||||
);
|
||||
public ParentAddTemp(LocaleManager locale) {
|
||||
super(CommandSpec.PARENT_ADD_TEMP.spec(locale), "addtemp", Permission.USER_PARENT_ADDTEMP, Permission.GROUP_PARENT_ADDTEMP, Predicates.inRange(0, 1));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -26,17 +26,18 @@
|
||||
package me.lucko.luckperms.common.commands.impl.generic.parent;
|
||||
|
||||
import me.lucko.luckperms.api.context.MutableContextSet;
|
||||
import me.lucko.luckperms.common.commands.Arg;
|
||||
import me.lucko.luckperms.common.commands.CommandException;
|
||||
import me.lucko.luckperms.common.commands.CommandResult;
|
||||
import me.lucko.luckperms.common.commands.abstraction.SharedSubCommand;
|
||||
import me.lucko.luckperms.common.commands.sender.Sender;
|
||||
import me.lucko.luckperms.common.commands.utils.ArgumentUtils;
|
||||
import me.lucko.luckperms.common.commands.utils.Util;
|
||||
import me.lucko.luckperms.common.constants.Message;
|
||||
import me.lucko.luckperms.common.constants.Permission;
|
||||
import me.lucko.luckperms.common.core.model.PermissionHolder;
|
||||
import me.lucko.luckperms.common.data.LogEntry;
|
||||
import me.lucko.luckperms.common.locale.CommandSpec;
|
||||
import me.lucko.luckperms.common.locale.LocaleManager;
|
||||
import me.lucko.luckperms.common.locale.Message;
|
||||
import me.lucko.luckperms.common.plugin.LuckPermsPlugin;
|
||||
import me.lucko.luckperms.common.utils.Predicates;
|
||||
|
||||
@ -44,12 +45,8 @@ import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
public class ParentClear extends SharedSubCommand {
|
||||
public ParentClear() {
|
||||
super("clear", "Clears all parents", Permission.USER_PARENT_CLEAR, Permission.GROUP_PARENT_CLEAR, Predicates.alwaysFalse(),
|
||||
Arg.list(
|
||||
Arg.create("context...", false, "the contexts to filter by")
|
||||
)
|
||||
);
|
||||
public ParentClear(LocaleManager locale) {
|
||||
super(CommandSpec.PARENT_CLEAR.spec(locale), "clear", Permission.USER_PARENT_CLEAR, Permission.GROUP_PARENT_CLEAR, Predicates.alwaysFalse());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -26,7 +26,6 @@
|
||||
package me.lucko.luckperms.common.commands.impl.generic.parent;
|
||||
|
||||
import me.lucko.luckperms.api.context.MutableContextSet;
|
||||
import me.lucko.luckperms.common.commands.Arg;
|
||||
import me.lucko.luckperms.common.commands.CommandException;
|
||||
import me.lucko.luckperms.common.commands.CommandResult;
|
||||
import me.lucko.luckperms.common.commands.abstraction.SharedSubCommand;
|
||||
@ -34,12 +33,14 @@ import me.lucko.luckperms.common.commands.sender.Sender;
|
||||
import me.lucko.luckperms.common.commands.utils.ArgumentUtils;
|
||||
import me.lucko.luckperms.common.commands.utils.Util;
|
||||
import me.lucko.luckperms.common.constants.DataConstraints;
|
||||
import me.lucko.luckperms.common.constants.Message;
|
||||
import me.lucko.luckperms.common.constants.Permission;
|
||||
import me.lucko.luckperms.common.core.model.PermissionHolder;
|
||||
import me.lucko.luckperms.common.core.model.Track;
|
||||
import me.lucko.luckperms.common.core.model.User;
|
||||
import me.lucko.luckperms.common.data.LogEntry;
|
||||
import me.lucko.luckperms.common.locale.CommandSpec;
|
||||
import me.lucko.luckperms.common.locale.LocaleManager;
|
||||
import me.lucko.luckperms.common.locale.Message;
|
||||
import me.lucko.luckperms.common.plugin.LuckPermsPlugin;
|
||||
import me.lucko.luckperms.common.utils.Predicates;
|
||||
|
||||
@ -49,13 +50,8 @@ import java.util.stream.Collectors;
|
||||
import static me.lucko.luckperms.common.commands.abstraction.SubCommand.getTrackTabComplete;
|
||||
|
||||
public class ParentClearTrack extends SharedSubCommand {
|
||||
public ParentClearTrack() {
|
||||
super("cleartrack", "Clears all parents on a given track", Permission.USER_PARENT_CLEAR_TRACK, Permission.GROUP_PARENT_CLEAR_TRACK, Predicates.is(0),
|
||||
Arg.list(
|
||||
Arg.create("track", true, "the track to remove on"),
|
||||
Arg.create("context...", false, "the contexts to filter by")
|
||||
)
|
||||
);
|
||||
public ParentClearTrack(LocaleManager locale) {
|
||||
super(CommandSpec.PARENT_CLEAR_TRACK.spec(locale), "cleartrack", Permission.USER_PARENT_CLEAR_TRACK, Permission.GROUP_PARENT_CLEAR_TRACK, Predicates.is(0));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -32,9 +32,11 @@ import me.lucko.luckperms.common.commands.CommandResult;
|
||||
import me.lucko.luckperms.common.commands.abstraction.SharedSubCommand;
|
||||
import me.lucko.luckperms.common.commands.sender.Sender;
|
||||
import me.lucko.luckperms.common.commands.utils.Util;
|
||||
import me.lucko.luckperms.common.constants.Message;
|
||||
import me.lucko.luckperms.common.constants.Permission;
|
||||
import me.lucko.luckperms.common.core.model.PermissionHolder;
|
||||
import me.lucko.luckperms.common.locale.CommandSpec;
|
||||
import me.lucko.luckperms.common.locale.LocaleManager;
|
||||
import me.lucko.luckperms.common.locale.Message;
|
||||
import me.lucko.luckperms.common.plugin.LuckPermsPlugin;
|
||||
import me.lucko.luckperms.common.utils.DateUtil;
|
||||
import me.lucko.luckperms.common.utils.Predicates;
|
||||
@ -43,9 +45,8 @@ import java.util.List;
|
||||
import java.util.SortedSet;
|
||||
|
||||
public class ParentInfo extends SharedSubCommand {
|
||||
public ParentInfo() {
|
||||
super("info", "Lists the groups that this object inherits from",
|
||||
Permission.USER_PARENT_INFO, Permission.GROUP_PARENT_INFO, Predicates.alwaysFalse(), null);
|
||||
public ParentInfo(LocaleManager locale) {
|
||||
super(CommandSpec.PARENT_INFO.spec(locale), "info", Permission.USER_PARENT_INFO, Permission.GROUP_PARENT_INFO, Predicates.alwaysFalse());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -27,7 +27,6 @@ package me.lucko.luckperms.common.commands.impl.generic.parent;
|
||||
|
||||
import me.lucko.luckperms.api.DataMutateResult;
|
||||
import me.lucko.luckperms.api.context.MutableContextSet;
|
||||
import me.lucko.luckperms.common.commands.Arg;
|
||||
import me.lucko.luckperms.common.commands.CommandException;
|
||||
import me.lucko.luckperms.common.commands.CommandResult;
|
||||
import me.lucko.luckperms.common.commands.abstraction.SharedSubCommand;
|
||||
@ -35,12 +34,14 @@ import me.lucko.luckperms.common.commands.sender.Sender;
|
||||
import me.lucko.luckperms.common.commands.utils.ArgumentUtils;
|
||||
import me.lucko.luckperms.common.commands.utils.Util;
|
||||
import me.lucko.luckperms.common.config.ConfigKeys;
|
||||
import me.lucko.luckperms.common.constants.Message;
|
||||
import me.lucko.luckperms.common.constants.Permission;
|
||||
import me.lucko.luckperms.common.core.NodeFactory;
|
||||
import me.lucko.luckperms.common.core.model.PermissionHolder;
|
||||
import me.lucko.luckperms.common.core.model.User;
|
||||
import me.lucko.luckperms.common.data.LogEntry;
|
||||
import me.lucko.luckperms.common.locale.CommandSpec;
|
||||
import me.lucko.luckperms.common.locale.LocaleManager;
|
||||
import me.lucko.luckperms.common.locale.Message;
|
||||
import me.lucko.luckperms.common.plugin.LuckPermsPlugin;
|
||||
import me.lucko.luckperms.common.utils.Predicates;
|
||||
|
||||
@ -50,14 +51,8 @@ import java.util.stream.Collectors;
|
||||
import static me.lucko.luckperms.common.commands.abstraction.SubCommand.getGroupTabComplete;
|
||||
|
||||
public class ParentRemove extends SharedSubCommand {
|
||||
public ParentRemove() {
|
||||
super("remove", "Removes a previously set inheritance rule", Permission.USER_PARENT_REMOVE,
|
||||
Permission.GROUP_PARENT_REMOVE, Predicates.is(0),
|
||||
Arg.list(
|
||||
Arg.create("group", true, "the group to remove"),
|
||||
Arg.create("context...", false, "the contexts to remove the group in")
|
||||
)
|
||||
);
|
||||
public ParentRemove(LocaleManager locale) {
|
||||
super(CommandSpec.PARENT_REMOVE.spec(locale), "remove", Permission.USER_PARENT_REMOVE, Permission.GROUP_PARENT_REMOVE, Predicates.is(0));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -27,18 +27,19 @@ package me.lucko.luckperms.common.commands.impl.generic.parent;
|
||||
|
||||
import me.lucko.luckperms.api.DataMutateResult;
|
||||
import me.lucko.luckperms.api.context.MutableContextSet;
|
||||
import me.lucko.luckperms.common.commands.Arg;
|
||||
import me.lucko.luckperms.common.commands.CommandException;
|
||||
import me.lucko.luckperms.common.commands.CommandResult;
|
||||
import me.lucko.luckperms.common.commands.abstraction.SharedSubCommand;
|
||||
import me.lucko.luckperms.common.commands.sender.Sender;
|
||||
import me.lucko.luckperms.common.commands.utils.ArgumentUtils;
|
||||
import me.lucko.luckperms.common.commands.utils.Util;
|
||||
import me.lucko.luckperms.common.constants.Message;
|
||||
import me.lucko.luckperms.common.constants.Permission;
|
||||
import me.lucko.luckperms.common.core.NodeFactory;
|
||||
import me.lucko.luckperms.common.core.model.PermissionHolder;
|
||||
import me.lucko.luckperms.common.data.LogEntry;
|
||||
import me.lucko.luckperms.common.locale.CommandSpec;
|
||||
import me.lucko.luckperms.common.locale.LocaleManager;
|
||||
import me.lucko.luckperms.common.locale.Message;
|
||||
import me.lucko.luckperms.common.plugin.LuckPermsPlugin;
|
||||
import me.lucko.luckperms.common.utils.Predicates;
|
||||
|
||||
@ -48,14 +49,8 @@ import java.util.stream.Collectors;
|
||||
import static me.lucko.luckperms.common.commands.abstraction.SubCommand.getGroupTabComplete;
|
||||
|
||||
public class ParentRemoveTemp extends SharedSubCommand {
|
||||
public ParentRemoveTemp() {
|
||||
super("removetemp", "Removes a previously set temporary inheritance rule",
|
||||
Permission.USER_PARENT_REMOVETEMP, Permission.GROUP_PARENT_REMOVETEMP, Predicates.is(0),
|
||||
Arg.list(
|
||||
Arg.create("group", true, "the group to remove"),
|
||||
Arg.create("context...", false, "the contexts to remove the group in")
|
||||
)
|
||||
);
|
||||
public ParentRemoveTemp(LocaleManager locale) {
|
||||
super(CommandSpec.PARENT_REMOVE_TEMP.spec(locale), "removetemp", Permission.USER_PARENT_REMOVETEMP, Permission.GROUP_PARENT_REMOVETEMP, Predicates.is(0));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -26,19 +26,20 @@
|
||||
package me.lucko.luckperms.common.commands.impl.generic.parent;
|
||||
|
||||
import me.lucko.luckperms.api.context.MutableContextSet;
|
||||
import me.lucko.luckperms.common.commands.Arg;
|
||||
import me.lucko.luckperms.common.commands.CommandException;
|
||||
import me.lucko.luckperms.common.commands.CommandResult;
|
||||
import me.lucko.luckperms.common.commands.abstraction.SharedSubCommand;
|
||||
import me.lucko.luckperms.common.commands.sender.Sender;
|
||||
import me.lucko.luckperms.common.commands.utils.ArgumentUtils;
|
||||
import me.lucko.luckperms.common.commands.utils.Util;
|
||||
import me.lucko.luckperms.common.constants.Message;
|
||||
import me.lucko.luckperms.common.constants.Permission;
|
||||
import me.lucko.luckperms.common.core.model.Group;
|
||||
import me.lucko.luckperms.common.core.model.PermissionHolder;
|
||||
import me.lucko.luckperms.common.core.model.User;
|
||||
import me.lucko.luckperms.common.data.LogEntry;
|
||||
import me.lucko.luckperms.common.locale.CommandSpec;
|
||||
import me.lucko.luckperms.common.locale.LocaleManager;
|
||||
import me.lucko.luckperms.common.locale.Message;
|
||||
import me.lucko.luckperms.common.plugin.LuckPermsPlugin;
|
||||
import me.lucko.luckperms.common.utils.Predicates;
|
||||
|
||||
@ -48,14 +49,8 @@ import java.util.stream.Collectors;
|
||||
import static me.lucko.luckperms.common.commands.abstraction.SubCommand.getGroupTabComplete;
|
||||
|
||||
public class ParentSet extends SharedSubCommand {
|
||||
public ParentSet() {
|
||||
super("set", "Removes all other groups the object inherits already and adds them to the one given",
|
||||
Permission.USER_PARENT_SET, Permission.GROUP_PARENT_SET, Predicates.is(0),
|
||||
Arg.list(
|
||||
Arg.create("group", true, "the group to set to"),
|
||||
Arg.create("context...", false, "the contexts to set the group in")
|
||||
)
|
||||
);
|
||||
public ParentSet(LocaleManager locale) {
|
||||
super(CommandSpec.PARENT_SET.spec(locale), "set", Permission.USER_PARENT_SET, Permission.GROUP_PARENT_SET, Predicates.is(0));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -26,7 +26,6 @@
|
||||
package me.lucko.luckperms.common.commands.impl.generic.parent;
|
||||
|
||||
import me.lucko.luckperms.api.context.MutableContextSet;
|
||||
import me.lucko.luckperms.common.commands.Arg;
|
||||
import me.lucko.luckperms.common.commands.CommandException;
|
||||
import me.lucko.luckperms.common.commands.CommandResult;
|
||||
import me.lucko.luckperms.common.commands.abstraction.SharedSubCommand;
|
||||
@ -34,12 +33,14 @@ import me.lucko.luckperms.common.commands.sender.Sender;
|
||||
import me.lucko.luckperms.common.commands.utils.ArgumentUtils;
|
||||
import me.lucko.luckperms.common.commands.utils.Util;
|
||||
import me.lucko.luckperms.common.constants.DataConstraints;
|
||||
import me.lucko.luckperms.common.constants.Message;
|
||||
import me.lucko.luckperms.common.constants.Permission;
|
||||
import me.lucko.luckperms.common.core.model.Group;
|
||||
import me.lucko.luckperms.common.core.model.PermissionHolder;
|
||||
import me.lucko.luckperms.common.core.model.Track;
|
||||
import me.lucko.luckperms.common.data.LogEntry;
|
||||
import me.lucko.luckperms.common.locale.CommandSpec;
|
||||
import me.lucko.luckperms.common.locale.LocaleManager;
|
||||
import me.lucko.luckperms.common.locale.Message;
|
||||
import me.lucko.luckperms.common.plugin.LuckPermsPlugin;
|
||||
import me.lucko.luckperms.common.utils.Predicates;
|
||||
|
||||
@ -50,15 +51,8 @@ import static me.lucko.luckperms.common.commands.abstraction.SubCommand.getGroup
|
||||
import static me.lucko.luckperms.common.commands.abstraction.SubCommand.getTrackTabComplete;
|
||||
|
||||
public class ParentSetTrack extends SharedSubCommand {
|
||||
public ParentSetTrack() {
|
||||
super("settrack", "Removes all other groups the object inherits from already on the given track and adds them to the one given",
|
||||
Permission.USER_PARENT_SET_TRACK, Permission.GROUP_PARENT_SET_TRACK, Predicates.inRange(0, 1),
|
||||
Arg.list(
|
||||
Arg.create("track", true, "the track to set on"),
|
||||
Arg.create("group", true, "the group to set to, or a number relating to the position of the group on the given track"),
|
||||
Arg.create("context...", false, "the contexts to set the group in")
|
||||
)
|
||||
);
|
||||
public ParentSetTrack(LocaleManager locale) {
|
||||
super(CommandSpec.PARENT_SET_TRACK.spec(locale), "settrack", Permission.USER_PARENT_SET_TRACK, Permission.GROUP_PARENT_SET_TRACK, Predicates.inRange(0, 1));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -30,17 +30,19 @@ import com.google.common.collect.ImmutableList;
|
||||
import me.lucko.luckperms.common.commands.abstraction.SharedMainCommand;
|
||||
import me.lucko.luckperms.common.commands.abstraction.SharedSubCommand;
|
||||
import me.lucko.luckperms.common.core.model.PermissionHolder;
|
||||
import me.lucko.luckperms.common.locale.CommandSpec;
|
||||
import me.lucko.luckperms.common.locale.LocaleManager;
|
||||
|
||||
public class CommandPermission<T extends PermissionHolder> extends SharedMainCommand<T> {
|
||||
public CommandPermission(boolean user) {
|
||||
super("Permission", "Edit permissions", user, ImmutableList.<SharedSubCommand>builder()
|
||||
.add(new PermissionInfo())
|
||||
.add(new PermissionSet())
|
||||
.add(new PermissionUnset())
|
||||
.add(new PermissionSetTemp())
|
||||
.add(new PermissionUnsetTemp())
|
||||
.add(new PermissionCheck())
|
||||
.add(new PermissionCheckInherits())
|
||||
public CommandPermission(LocaleManager locale, boolean user) {
|
||||
super(CommandSpec.PERMISSION.spec(locale), "Permission", user, ImmutableList.<SharedSubCommand>builder()
|
||||
.add(new PermissionInfo(locale))
|
||||
.add(new PermissionSet(locale))
|
||||
.add(new PermissionUnset(locale))
|
||||
.add(new PermissionSetTemp(locale))
|
||||
.add(new PermissionUnsetTemp(locale))
|
||||
.add(new PermissionCheck(locale))
|
||||
.add(new PermissionCheckInherits(locale))
|
||||
.build());
|
||||
}
|
||||
}
|
||||
|
@ -27,17 +27,18 @@ package me.lucko.luckperms.common.commands.impl.generic.permission;
|
||||
|
||||
import me.lucko.luckperms.api.Tristate;
|
||||
import me.lucko.luckperms.api.context.MutableContextSet;
|
||||
import me.lucko.luckperms.common.commands.Arg;
|
||||
import me.lucko.luckperms.common.commands.CommandException;
|
||||
import me.lucko.luckperms.common.commands.CommandResult;
|
||||
import me.lucko.luckperms.common.commands.abstraction.SharedSubCommand;
|
||||
import me.lucko.luckperms.common.commands.sender.Sender;
|
||||
import me.lucko.luckperms.common.commands.utils.ArgumentUtils;
|
||||
import me.lucko.luckperms.common.commands.utils.Util;
|
||||
import me.lucko.luckperms.common.constants.Message;
|
||||
import me.lucko.luckperms.common.constants.Permission;
|
||||
import me.lucko.luckperms.common.core.NodeFactory;
|
||||
import me.lucko.luckperms.common.core.model.PermissionHolder;
|
||||
import me.lucko.luckperms.common.locale.CommandSpec;
|
||||
import me.lucko.luckperms.common.locale.LocaleManager;
|
||||
import me.lucko.luckperms.common.locale.Message;
|
||||
import me.lucko.luckperms.common.plugin.LuckPermsPlugin;
|
||||
import me.lucko.luckperms.common.utils.Predicates;
|
||||
|
||||
@ -46,14 +47,8 @@ import java.util.List;
|
||||
import static me.lucko.luckperms.common.commands.abstraction.SubCommand.getPermissionTabComplete;
|
||||
|
||||
public class PermissionCheck extends SharedSubCommand {
|
||||
public PermissionCheck() {
|
||||
super("check", "Checks to see if the object has a certain permission node", Permission.USER_PERM_CHECK,
|
||||
Permission.GROUP_PERM_CHECK, Predicates.is(0),
|
||||
Arg.list(
|
||||
Arg.create("node", true, "the permission node to check for"),
|
||||
Arg.create("context...", false, "the contexts to check in")
|
||||
)
|
||||
);
|
||||
public PermissionCheck(LocaleManager locale) {
|
||||
super(CommandSpec.PERMISSION_CHECK.spec(locale), "check", Permission.USER_PERM_CHECK, Permission.GROUP_PERM_CHECK, Predicates.is(0));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -26,18 +26,19 @@
|
||||
package me.lucko.luckperms.common.commands.impl.generic.permission;
|
||||
|
||||
import me.lucko.luckperms.api.context.MutableContextSet;
|
||||
import me.lucko.luckperms.common.commands.Arg;
|
||||
import me.lucko.luckperms.common.commands.CommandException;
|
||||
import me.lucko.luckperms.common.commands.CommandResult;
|
||||
import me.lucko.luckperms.common.commands.abstraction.SharedSubCommand;
|
||||
import me.lucko.luckperms.common.commands.sender.Sender;
|
||||
import me.lucko.luckperms.common.commands.utils.ArgumentUtils;
|
||||
import me.lucko.luckperms.common.commands.utils.Util;
|
||||
import me.lucko.luckperms.common.constants.Message;
|
||||
import me.lucko.luckperms.common.constants.Permission;
|
||||
import me.lucko.luckperms.common.core.InheritanceInfo;
|
||||
import me.lucko.luckperms.common.core.NodeFactory;
|
||||
import me.lucko.luckperms.common.core.model.PermissionHolder;
|
||||
import me.lucko.luckperms.common.locale.CommandSpec;
|
||||
import me.lucko.luckperms.common.locale.LocaleManager;
|
||||
import me.lucko.luckperms.common.locale.Message;
|
||||
import me.lucko.luckperms.common.plugin.LuckPermsPlugin;
|
||||
import me.lucko.luckperms.common.utils.Predicates;
|
||||
|
||||
@ -46,14 +47,8 @@ import java.util.List;
|
||||
import static me.lucko.luckperms.common.commands.abstraction.SubCommand.getPermissionTabComplete;
|
||||
|
||||
public class PermissionCheckInherits extends SharedSubCommand {
|
||||
public PermissionCheckInherits() {
|
||||
super("checkinherits", "Checks to see if the object inherits a certain permission node",
|
||||
Permission.USER_PERM_CHECK_INHERITS, Permission.GROUP_PERM_CHECK_INHERITS, Predicates.is(0),
|
||||
Arg.list(
|
||||
Arg.create("node", true, "the permission node to check for"),
|
||||
Arg.create("context...", false, "the contexts to check in")
|
||||
)
|
||||
);
|
||||
public PermissionCheckInherits(LocaleManager locale) {
|
||||
super(CommandSpec.PERMISSION_CHECK_INHERITS.spec(locale), "checkinherits", Permission.USER_PERM_CHECK_INHERITS, Permission.GROUP_PERM_CHECK_INHERITS, Predicates.is(0));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -29,7 +29,6 @@ import com.google.common.collect.Maps;
|
||||
|
||||
import me.lucko.luckperms.api.LocalizedNode;
|
||||
import me.lucko.luckperms.api.Node;
|
||||
import me.lucko.luckperms.common.commands.Arg;
|
||||
import me.lucko.luckperms.common.commands.CommandException;
|
||||
import me.lucko.luckperms.common.commands.CommandResult;
|
||||
import me.lucko.luckperms.common.commands.abstraction.SharedSubCommand;
|
||||
@ -37,11 +36,13 @@ import me.lucko.luckperms.common.commands.sender.Sender;
|
||||
import me.lucko.luckperms.common.commands.utils.ArgumentUtils;
|
||||
import me.lucko.luckperms.common.commands.utils.Util;
|
||||
import me.lucko.luckperms.common.constants.Constants;
|
||||
import me.lucko.luckperms.common.constants.Message;
|
||||
import me.lucko.luckperms.common.constants.Permission;
|
||||
import me.lucko.luckperms.common.core.NodeFactory;
|
||||
import me.lucko.luckperms.common.core.model.PermissionHolder;
|
||||
import me.lucko.luckperms.common.core.model.User;
|
||||
import me.lucko.luckperms.common.locale.CommandSpec;
|
||||
import me.lucko.luckperms.common.locale.LocaleManager;
|
||||
import me.lucko.luckperms.common.locale.Message;
|
||||
import me.lucko.luckperms.common.plugin.LuckPermsPlugin;
|
||||
import me.lucko.luckperms.common.utils.DateUtil;
|
||||
import me.lucko.luckperms.common.utils.Predicates;
|
||||
@ -60,14 +61,8 @@ import java.util.SortedSet;
|
||||
import java.util.function.Consumer;
|
||||
|
||||
public class PermissionInfo extends SharedSubCommand {
|
||||
public PermissionInfo() {
|
||||
super("info", "Lists the permission nodes the object has", Permission.USER_PERM_INFO,
|
||||
Permission.GROUP_PERM_INFO, Predicates.notInRange(0, 2),
|
||||
Arg.list(
|
||||
Arg.create("page", false, "the page to view"),
|
||||
Arg.create("filter", false, "the string to filter by")
|
||||
)
|
||||
);
|
||||
public PermissionInfo(LocaleManager locale) {
|
||||
super(CommandSpec.PERMISSION_INFO.spec(locale), "info", Permission.USER_PERM_INFO, Permission.GROUP_PERM_INFO, Predicates.notInRange(0, 2));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -27,18 +27,19 @@ package me.lucko.luckperms.common.commands.impl.generic.permission;
|
||||
|
||||
import me.lucko.luckperms.api.DataMutateResult;
|
||||
import me.lucko.luckperms.api.context.MutableContextSet;
|
||||
import me.lucko.luckperms.common.commands.Arg;
|
||||
import me.lucko.luckperms.common.commands.CommandException;
|
||||
import me.lucko.luckperms.common.commands.CommandResult;
|
||||
import me.lucko.luckperms.common.commands.abstraction.SharedSubCommand;
|
||||
import me.lucko.luckperms.common.commands.sender.Sender;
|
||||
import me.lucko.luckperms.common.commands.utils.ArgumentUtils;
|
||||
import me.lucko.luckperms.common.commands.utils.Util;
|
||||
import me.lucko.luckperms.common.constants.Message;
|
||||
import me.lucko.luckperms.common.constants.Permission;
|
||||
import me.lucko.luckperms.common.core.NodeFactory;
|
||||
import me.lucko.luckperms.common.core.model.PermissionHolder;
|
||||
import me.lucko.luckperms.common.data.LogEntry;
|
||||
import me.lucko.luckperms.common.locale.CommandSpec;
|
||||
import me.lucko.luckperms.common.locale.LocaleManager;
|
||||
import me.lucko.luckperms.common.locale.Message;
|
||||
import me.lucko.luckperms.common.plugin.LuckPermsPlugin;
|
||||
import me.lucko.luckperms.common.utils.Predicates;
|
||||
|
||||
@ -49,15 +50,8 @@ import static me.lucko.luckperms.common.commands.abstraction.SubCommand.getBoolT
|
||||
import static me.lucko.luckperms.common.commands.abstraction.SubCommand.getPermissionTabComplete;
|
||||
|
||||
public class PermissionSet extends SharedSubCommand {
|
||||
public PermissionSet() {
|
||||
super("set", "Sets a permission for the object", Permission.USER_PERM_SET, Permission.GROUP_PERM_SET,
|
||||
Predicates.is(0),
|
||||
Arg.list(
|
||||
Arg.create("node", true, "the permission node to set"),
|
||||
Arg.create("true|false", false, "the value of the node"),
|
||||
Arg.create("context...", false, "the contexts to add the permission in")
|
||||
)
|
||||
);
|
||||
public PermissionSet(LocaleManager locale) {
|
||||
super(CommandSpec.PERMISSION_SET.spec(locale), "set", Permission.USER_PERM_SET, Permission.GROUP_PERM_SET, Predicates.is(0));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -28,7 +28,6 @@ package me.lucko.luckperms.common.commands.impl.generic.permission;
|
||||
import me.lucko.luckperms.api.DataMutateResult;
|
||||
import me.lucko.luckperms.api.Node;
|
||||
import me.lucko.luckperms.api.context.MutableContextSet;
|
||||
import me.lucko.luckperms.common.commands.Arg;
|
||||
import me.lucko.luckperms.common.commands.CommandException;
|
||||
import me.lucko.luckperms.common.commands.CommandResult;
|
||||
import me.lucko.luckperms.common.commands.abstraction.SharedSubCommand;
|
||||
@ -36,12 +35,14 @@ import me.lucko.luckperms.common.commands.sender.Sender;
|
||||
import me.lucko.luckperms.common.commands.utils.ArgumentUtils;
|
||||
import me.lucko.luckperms.common.commands.utils.Util;
|
||||
import me.lucko.luckperms.common.config.ConfigKeys;
|
||||
import me.lucko.luckperms.common.constants.Message;
|
||||
import me.lucko.luckperms.common.constants.Permission;
|
||||
import me.lucko.luckperms.common.core.NodeFactory;
|
||||
import me.lucko.luckperms.common.core.TemporaryModifier;
|
||||
import me.lucko.luckperms.common.core.model.PermissionHolder;
|
||||
import me.lucko.luckperms.common.data.LogEntry;
|
||||
import me.lucko.luckperms.common.locale.CommandSpec;
|
||||
import me.lucko.luckperms.common.locale.LocaleManager;
|
||||
import me.lucko.luckperms.common.locale.Message;
|
||||
import me.lucko.luckperms.common.plugin.LuckPermsPlugin;
|
||||
import me.lucko.luckperms.common.utils.DateUtil;
|
||||
import me.lucko.luckperms.common.utils.Predicates;
|
||||
@ -54,16 +55,8 @@ import static me.lucko.luckperms.common.commands.abstraction.SubCommand.getBoolT
|
||||
import static me.lucko.luckperms.common.commands.abstraction.SubCommand.getPermissionTabComplete;
|
||||
|
||||
public class PermissionSetTemp extends SharedSubCommand {
|
||||
public PermissionSetTemp() {
|
||||
super("settemp", "Sets a permission for the object temporarily", Permission.USER_PERM_SETTEMP,
|
||||
Permission.GROUP_PERM_SETTEMP, Predicates.inRange(0, 1),
|
||||
Arg.list(
|
||||
Arg.create("node", true, "the permission node to set"),
|
||||
Arg.create("true|false", false, "the value of the node"),
|
||||
Arg.create("duration", true, "the duration until the permission node expires"),
|
||||
Arg.create("context...", false, "the contexts to add the permission in")
|
||||
)
|
||||
);
|
||||
public PermissionSetTemp(LocaleManager locale) {
|
||||
super(CommandSpec.PERMISSION_SETTEMP.spec(locale), "settemp", Permission.USER_PERM_SETTEMP, Permission.GROUP_PERM_SETTEMP, Predicates.inRange(0, 1));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -27,18 +27,19 @@ package me.lucko.luckperms.common.commands.impl.generic.permission;
|
||||
|
||||
import me.lucko.luckperms.api.DataMutateResult;
|
||||
import me.lucko.luckperms.api.context.MutableContextSet;
|
||||
import me.lucko.luckperms.common.commands.Arg;
|
||||
import me.lucko.luckperms.common.commands.CommandException;
|
||||
import me.lucko.luckperms.common.commands.CommandResult;
|
||||
import me.lucko.luckperms.common.commands.abstraction.SharedSubCommand;
|
||||
import me.lucko.luckperms.common.commands.sender.Sender;
|
||||
import me.lucko.luckperms.common.commands.utils.ArgumentUtils;
|
||||
import me.lucko.luckperms.common.commands.utils.Util;
|
||||
import me.lucko.luckperms.common.constants.Message;
|
||||
import me.lucko.luckperms.common.constants.Permission;
|
||||
import me.lucko.luckperms.common.core.NodeFactory;
|
||||
import me.lucko.luckperms.common.core.model.PermissionHolder;
|
||||
import me.lucko.luckperms.common.data.LogEntry;
|
||||
import me.lucko.luckperms.common.locale.CommandSpec;
|
||||
import me.lucko.luckperms.common.locale.LocaleManager;
|
||||
import me.lucko.luckperms.common.locale.Message;
|
||||
import me.lucko.luckperms.common.plugin.LuckPermsPlugin;
|
||||
import me.lucko.luckperms.common.utils.Predicates;
|
||||
|
||||
@ -48,14 +49,8 @@ import java.util.stream.Collectors;
|
||||
import static me.lucko.luckperms.common.commands.abstraction.SubCommand.getPermissionTabComplete;
|
||||
|
||||
public class PermissionUnset extends SharedSubCommand {
|
||||
public PermissionUnset() {
|
||||
super("unset", "Unsets a permission for the object", Permission.USER_PERM_UNSET, Permission.GROUP_PERM_UNSET,
|
||||
Predicates.is(0),
|
||||
Arg.list(
|
||||
Arg.create("node", true, "the permission node to unset"),
|
||||
Arg.create("context...", false, "the contexts to remove the permission in")
|
||||
)
|
||||
);
|
||||
public PermissionUnset(LocaleManager locale) {
|
||||
super(CommandSpec.PERMISSION_UNSET.spec(locale), "unset", Permission.USER_PERM_UNSET, Permission.GROUP_PERM_UNSET, Predicates.is(0));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -27,18 +27,19 @@ package me.lucko.luckperms.common.commands.impl.generic.permission;
|
||||
|
||||
import me.lucko.luckperms.api.DataMutateResult;
|
||||
import me.lucko.luckperms.api.context.MutableContextSet;
|
||||
import me.lucko.luckperms.common.commands.Arg;
|
||||
import me.lucko.luckperms.common.commands.CommandException;
|
||||
import me.lucko.luckperms.common.commands.CommandResult;
|
||||
import me.lucko.luckperms.common.commands.abstraction.SharedSubCommand;
|
||||
import me.lucko.luckperms.common.commands.sender.Sender;
|
||||
import me.lucko.luckperms.common.commands.utils.ArgumentUtils;
|
||||
import me.lucko.luckperms.common.commands.utils.Util;
|
||||
import me.lucko.luckperms.common.constants.Message;
|
||||
import me.lucko.luckperms.common.constants.Permission;
|
||||
import me.lucko.luckperms.common.core.NodeFactory;
|
||||
import me.lucko.luckperms.common.core.model.PermissionHolder;
|
||||
import me.lucko.luckperms.common.data.LogEntry;
|
||||
import me.lucko.luckperms.common.locale.CommandSpec;
|
||||
import me.lucko.luckperms.common.locale.LocaleManager;
|
||||
import me.lucko.luckperms.common.locale.Message;
|
||||
import me.lucko.luckperms.common.plugin.LuckPermsPlugin;
|
||||
import me.lucko.luckperms.common.utils.Predicates;
|
||||
|
||||
@ -48,14 +49,8 @@ import java.util.stream.Collectors;
|
||||
import static me.lucko.luckperms.common.commands.abstraction.SubCommand.getPermissionTabComplete;
|
||||
|
||||
public class PermissionUnsetTemp extends SharedSubCommand {
|
||||
public PermissionUnsetTemp() {
|
||||
super("unsettemp", "Unsets a temporary permission for the object", Permission.USER_PERM_UNSETTEMP,
|
||||
Permission.GROUP_PERM_UNSETTEMP, Predicates.is(0),
|
||||
Arg.list(
|
||||
Arg.create("node", true, "the permission node to unset"),
|
||||
Arg.create("context...", false, "the contexts to remove the permission in")
|
||||
)
|
||||
);
|
||||
public PermissionUnsetTemp(LocaleManager locale) {
|
||||
super(CommandSpec.PERMISSION_UNSETTEMP.spec(locale), "unsettemp", Permission.USER_PERM_UNSETTEMP, Permission.GROUP_PERM_UNSETTEMP, Predicates.is(0));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -26,26 +26,23 @@
|
||||
package me.lucko.luckperms.common.commands.impl.group;
|
||||
|
||||
import me.lucko.luckperms.api.event.cause.CreationCause;
|
||||
import me.lucko.luckperms.common.commands.Arg;
|
||||
import me.lucko.luckperms.common.commands.CommandResult;
|
||||
import me.lucko.luckperms.common.commands.abstraction.SingleCommand;
|
||||
import me.lucko.luckperms.common.commands.sender.Sender;
|
||||
import me.lucko.luckperms.common.constants.DataConstraints;
|
||||
import me.lucko.luckperms.common.constants.Message;
|
||||
import me.lucko.luckperms.common.constants.Permission;
|
||||
import me.lucko.luckperms.common.data.LogEntry;
|
||||
import me.lucko.luckperms.common.locale.CommandSpec;
|
||||
import me.lucko.luckperms.common.locale.LocaleManager;
|
||||
import me.lucko.luckperms.common.locale.Message;
|
||||
import me.lucko.luckperms.common.plugin.LuckPermsPlugin;
|
||||
import me.lucko.luckperms.common.utils.Predicates;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class CreateGroup extends SingleCommand {
|
||||
public CreateGroup() {
|
||||
super("CreateGroup", "Create a new group", "/%s creategroup <group>", Permission.CREATE_GROUP, Predicates.not(1),
|
||||
Arg.list(
|
||||
Arg.create("name", true, "the name of the group")
|
||||
)
|
||||
);
|
||||
public CreateGroup(LocaleManager locale) {
|
||||
super(CommandSpec.CREATE_GROUP.spec(locale), "CreateGroup", Permission.CREATE_GROUP, Predicates.not(1));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -26,31 +26,25 @@
|
||||
package me.lucko.luckperms.common.commands.impl.group;
|
||||
|
||||
import me.lucko.luckperms.api.event.cause.DeletionCause;
|
||||
import me.lucko.luckperms.common.commands.Arg;
|
||||
import me.lucko.luckperms.common.commands.CommandResult;
|
||||
import me.lucko.luckperms.common.commands.abstraction.SingleCommand;
|
||||
import me.lucko.luckperms.common.commands.abstraction.SubCommand;
|
||||
import me.lucko.luckperms.common.commands.sender.Sender;
|
||||
import me.lucko.luckperms.common.config.ConfigKeys;
|
||||
import me.lucko.luckperms.common.constants.Message;
|
||||
import me.lucko.luckperms.common.constants.Permission;
|
||||
import me.lucko.luckperms.common.core.model.Group;
|
||||
import me.lucko.luckperms.common.data.LogEntry;
|
||||
import me.lucko.luckperms.common.locale.CommandSpec;
|
||||
import me.lucko.luckperms.common.locale.LocaleManager;
|
||||
import me.lucko.luckperms.common.locale.Message;
|
||||
import me.lucko.luckperms.common.plugin.LuckPermsPlugin;
|
||||
import me.lucko.luckperms.common.utils.Predicates;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
public class DeleteGroup extends SingleCommand {
|
||||
public DeleteGroup() {
|
||||
super("DeleteGroup", "Delete a group", "/%s deletegroup <group>", Permission.DELETE_GROUP, Predicates.not(1),
|
||||
Arg.list(
|
||||
Arg.create("name", true, "the name of the group")
|
||||
)
|
||||
);
|
||||
public DeleteGroup(LocaleManager locale) {
|
||||
super(CommandSpec.DELETE_GROUP.spec(locale), "DeleteGroup", Permission.DELETE_GROUP, Predicates.not(1));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -26,26 +26,25 @@
|
||||
package me.lucko.luckperms.common.commands.impl.group;
|
||||
|
||||
import me.lucko.luckperms.api.event.cause.CreationCause;
|
||||
import me.lucko.luckperms.common.commands.Arg;
|
||||
import me.lucko.luckperms.common.commands.CommandException;
|
||||
import me.lucko.luckperms.common.commands.CommandResult;
|
||||
import me.lucko.luckperms.common.commands.abstraction.SubCommand;
|
||||
import me.lucko.luckperms.common.commands.sender.Sender;
|
||||
import me.lucko.luckperms.common.constants.DataConstraints;
|
||||
import me.lucko.luckperms.common.constants.Message;
|
||||
import me.lucko.luckperms.common.constants.Permission;
|
||||
import me.lucko.luckperms.common.core.model.Group;
|
||||
import me.lucko.luckperms.common.data.LogEntry;
|
||||
import me.lucko.luckperms.common.locale.CommandSpec;
|
||||
import me.lucko.luckperms.common.locale.LocaleManager;
|
||||
import me.lucko.luckperms.common.locale.Message;
|
||||
import me.lucko.luckperms.common.plugin.LuckPermsPlugin;
|
||||
import me.lucko.luckperms.common.utils.Predicates;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class GroupClone extends SubCommand<Group> {
|
||||
public GroupClone() {
|
||||
super("clone", "Clone the group", Permission.GROUP_CLONE, Predicates.not(1),
|
||||
Arg.list(Arg.create("name", true, "the name of the group to clone onto"))
|
||||
);
|
||||
public GroupClone(LocaleManager locale) {
|
||||
super(CommandSpec.GROUP_CLONE.spec(locale), "clone", Permission.GROUP_CLONE, Predicates.not(1));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -31,9 +31,11 @@ import me.lucko.luckperms.common.commands.CommandResult;
|
||||
import me.lucko.luckperms.common.commands.abstraction.SubCommand;
|
||||
import me.lucko.luckperms.common.commands.sender.Sender;
|
||||
import me.lucko.luckperms.common.commands.utils.Util;
|
||||
import me.lucko.luckperms.common.constants.Message;
|
||||
import me.lucko.luckperms.common.constants.Permission;
|
||||
import me.lucko.luckperms.common.core.model.Group;
|
||||
import me.lucko.luckperms.common.locale.CommandSpec;
|
||||
import me.lucko.luckperms.common.locale.LocaleManager;
|
||||
import me.lucko.luckperms.common.locale.Message;
|
||||
import me.lucko.luckperms.common.plugin.LuckPermsPlugin;
|
||||
import me.lucko.luckperms.common.utils.DateUtil;
|
||||
import me.lucko.luckperms.common.utils.Predicates;
|
||||
@ -43,8 +45,8 @@ import java.util.Set;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
public class GroupInfo extends SubCommand<Group> {
|
||||
public GroupInfo() {
|
||||
super("info", "Gives info about the group", Permission.GROUP_INFO, Predicates.alwaysFalse(), null);
|
||||
public GroupInfo(LocaleManager locale) {
|
||||
super(CommandSpec.GROUP_INFO.spec(locale), "info", Permission.GROUP_INFO, Predicates.alwaysFalse());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -29,7 +29,6 @@ import com.google.common.collect.Maps;
|
||||
|
||||
import me.lucko.luckperms.api.HeldPermission;
|
||||
import me.lucko.luckperms.api.Node;
|
||||
import me.lucko.luckperms.common.commands.Arg;
|
||||
import me.lucko.luckperms.common.commands.CommandException;
|
||||
import me.lucko.luckperms.common.commands.CommandResult;
|
||||
import me.lucko.luckperms.common.commands.abstraction.SubCommand;
|
||||
@ -37,10 +36,12 @@ import me.lucko.luckperms.common.commands.sender.Sender;
|
||||
import me.lucko.luckperms.common.commands.utils.ArgumentUtils;
|
||||
import me.lucko.luckperms.common.commands.utils.Util;
|
||||
import me.lucko.luckperms.common.constants.Constants;
|
||||
import me.lucko.luckperms.common.constants.Message;
|
||||
import me.lucko.luckperms.common.constants.Permission;
|
||||
import me.lucko.luckperms.common.core.NodeFactory;
|
||||
import me.lucko.luckperms.common.core.model.Group;
|
||||
import me.lucko.luckperms.common.locale.CommandSpec;
|
||||
import me.lucko.luckperms.common.locale.LocaleManager;
|
||||
import me.lucko.luckperms.common.locale.Message;
|
||||
import me.lucko.luckperms.common.plugin.LuckPermsPlugin;
|
||||
import me.lucko.luckperms.common.utils.DateUtil;
|
||||
import me.lucko.luckperms.common.utils.Predicates;
|
||||
@ -63,13 +64,8 @@ import java.util.function.Function;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
public class GroupListMembers extends SubCommand<Group> {
|
||||
public GroupListMembers() {
|
||||
super("listmembers", "Show the users/groups who inherit from this group",
|
||||
Permission.GROUP_LISTMEMBERS, Predicates.notInRange(0, 1),
|
||||
Arg.list(
|
||||
Arg.create("page", false, "the page to view")
|
||||
)
|
||||
);
|
||||
public GroupListMembers(LocaleManager locale) {
|
||||
super(CommandSpec.GROUP_LISTMEMBERS.spec(locale), "listmembers", Permission.GROUP_LISTMEMBERS, Predicates.notInRange(0, 1));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -36,27 +36,29 @@ import me.lucko.luckperms.common.commands.impl.generic.other.HolderShowTracks;
|
||||
import me.lucko.luckperms.common.commands.impl.generic.parent.CommandParent;
|
||||
import me.lucko.luckperms.common.commands.impl.generic.permission.CommandPermission;
|
||||
import me.lucko.luckperms.common.commands.sender.Sender;
|
||||
import me.lucko.luckperms.common.constants.Message;
|
||||
import me.lucko.luckperms.common.core.model.Group;
|
||||
import me.lucko.luckperms.common.locale.CommandSpec;
|
||||
import me.lucko.luckperms.common.locale.LocaleManager;
|
||||
import me.lucko.luckperms.common.locale.Message;
|
||||
import me.lucko.luckperms.common.plugin.LuckPermsPlugin;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class GroupMainCommand extends MainCommand<Group> {
|
||||
public GroupMainCommand() {
|
||||
super("Group", "Group commands", "/%s group <group>", 2, ImmutableList.<Command<Group, ?>>builder()
|
||||
.add(new GroupInfo())
|
||||
.add(new CommandPermission<>(false))
|
||||
.add(new CommandParent<>(false))
|
||||
.add(new CommandMeta<>(false))
|
||||
.add(new HolderEditor<>(false))
|
||||
.add(new GroupListMembers())
|
||||
.add(new GroupSetWeight())
|
||||
.add(new HolderShowTracks<>(false))
|
||||
.add(new HolderClear<>(false))
|
||||
.add(new GroupRename())
|
||||
.add(new GroupClone())
|
||||
public GroupMainCommand(LocaleManager locale) {
|
||||
super(CommandSpec.GROUP.spec(locale), "Group", 2, ImmutableList.<Command<Group, ?>>builder()
|
||||
.add(new GroupInfo(locale))
|
||||
.add(new CommandPermission<>(locale, false))
|
||||
.add(new CommandParent<>(locale, false))
|
||||
.add(new CommandMeta<>(locale, false))
|
||||
.add(new HolderEditor<>(locale, false))
|
||||
.add(new GroupListMembers(locale))
|
||||
.add(new GroupSetWeight(locale))
|
||||
.add(new HolderShowTracks<>(locale, false))
|
||||
.add(new HolderClear<>(locale, false))
|
||||
.add(new GroupRename(locale))
|
||||
.add(new GroupClone(locale))
|
||||
.build()
|
||||
);
|
||||
}
|
||||
|
@ -27,26 +27,25 @@ package me.lucko.luckperms.common.commands.impl.group;
|
||||
|
||||
import me.lucko.luckperms.api.event.cause.CreationCause;
|
||||
import me.lucko.luckperms.api.event.cause.DeletionCause;
|
||||
import me.lucko.luckperms.common.commands.Arg;
|
||||
import me.lucko.luckperms.common.commands.CommandException;
|
||||
import me.lucko.luckperms.common.commands.CommandResult;
|
||||
import me.lucko.luckperms.common.commands.abstraction.SubCommand;
|
||||
import me.lucko.luckperms.common.commands.sender.Sender;
|
||||
import me.lucko.luckperms.common.constants.DataConstraints;
|
||||
import me.lucko.luckperms.common.constants.Message;
|
||||
import me.lucko.luckperms.common.constants.Permission;
|
||||
import me.lucko.luckperms.common.core.model.Group;
|
||||
import me.lucko.luckperms.common.data.LogEntry;
|
||||
import me.lucko.luckperms.common.locale.CommandSpec;
|
||||
import me.lucko.luckperms.common.locale.LocaleManager;
|
||||
import me.lucko.luckperms.common.locale.Message;
|
||||
import me.lucko.luckperms.common.plugin.LuckPermsPlugin;
|
||||
import me.lucko.luckperms.common.utils.Predicates;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class GroupRename extends SubCommand<Group> {
|
||||
public GroupRename() {
|
||||
super("rename", "Rename the group", Permission.GROUP_RENAME, Predicates.not(1),
|
||||
Arg.list(Arg.create("name", true, "the new name"))
|
||||
);
|
||||
public GroupRename(LocaleManager locale) {
|
||||
super(CommandSpec.GROUP_RENAME.spec(locale), "rename", Permission.GROUP_RENAME, Predicates.not(1));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -25,26 +25,25 @@
|
||||
|
||||
package me.lucko.luckperms.common.commands.impl.group;
|
||||
|
||||
import me.lucko.luckperms.common.commands.Arg;
|
||||
import me.lucko.luckperms.common.commands.CommandException;
|
||||
import me.lucko.luckperms.common.commands.CommandResult;
|
||||
import me.lucko.luckperms.common.commands.abstraction.SubCommand;
|
||||
import me.lucko.luckperms.common.commands.sender.Sender;
|
||||
import me.lucko.luckperms.common.commands.utils.ArgumentUtils;
|
||||
import me.lucko.luckperms.common.constants.Message;
|
||||
import me.lucko.luckperms.common.constants.Permission;
|
||||
import me.lucko.luckperms.common.core.NodeFactory;
|
||||
import me.lucko.luckperms.common.core.model.Group;
|
||||
import me.lucko.luckperms.common.locale.CommandSpec;
|
||||
import me.lucko.luckperms.common.locale.LocaleManager;
|
||||
import me.lucko.luckperms.common.locale.Message;
|
||||
import me.lucko.luckperms.common.plugin.LuckPermsPlugin;
|
||||
import me.lucko.luckperms.common.utils.Predicates;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class GroupSetWeight extends SubCommand<Group> {
|
||||
public GroupSetWeight() {
|
||||
super("setweight", "Set the groups weight", Permission.GROUP_SETWEIGHT, Predicates.not(1),
|
||||
Arg.list(Arg.create("weight", true, "the weight to set"))
|
||||
);
|
||||
public GroupSetWeight(LocaleManager locale) {
|
||||
super(CommandSpec.GROUP_SETWEIGHT.spec(locale), "setweight", Permission.GROUP_SETWEIGHT, Predicates.not(1));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -29,9 +29,11 @@ import me.lucko.luckperms.common.commands.CommandResult;
|
||||
import me.lucko.luckperms.common.commands.abstraction.SingleCommand;
|
||||
import me.lucko.luckperms.common.commands.sender.Sender;
|
||||
import me.lucko.luckperms.common.commands.utils.Util;
|
||||
import me.lucko.luckperms.common.constants.Message;
|
||||
import me.lucko.luckperms.common.constants.Permission;
|
||||
import me.lucko.luckperms.common.core.model.Group;
|
||||
import me.lucko.luckperms.common.locale.CommandSpec;
|
||||
import me.lucko.luckperms.common.locale.LocaleManager;
|
||||
import me.lucko.luckperms.common.locale.Message;
|
||||
import me.lucko.luckperms.common.plugin.LuckPermsPlugin;
|
||||
import me.lucko.luckperms.common.utils.Predicates;
|
||||
|
||||
@ -39,8 +41,8 @@ import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
public class ListGroups extends SingleCommand {
|
||||
public ListGroups() {
|
||||
super("ListGroups", "List all groups on the platform", "/%s listgroups", Permission.LIST_GROUPS, Predicates.alwaysFalse(), null);
|
||||
public ListGroups(LocaleManager locale) {
|
||||
super(CommandSpec.LIST_GROUPS.spec(locale), "ListGroups", Permission.LIST_GROUPS, Predicates.alwaysFalse());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -23,18 +23,19 @@
|
||||
* SOFTWARE.
|
||||
*/
|
||||
|
||||
package me.lucko.luckperms.common.commands.impl.log.subcommands;
|
||||
package me.lucko.luckperms.common.commands.impl.log;
|
||||
|
||||
import me.lucko.luckperms.api.LogEntry;
|
||||
import me.lucko.luckperms.common.commands.Arg;
|
||||
import me.lucko.luckperms.common.commands.CommandException;
|
||||
import me.lucko.luckperms.common.commands.CommandResult;
|
||||
import me.lucko.luckperms.common.commands.abstraction.SubCommand;
|
||||
import me.lucko.luckperms.common.commands.sender.Sender;
|
||||
import me.lucko.luckperms.common.constants.DataConstraints;
|
||||
import me.lucko.luckperms.common.constants.Message;
|
||||
import me.lucko.luckperms.common.constants.Permission;
|
||||
import me.lucko.luckperms.common.data.Log;
|
||||
import me.lucko.luckperms.common.locale.CommandSpec;
|
||||
import me.lucko.luckperms.common.locale.LocaleManager;
|
||||
import me.lucko.luckperms.common.locale.Message;
|
||||
import me.lucko.luckperms.common.plugin.LuckPermsPlugin;
|
||||
import me.lucko.luckperms.common.utils.DateUtil;
|
||||
import me.lucko.luckperms.common.utils.Predicates;
|
||||
@ -44,13 +45,8 @@ import java.util.Map;
|
||||
import java.util.SortedMap;
|
||||
|
||||
public class LogGroupHistory extends SubCommand<Log> {
|
||||
public LogGroupHistory() {
|
||||
super("grouphistory", "View an group's history", Permission.LOG_GROUP_HISTORY, Predicates.notInRange(1, 2),
|
||||
Arg.list(
|
||||
Arg.create("group", true, "the name of the group"),
|
||||
Arg.create("page", false, "the page number to view")
|
||||
)
|
||||
);
|
||||
public LogGroupHistory(LocaleManager locale) {
|
||||
super(CommandSpec.LOG_GROUP_HISTORY.spec(locale), "grouphistory", Permission.LOG_GROUP_HISTORY, Predicates.notInRange(1, 2));
|
||||
}
|
||||
|
||||
@Override
|
@ -29,15 +29,11 @@ import com.google.common.collect.ImmutableList;
|
||||
|
||||
import me.lucko.luckperms.common.commands.abstraction.Command;
|
||||
import me.lucko.luckperms.common.commands.abstraction.MainCommand;
|
||||
import me.lucko.luckperms.common.commands.impl.log.subcommands.LogGroupHistory;
|
||||
import me.lucko.luckperms.common.commands.impl.log.subcommands.LogNotify;
|
||||
import me.lucko.luckperms.common.commands.impl.log.subcommands.LogRecent;
|
||||
import me.lucko.luckperms.common.commands.impl.log.subcommands.LogSearch;
|
||||
import me.lucko.luckperms.common.commands.impl.log.subcommands.LogTrackHistory;
|
||||
import me.lucko.luckperms.common.commands.impl.log.subcommands.LogUserHistory;
|
||||
import me.lucko.luckperms.common.commands.sender.Sender;
|
||||
import me.lucko.luckperms.common.constants.Message;
|
||||
import me.lucko.luckperms.common.data.Log;
|
||||
import me.lucko.luckperms.common.locale.CommandSpec;
|
||||
import me.lucko.luckperms.common.locale.LocaleManager;
|
||||
import me.lucko.luckperms.common.locale.Message;
|
||||
import me.lucko.luckperms.common.plugin.LuckPermsPlugin;
|
||||
|
||||
import java.util.Collections;
|
||||
@ -46,14 +42,14 @@ import java.util.Optional;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
public class LogMainCommand extends MainCommand<Log> {
|
||||
public LogMainCommand() {
|
||||
super("Log", "Log commands", "/%s log", 1, ImmutableList.<Command<Log, ?>>builder()
|
||||
.add(new LogRecent())
|
||||
.add(new LogSearch())
|
||||
.add(new LogNotify())
|
||||
.add(new LogUserHistory())
|
||||
.add(new LogGroupHistory())
|
||||
.add(new LogTrackHistory())
|
||||
public LogMainCommand(LocaleManager locale) {
|
||||
super(CommandSpec.LOG.spec(locale), "Log", 1, ImmutableList.<Command<Log, ?>>builder()
|
||||
.add(new LogRecent(locale))
|
||||
.add(new LogSearch(locale))
|
||||
.add(new LogNotify(locale))
|
||||
.add(new LogUserHistory(locale))
|
||||
.add(new LogGroupHistory(locale))
|
||||
.add(new LogTrackHistory(locale))
|
||||
.build()
|
||||
);
|
||||
}
|
||||
|
@ -23,16 +23,17 @@
|
||||
* SOFTWARE.
|
||||
*/
|
||||
|
||||
package me.lucko.luckperms.common.commands.impl.log.subcommands;
|
||||
package me.lucko.luckperms.common.commands.impl.log;
|
||||
|
||||
import me.lucko.luckperms.common.commands.Arg;
|
||||
import me.lucko.luckperms.common.commands.CommandException;
|
||||
import me.lucko.luckperms.common.commands.CommandResult;
|
||||
import me.lucko.luckperms.common.commands.abstraction.SubCommand;
|
||||
import me.lucko.luckperms.common.commands.sender.Sender;
|
||||
import me.lucko.luckperms.common.constants.Message;
|
||||
import me.lucko.luckperms.common.constants.Permission;
|
||||
import me.lucko.luckperms.common.data.Log;
|
||||
import me.lucko.luckperms.common.locale.CommandSpec;
|
||||
import me.lucko.luckperms.common.locale.LocaleManager;
|
||||
import me.lucko.luckperms.common.locale.Message;
|
||||
import me.lucko.luckperms.common.plugin.LuckPermsPlugin;
|
||||
import me.lucko.luckperms.common.utils.Predicates;
|
||||
|
||||
@ -41,10 +42,8 @@ import java.util.Set;
|
||||
import java.util.UUID;
|
||||
|
||||
public class LogNotify extends SubCommand<Log> {
|
||||
public LogNotify() {
|
||||
super("notify", "Toggle notifications", Permission.LOG_NOTIFY, Predicates.notInRange(0, 1),
|
||||
Arg.list(Arg.create("on|off", false, "whether to toggle on or off"))
|
||||
);
|
||||
public LogNotify(LocaleManager locale) {
|
||||
super(CommandSpec.LOG_NOTIFY.spec(locale), "notify", Permission.LOG_NOTIFY, Predicates.notInRange(0, 1));
|
||||
}
|
||||
|
||||
@Override
|
@ -23,19 +23,20 @@
|
||||
* SOFTWARE.
|
||||
*/
|
||||
|
||||
package me.lucko.luckperms.common.commands.impl.log.subcommands;
|
||||
package me.lucko.luckperms.common.commands.impl.log;
|
||||
|
||||
import me.lucko.luckperms.api.LogEntry;
|
||||
import me.lucko.luckperms.common.commands.Arg;
|
||||
import me.lucko.luckperms.common.commands.CommandException;
|
||||
import me.lucko.luckperms.common.commands.CommandResult;
|
||||
import me.lucko.luckperms.common.commands.abstraction.SubCommand;
|
||||
import me.lucko.luckperms.common.commands.sender.Sender;
|
||||
import me.lucko.luckperms.common.commands.utils.Util;
|
||||
import me.lucko.luckperms.common.constants.DataConstraints;
|
||||
import me.lucko.luckperms.common.constants.Message;
|
||||
import me.lucko.luckperms.common.constants.Permission;
|
||||
import me.lucko.luckperms.common.data.Log;
|
||||
import me.lucko.luckperms.common.locale.CommandSpec;
|
||||
import me.lucko.luckperms.common.locale.LocaleManager;
|
||||
import me.lucko.luckperms.common.locale.Message;
|
||||
import me.lucko.luckperms.common.plugin.LuckPermsPlugin;
|
||||
import me.lucko.luckperms.common.utils.DateUtil;
|
||||
import me.lucko.luckperms.common.utils.Predicates;
|
||||
@ -46,39 +47,8 @@ import java.util.SortedMap;
|
||||
import java.util.UUID;
|
||||
|
||||
public class LogRecent extends SubCommand<Log> {
|
||||
private static CommandResult showLog(int page, UUID filter, Sender sender, Log log) {
|
||||
int maxPage = (filter != null) ? log.getRecentMaxPages(filter) : log.getRecentMaxPages();
|
||||
if (maxPage == 0) {
|
||||
Message.LOG_NO_ENTRIES.send(sender);
|
||||
return CommandResult.STATE_ERROR;
|
||||
}
|
||||
|
||||
if (page < 1 || page > maxPage) {
|
||||
Message.LOG_INVALID_PAGE_RANGE.send(sender, maxPage);
|
||||
return CommandResult.INVALID_ARGS;
|
||||
}
|
||||
|
||||
SortedMap<Integer, LogEntry> entries = (filter != null) ? log.getRecent(page, filter) : log.getRecent(page);
|
||||
if (filter != null) {
|
||||
String name = entries.values().stream().findAny().get().getActorName();
|
||||
Message.LOG_RECENT_BY_HEADER.send(sender, name, page, maxPage);
|
||||
} else {
|
||||
Message.LOG_RECENT_HEADER.send(sender, page, maxPage);
|
||||
}
|
||||
|
||||
for (Map.Entry<Integer, LogEntry> e : entries.entrySet()) {
|
||||
Message.LOG_ENTRY.send(sender, e.getKey(), DateUtil.formatDateDiff(e.getValue().getTimestamp()), e.getValue().getFormatted());
|
||||
}
|
||||
return CommandResult.SUCCESS;
|
||||
}
|
||||
|
||||
public LogRecent() {
|
||||
super("recent", "View recent actions", Permission.LOG_RECENT, Predicates.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")
|
||||
)
|
||||
);
|
||||
public LogRecent(LocaleManager locale) {
|
||||
super(CommandSpec.LOG_RECENT.spec(locale), "recent", Permission.LOG_RECENT, Predicates.notInRange(0, 2));
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -150,4 +120,30 @@ public class LogRecent extends SubCommand<Log> {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static CommandResult showLog(int page, UUID filter, Sender sender, Log log) {
|
||||
int maxPage = (filter != null) ? log.getRecentMaxPages(filter) : log.getRecentMaxPages();
|
||||
if (maxPage == 0) {
|
||||
Message.LOG_NO_ENTRIES.send(sender);
|
||||
return CommandResult.STATE_ERROR;
|
||||
}
|
||||
|
||||
if (page < 1 || page > maxPage) {
|
||||
Message.LOG_INVALID_PAGE_RANGE.send(sender, maxPage);
|
||||
return CommandResult.INVALID_ARGS;
|
||||
}
|
||||
|
||||
SortedMap<Integer, LogEntry> entries = (filter != null) ? log.getRecent(page, filter) : log.getRecent(page);
|
||||
if (filter != null) {
|
||||
String name = entries.values().stream().findAny().get().getActorName();
|
||||
Message.LOG_RECENT_BY_HEADER.send(sender, name, page, maxPage);
|
||||
} else {
|
||||
Message.LOG_RECENT_HEADER.send(sender, page, maxPage);
|
||||
}
|
||||
|
||||
for (Map.Entry<Integer, LogEntry> e : entries.entrySet()) {
|
||||
Message.LOG_ENTRY.send(sender, e.getKey(), DateUtil.formatDateDiff(e.getValue().getTimestamp()), e.getValue().getFormatted());
|
||||
}
|
||||
return CommandResult.SUCCESS;
|
||||
}
|
||||
}
|
@ -23,17 +23,18 @@
|
||||
* SOFTWARE.
|
||||
*/
|
||||
|
||||
package me.lucko.luckperms.common.commands.impl.log.subcommands;
|
||||
package me.lucko.luckperms.common.commands.impl.log;
|
||||
|
||||
import me.lucko.luckperms.api.LogEntry;
|
||||
import me.lucko.luckperms.common.commands.Arg;
|
||||
import me.lucko.luckperms.common.commands.CommandException;
|
||||
import me.lucko.luckperms.common.commands.CommandResult;
|
||||
import me.lucko.luckperms.common.commands.abstraction.SubCommand;
|
||||
import me.lucko.luckperms.common.commands.sender.Sender;
|
||||
import me.lucko.luckperms.common.constants.Message;
|
||||
import me.lucko.luckperms.common.constants.Permission;
|
||||
import me.lucko.luckperms.common.data.Log;
|
||||
import me.lucko.luckperms.common.locale.CommandSpec;
|
||||
import me.lucko.luckperms.common.locale.LocaleManager;
|
||||
import me.lucko.luckperms.common.locale.Message;
|
||||
import me.lucko.luckperms.common.plugin.LuckPermsPlugin;
|
||||
import me.lucko.luckperms.common.utils.DateUtil;
|
||||
import me.lucko.luckperms.common.utils.Predicates;
|
||||
@ -44,13 +45,8 @@ import java.util.SortedMap;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
public class LogSearch extends SubCommand<Log> {
|
||||
public LogSearch() {
|
||||
super("search", "Search the log for an entry", Permission.LOG_SEARCH, Predicates.is(0),
|
||||
Arg.list(
|
||||
Arg.create("query", true, "the query to search by"),
|
||||
Arg.create("page", false, "the page number to view")
|
||||
)
|
||||
);
|
||||
public LogSearch(LocaleManager locale) {
|
||||
super(CommandSpec.LOG_SEARCH.spec(locale), "search", Permission.LOG_SEARCH, Predicates.is(0));
|
||||
}
|
||||
|
||||
@Override
|
@ -23,18 +23,19 @@
|
||||
* SOFTWARE.
|
||||
*/
|
||||
|
||||
package me.lucko.luckperms.common.commands.impl.log.subcommands;
|
||||
package me.lucko.luckperms.common.commands.impl.log;
|
||||
|
||||
import me.lucko.luckperms.api.LogEntry;
|
||||
import me.lucko.luckperms.common.commands.Arg;
|
||||
import me.lucko.luckperms.common.commands.CommandException;
|
||||
import me.lucko.luckperms.common.commands.CommandResult;
|
||||
import me.lucko.luckperms.common.commands.abstraction.SubCommand;
|
||||
import me.lucko.luckperms.common.commands.sender.Sender;
|
||||
import me.lucko.luckperms.common.constants.DataConstraints;
|
||||
import me.lucko.luckperms.common.constants.Message;
|
||||
import me.lucko.luckperms.common.constants.Permission;
|
||||
import me.lucko.luckperms.common.data.Log;
|
||||
import me.lucko.luckperms.common.locale.CommandSpec;
|
||||
import me.lucko.luckperms.common.locale.LocaleManager;
|
||||
import me.lucko.luckperms.common.locale.Message;
|
||||
import me.lucko.luckperms.common.plugin.LuckPermsPlugin;
|
||||
import me.lucko.luckperms.common.utils.DateUtil;
|
||||
import me.lucko.luckperms.common.utils.Predicates;
|
||||
@ -44,13 +45,8 @@ import java.util.Map;
|
||||
import java.util.SortedMap;
|
||||
|
||||
public class LogTrackHistory extends SubCommand<Log> {
|
||||
public LogTrackHistory() {
|
||||
super("trackhistory", "View a track's history", Permission.LOG_TRACK_HISTORY, Predicates.notInRange(1, 2),
|
||||
Arg.list(
|
||||
Arg.create("track", true, "the name of the track"),
|
||||
Arg.create("page", false, "the page number to view")
|
||||
)
|
||||
);
|
||||
public LogTrackHistory(LocaleManager locale) {
|
||||
super(CommandSpec.LOG_TRACK_HISTORY.spec(locale), "trackhistory", Permission.LOG_TRACK_HISTORY, Predicates.notInRange(1, 2));
|
||||
}
|
||||
|
||||
@Override
|
@ -23,19 +23,20 @@
|
||||
* SOFTWARE.
|
||||
*/
|
||||
|
||||
package me.lucko.luckperms.common.commands.impl.log.subcommands;
|
||||
package me.lucko.luckperms.common.commands.impl.log;
|
||||
|
||||
import me.lucko.luckperms.api.LogEntry;
|
||||
import me.lucko.luckperms.common.commands.Arg;
|
||||
import me.lucko.luckperms.common.commands.CommandException;
|
||||
import me.lucko.luckperms.common.commands.CommandResult;
|
||||
import me.lucko.luckperms.common.commands.abstraction.SubCommand;
|
||||
import me.lucko.luckperms.common.commands.sender.Sender;
|
||||
import me.lucko.luckperms.common.commands.utils.Util;
|
||||
import me.lucko.luckperms.common.constants.DataConstraints;
|
||||
import me.lucko.luckperms.common.constants.Message;
|
||||
import me.lucko.luckperms.common.constants.Permission;
|
||||
import me.lucko.luckperms.common.data.Log;
|
||||
import me.lucko.luckperms.common.locale.CommandSpec;
|
||||
import me.lucko.luckperms.common.locale.LocaleManager;
|
||||
import me.lucko.luckperms.common.locale.Message;
|
||||
import me.lucko.luckperms.common.plugin.LuckPermsPlugin;
|
||||
import me.lucko.luckperms.common.utils.DateUtil;
|
||||
import me.lucko.luckperms.common.utils.Predicates;
|
||||
@ -46,36 +47,8 @@ import java.util.SortedMap;
|
||||
import java.util.UUID;
|
||||
|
||||
public class LogUserHistory extends SubCommand<Log> {
|
||||
private static CommandResult showLog(int page, UUID user, Sender sender, Log log) {
|
||||
int maxPage = log.getUserHistoryMaxPages(user);
|
||||
if (maxPage == 0) {
|
||||
Message.LOG_NO_ENTRIES.send(sender);
|
||||
return CommandResult.STATE_ERROR;
|
||||
}
|
||||
|
||||
if (page < 1 || page > maxPage) {
|
||||
Message.LOG_INVALID_PAGE_RANGE.send(sender, maxPage);
|
||||
return CommandResult.INVALID_ARGS;
|
||||
}
|
||||
|
||||
SortedMap<Integer, LogEntry> entries = log.getUserHistory(page, user);
|
||||
String name = entries.values().stream().findAny().get().getActedName();
|
||||
Message.LOG_HISTORY_USER_HEADER.send(sender, name, page, maxPage);
|
||||
|
||||
for (Map.Entry<Integer, LogEntry> e : entries.entrySet()) {
|
||||
Message.LOG_ENTRY.send(sender, e.getKey(), DateUtil.formatDateDiff(e.getValue().getTimestamp()), e.getValue().getFormatted());
|
||||
}
|
||||
|
||||
return CommandResult.SUCCESS;
|
||||
}
|
||||
|
||||
public LogUserHistory() {
|
||||
super("userhistory", "View a user's history", Permission.LOG_USER_HISTORY, Predicates.notInRange(1, 2),
|
||||
Arg.list(
|
||||
Arg.create("user", true, "the name/uuid of the user"),
|
||||
Arg.create("page", false, "the page number to view")
|
||||
)
|
||||
);
|
||||
public LogUserHistory(LocaleManager locale) {
|
||||
super(CommandSpec.LOG_USER_HISTORY.spec(locale), "userhistory", Permission.LOG_USER_HISTORY, Predicates.notInRange(1, 2));
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -99,7 +72,6 @@ public class LogUserHistory extends SubCommand<Log> {
|
||||
}
|
||||
|
||||
return showLog(page, uuid, sender, log);
|
||||
|
||||
}
|
||||
|
||||
if (user.length() <= 16) {
|
||||
@ -125,4 +97,27 @@ public class LogUserHistory extends SubCommand<Log> {
|
||||
Message.USER_INVALID_ENTRY.send(sender, user);
|
||||
return CommandResult.INVALID_ARGS;
|
||||
}
|
||||
|
||||
private static CommandResult showLog(int page, UUID user, Sender sender, Log log) {
|
||||
int maxPage = log.getUserHistoryMaxPages(user);
|
||||
if (maxPage == 0) {
|
||||
Message.LOG_NO_ENTRIES.send(sender);
|
||||
return CommandResult.STATE_ERROR;
|
||||
}
|
||||
|
||||
if (page < 1 || page > maxPage) {
|
||||
Message.LOG_INVALID_PAGE_RANGE.send(sender, maxPage);
|
||||
return CommandResult.INVALID_ARGS;
|
||||
}
|
||||
|
||||
SortedMap<Integer, LogEntry> entries = log.getUserHistory(page, user);
|
||||
String name = entries.values().stream().findAny().get().getActedName();
|
||||
Message.LOG_HISTORY_USER_HEADER.send(sender, name, page, maxPage);
|
||||
|
||||
for (Map.Entry<Integer, LogEntry> e : entries.entrySet()) {
|
||||
Message.LOG_ENTRY.send(sender, e.getKey(), DateUtil.formatDateDiff(e.getValue().getTimestamp()), e.getValue().getFormatted());
|
||||
}
|
||||
|
||||
return CommandResult.SUCCESS;
|
||||
}
|
||||
}
|
@ -34,6 +34,8 @@ import me.lucko.luckperms.common.commands.abstraction.MainCommand;
|
||||
import me.lucko.luckperms.common.commands.abstraction.SubCommand;
|
||||
import me.lucko.luckperms.common.commands.sender.Sender;
|
||||
import me.lucko.luckperms.common.constants.Permission;
|
||||
import me.lucko.luckperms.common.locale.CommandSpec;
|
||||
import me.lucko.luckperms.common.locale.LocaleManager;
|
||||
import me.lucko.luckperms.common.plugin.LuckPermsPlugin;
|
||||
import me.lucko.luckperms.common.utils.Predicates;
|
||||
|
||||
@ -58,19 +60,19 @@ public class MigrationMainCommand extends MainCommand<Object> {
|
||||
private List<Command<Object, ?>> commands = null;
|
||||
private boolean display = true;
|
||||
|
||||
public MigrationMainCommand() {
|
||||
super("Migration", "Migration commands", "/%s migration", 1, null);
|
||||
public MigrationMainCommand(LocaleManager locale) {
|
||||
super(CommandSpec.MIGRATION.spec(locale), "Migration", 1, null);
|
||||
}
|
||||
|
||||
@Override
|
||||
public synchronized Optional<List<Command<Object, ?>>> getChildren() {
|
||||
if (commands == null) {
|
||||
commands = getAvailableCommands();
|
||||
commands = getAvailableCommands(getSpec().getLocaleManager());
|
||||
|
||||
// Add dummy command to show in the list.
|
||||
if (commands.isEmpty()) {
|
||||
display = false;
|
||||
commands.add(new SubCommand<Object>("No available plugins to migrate from", "No available plugins to migrate from.", Permission.MIGRATION, Predicates.alwaysFalse(), null) {
|
||||
commands.add(new SubCommand<Object>(CommandSpec.MIGRATION_COMMAND.spec(getSpec().getLocaleManager()), "No available plugins to migrate from", Permission.MIGRATION, Predicates.alwaysFalse()) {
|
||||
@Override
|
||||
public CommandResult execute(LuckPermsPlugin plugin, Sender sender, Object o, List<String> args, String label) throws CommandException {
|
||||
return CommandResult.SUCCESS;
|
||||
@ -94,13 +96,13 @@ public class MigrationMainCommand extends MainCommand<Object> {
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
private static List<Command<Object, ?>> getAvailableCommands() {
|
||||
private static List<Command<Object, ?>> getAvailableCommands(LocaleManager locale) {
|
||||
List<Command<Object, ?>> l = new ArrayList<>();
|
||||
|
||||
for (Map.Entry<String, String> plugin : PLUGINS.entrySet()) {
|
||||
try {
|
||||
Class.forName(plugin.getKey());
|
||||
l.add((SubCommand<Object>) Class.forName(plugin.getValue()).newInstance());
|
||||
l.add((SubCommand<Object>) Class.forName(plugin.getValue()).getConstructor(LocaleManager.class).newInstance(locale));
|
||||
} catch (Throwable ignored) {}
|
||||
}
|
||||
|
||||
|
@ -32,17 +32,18 @@ import com.google.gson.JsonElement;
|
||||
import com.google.gson.JsonObject;
|
||||
|
||||
import me.lucko.luckperms.api.context.ImmutableContextSet;
|
||||
import me.lucko.luckperms.common.commands.Arg;
|
||||
import me.lucko.luckperms.common.commands.CommandException;
|
||||
import me.lucko.luckperms.common.commands.CommandResult;
|
||||
import me.lucko.luckperms.common.commands.abstraction.SharedSubCommand;
|
||||
import me.lucko.luckperms.common.commands.abstraction.SingleCommand;
|
||||
import me.lucko.luckperms.common.commands.sender.Sender;
|
||||
import me.lucko.luckperms.common.commands.utils.Util;
|
||||
import me.lucko.luckperms.common.constants.Message;
|
||||
import me.lucko.luckperms.common.constants.Permission;
|
||||
import me.lucko.luckperms.common.core.NodeModel;
|
||||
import me.lucko.luckperms.common.core.model.PermissionHolder;
|
||||
import me.lucko.luckperms.common.locale.CommandSpec;
|
||||
import me.lucko.luckperms.common.locale.LocaleManager;
|
||||
import me.lucko.luckperms.common.locale.Message;
|
||||
import me.lucko.luckperms.common.plugin.LuckPermsPlugin;
|
||||
import me.lucko.luckperms.common.utils.Predicates;
|
||||
|
||||
@ -59,14 +60,8 @@ import java.util.UUID;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
public class ApplyEditsCommand extends SingleCommand {
|
||||
public ApplyEditsCommand() {
|
||||
super("ApplyEdits", "Applies permission changes made from the web editor",
|
||||
"/%s applyedits <code> [target]", Permission.APPLY_EDITS, Predicates.notInRange(1, 2),
|
||||
Arg.list(
|
||||
Arg.create("code", true, "the unique code for the data"),
|
||||
Arg.create("target", false, "who to apply the data to")
|
||||
)
|
||||
);
|
||||
public ApplyEditsCommand(LocaleManager locale) {
|
||||
super(CommandSpec.APPLY_EDITS.spec(locale), "ApplyEdits", Permission.APPLY_EDITS, Predicates.notInRange(1, 2));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -36,14 +36,15 @@ import me.lucko.luckperms.common.bulkupdate.action.UpdateAction;
|
||||
import me.lucko.luckperms.common.bulkupdate.comparisons.ComparisonType;
|
||||
import me.lucko.luckperms.common.bulkupdate.constraint.Constraint;
|
||||
import me.lucko.luckperms.common.bulkupdate.constraint.QueryField;
|
||||
import me.lucko.luckperms.common.commands.Arg;
|
||||
import me.lucko.luckperms.common.commands.CommandException;
|
||||
import me.lucko.luckperms.common.commands.CommandResult;
|
||||
import me.lucko.luckperms.common.commands.abstraction.SingleCommand;
|
||||
import me.lucko.luckperms.common.commands.sender.Sender;
|
||||
import me.lucko.luckperms.common.commands.utils.ArgumentUtils;
|
||||
import me.lucko.luckperms.common.constants.Message;
|
||||
import me.lucko.luckperms.common.constants.Permission;
|
||||
import me.lucko.luckperms.common.locale.CommandSpec;
|
||||
import me.lucko.luckperms.common.locale.LocaleManager;
|
||||
import me.lucko.luckperms.common.locale.Message;
|
||||
import me.lucko.luckperms.common.plugin.LuckPermsPlugin;
|
||||
import me.lucko.luckperms.common.utils.Predicates;
|
||||
|
||||
@ -54,16 +55,8 @@ import java.util.concurrent.TimeUnit;
|
||||
public class BulkUpdateCommand extends SingleCommand {
|
||||
private final Cache<String, BulkUpdate> pendingOperations = Caffeine.newBuilder().expireAfterWrite(30, TimeUnit.SECONDS).build();
|
||||
|
||||
public BulkUpdateCommand() {
|
||||
super("BulkUpdate", "Execute bulk change queries on all data", "/%s bulkupdate", Permission.BULK_UPDATE, Predicates.alwaysFalse(),
|
||||
Arg.list(
|
||||
Arg.create("data type", true, "the type of data being changed. ('all', 'users' or 'groups')"),
|
||||
Arg.create("action", true, "the action to perform on the data. ('update' or 'delete')"),
|
||||
Arg.create("action field", false, "the field to act upon. only required for 'update'. ('permission', 'server' or 'world')"),
|
||||
Arg.create("action value", false, "the value to replace with. only required for 'update'."),
|
||||
Arg.create("constraint...", false, "the constraints required for the update")
|
||||
)
|
||||
);
|
||||
public BulkUpdateCommand(LocaleManager locale) {
|
||||
super(CommandSpec.BULK_UPDATE.spec(locale), "BulkUpdate", Permission.BULK_UPDATE, Predicates.alwaysFalse());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -26,16 +26,17 @@
|
||||
package me.lucko.luckperms.common.commands.impl.misc;
|
||||
|
||||
import me.lucko.luckperms.api.Tristate;
|
||||
import me.lucko.luckperms.common.commands.Arg;
|
||||
import me.lucko.luckperms.common.commands.CommandException;
|
||||
import me.lucko.luckperms.common.commands.CommandResult;
|
||||
import me.lucko.luckperms.common.commands.abstraction.SingleCommand;
|
||||
import me.lucko.luckperms.common.commands.abstraction.SubCommand;
|
||||
import me.lucko.luckperms.common.commands.sender.Sender;
|
||||
import me.lucko.luckperms.common.commands.utils.Util;
|
||||
import me.lucko.luckperms.common.constants.Message;
|
||||
import me.lucko.luckperms.common.constants.Permission;
|
||||
import me.lucko.luckperms.common.core.model.User;
|
||||
import me.lucko.luckperms.common.locale.CommandSpec;
|
||||
import me.lucko.luckperms.common.locale.LocaleManager;
|
||||
import me.lucko.luckperms.common.locale.Message;
|
||||
import me.lucko.luckperms.common.plugin.LuckPermsPlugin;
|
||||
import me.lucko.luckperms.common.utils.Predicates;
|
||||
|
||||
@ -44,14 +45,8 @@ import java.util.UUID;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
public class CheckCommand extends SingleCommand {
|
||||
public CheckCommand() {
|
||||
super("Check", "Perform a standard permission check on an online player",
|
||||
"/%s check <user> <permission>", Permission.CHECK, Predicates.not(2),
|
||||
Arg.list(
|
||||
Arg.create("user", true, "the user to check"),
|
||||
Arg.create("permission", true, "the permission to check for")
|
||||
)
|
||||
);
|
||||
public CheckCommand(LocaleManager locale) {
|
||||
super(CommandSpec.CHECK.spec(locale), "Check", Permission.CHECK, Predicates.not(2));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -25,13 +25,14 @@
|
||||
|
||||
package me.lucko.luckperms.common.commands.impl.misc;
|
||||
|
||||
import me.lucko.luckperms.common.commands.Arg;
|
||||
import me.lucko.luckperms.common.commands.CommandResult;
|
||||
import me.lucko.luckperms.common.commands.abstraction.SingleCommand;
|
||||
import me.lucko.luckperms.common.commands.sender.Sender;
|
||||
import me.lucko.luckperms.common.constants.Message;
|
||||
import me.lucko.luckperms.common.constants.Permission;
|
||||
import me.lucko.luckperms.common.data.Exporter;
|
||||
import me.lucko.luckperms.common.locale.CommandSpec;
|
||||
import me.lucko.luckperms.common.locale.LocaleManager;
|
||||
import me.lucko.luckperms.common.locale.Message;
|
||||
import me.lucko.luckperms.common.plugin.LuckPermsPlugin;
|
||||
import me.lucko.luckperms.common.utils.Predicates;
|
||||
|
||||
@ -45,12 +46,8 @@ import java.util.concurrent.atomic.AtomicBoolean;
|
||||
public class ExportCommand extends SingleCommand {
|
||||
private AtomicBoolean running = new AtomicBoolean(false);
|
||||
|
||||
public ExportCommand() {
|
||||
super("Export", "Export data to a file", "/%s export <file>", Permission.EXPORT, Predicates.not(1),
|
||||
Arg.list(
|
||||
Arg.create("file", true, "the file to export to")
|
||||
)
|
||||
);
|
||||
public ExportCommand(LocaleManager locale) {
|
||||
super(CommandSpec.EXPORT.spec(locale), "Export", Permission.EXPORT, Predicates.not(1));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -25,13 +25,14 @@
|
||||
|
||||
package me.lucko.luckperms.common.commands.impl.misc;
|
||||
|
||||
import me.lucko.luckperms.common.commands.Arg;
|
||||
import me.lucko.luckperms.common.commands.CommandResult;
|
||||
import me.lucko.luckperms.common.commands.abstraction.SingleCommand;
|
||||
import me.lucko.luckperms.common.commands.sender.Sender;
|
||||
import me.lucko.luckperms.common.constants.Message;
|
||||
import me.lucko.luckperms.common.constants.Permission;
|
||||
import me.lucko.luckperms.common.data.Importer;
|
||||
import me.lucko.luckperms.common.locale.CommandSpec;
|
||||
import me.lucko.luckperms.common.locale.LocaleManager;
|
||||
import me.lucko.luckperms.common.locale.Message;
|
||||
import me.lucko.luckperms.common.plugin.LuckPermsPlugin;
|
||||
import me.lucko.luckperms.common.utils.Predicates;
|
||||
|
||||
@ -46,12 +47,8 @@ import java.util.concurrent.atomic.AtomicBoolean;
|
||||
public class ImportCommand extends SingleCommand {
|
||||
private AtomicBoolean running = new AtomicBoolean(false);
|
||||
|
||||
public ImportCommand() {
|
||||
super("Import", "Import data from a file", "/%s import <file>", Permission.IMPORT, Predicates.not(1),
|
||||
Arg.list(
|
||||
Arg.create("file", true, "the file to import from")
|
||||
)
|
||||
);
|
||||
public ImportCommand(LocaleManager locale) {
|
||||
super(CommandSpec.IMPORT.spec(locale), "Import", Permission.IMPORT, Predicates.not(1));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -31,8 +31,10 @@ import me.lucko.luckperms.common.commands.sender.Sender;
|
||||
import me.lucko.luckperms.common.commands.utils.Util;
|
||||
import me.lucko.luckperms.common.config.ConfigKeys;
|
||||
import me.lucko.luckperms.common.config.LuckPermsConfiguration;
|
||||
import me.lucko.luckperms.common.constants.Message;
|
||||
import me.lucko.luckperms.common.constants.Permission;
|
||||
import me.lucko.luckperms.common.locale.CommandSpec;
|
||||
import me.lucko.luckperms.common.locale.LocaleManager;
|
||||
import me.lucko.luckperms.common.locale.Message;
|
||||
import me.lucko.luckperms.common.messaging.NoopMessagingService;
|
||||
import me.lucko.luckperms.common.plugin.LuckPermsPlugin;
|
||||
import me.lucko.luckperms.common.utils.Predicates;
|
||||
@ -44,21 +46,8 @@ import java.util.Map;
|
||||
import static me.lucko.luckperms.common.commands.utils.Util.formatBoolean;
|
||||
|
||||
public class InfoCommand extends SingleCommand {
|
||||
private static String formatValue(String value) {
|
||||
if (value.equalsIgnoreCase("true") || value.equalsIgnoreCase("false")) {
|
||||
return Util.formatBoolean(Boolean.parseBoolean(value));
|
||||
}
|
||||
|
||||
try {
|
||||
int i = Integer.parseInt(value);
|
||||
return "&a" + i;
|
||||
} catch (NumberFormatException ignored) {}
|
||||
|
||||
return "&f" + value;
|
||||
}
|
||||
|
||||
public InfoCommand() {
|
||||
super("Info", "Print general plugin info", "/%s info", Permission.INFO, Predicates.alwaysFalse(), null);
|
||||
public InfoCommand(LocaleManager locale) {
|
||||
super(CommandSpec.INFO.spec(locale), "Info", Permission.INFO, Predicates.alwaysFalse());
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -103,4 +92,17 @@ public class InfoCommand extends SingleCommand {
|
||||
|
||||
return CommandResult.SUCCESS;
|
||||
}
|
||||
|
||||
private static String formatValue(String value) {
|
||||
if (value.equalsIgnoreCase("true") || value.equalsIgnoreCase("false")) {
|
||||
return Util.formatBoolean(Boolean.parseBoolean(value));
|
||||
}
|
||||
|
||||
try {
|
||||
int i = Integer.parseInt(value);
|
||||
return "&a" + i;
|
||||
} catch (NumberFormatException ignored) {}
|
||||
|
||||
return "&f" + value;
|
||||
}
|
||||
}
|
||||
|
@ -28,8 +28,10 @@ package me.lucko.luckperms.common.commands.impl.misc;
|
||||
import me.lucko.luckperms.common.commands.CommandResult;
|
||||
import me.lucko.luckperms.common.commands.abstraction.SingleCommand;
|
||||
import me.lucko.luckperms.common.commands.sender.Sender;
|
||||
import me.lucko.luckperms.common.constants.Message;
|
||||
import me.lucko.luckperms.common.constants.Permission;
|
||||
import me.lucko.luckperms.common.locale.CommandSpec;
|
||||
import me.lucko.luckperms.common.locale.LocaleManager;
|
||||
import me.lucko.luckperms.common.locale.Message;
|
||||
import me.lucko.luckperms.common.messaging.InternalMessagingService;
|
||||
import me.lucko.luckperms.common.messaging.NoopMessagingService;
|
||||
import me.lucko.luckperms.common.plugin.LuckPermsPlugin;
|
||||
@ -38,9 +40,8 @@ import me.lucko.luckperms.common.utils.Predicates;
|
||||
import java.util.List;
|
||||
|
||||
public class NetworkSyncCommand extends SingleCommand {
|
||||
public NetworkSyncCommand() {
|
||||
super("NetworkSync", "Sync changes with the storage and request that all other servers on the network do the same",
|
||||
"/%s networksync", Permission.SYNC, Predicates.alwaysFalse(), null);
|
||||
public NetworkSyncCommand(LocaleManager locale) {
|
||||
super(CommandSpec.NETWORK_SYNC.spec(locale), "NetworkSync", Permission.SYNC, Predicates.alwaysFalse());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -29,16 +29,18 @@ import me.lucko.luckperms.common.commands.CommandException;
|
||||
import me.lucko.luckperms.common.commands.CommandResult;
|
||||
import me.lucko.luckperms.common.commands.abstraction.SingleCommand;
|
||||
import me.lucko.luckperms.common.commands.sender.Sender;
|
||||
import me.lucko.luckperms.common.constants.Message;
|
||||
import me.lucko.luckperms.common.constants.Permission;
|
||||
import me.lucko.luckperms.common.locale.CommandSpec;
|
||||
import me.lucko.luckperms.common.locale.LocaleManager;
|
||||
import me.lucko.luckperms.common.locale.Message;
|
||||
import me.lucko.luckperms.common.plugin.LuckPermsPlugin;
|
||||
import me.lucko.luckperms.common.utils.Predicates;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class ReloadConfigCommand extends SingleCommand {
|
||||
public ReloadConfigCommand() {
|
||||
super("ReloadConfig", "Reload some of the config options", "/%s reloadconfig", Permission.RELOAD_CONFIG, Predicates.alwaysFalse(), null);
|
||||
public ReloadConfigCommand(LocaleManager locale) {
|
||||
super(CommandSpec.RELOAD_CONFIG.spec(locale), "ReloadConfig", Permission.RELOAD_CONFIG, Predicates.alwaysFalse());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -29,7 +29,6 @@ import com.google.common.collect.Maps;
|
||||
|
||||
import me.lucko.luckperms.api.HeldPermission;
|
||||
import me.lucko.luckperms.api.Node;
|
||||
import me.lucko.luckperms.common.commands.Arg;
|
||||
import me.lucko.luckperms.common.commands.CommandException;
|
||||
import me.lucko.luckperms.common.commands.CommandResult;
|
||||
import me.lucko.luckperms.common.commands.abstraction.SingleCommand;
|
||||
@ -38,9 +37,11 @@ import me.lucko.luckperms.common.commands.sender.Sender;
|
||||
import me.lucko.luckperms.common.commands.utils.ArgumentUtils;
|
||||
import me.lucko.luckperms.common.commands.utils.Util;
|
||||
import me.lucko.luckperms.common.constants.Constants;
|
||||
import me.lucko.luckperms.common.constants.Message;
|
||||
import me.lucko.luckperms.common.constants.Permission;
|
||||
import me.lucko.luckperms.common.core.NodeFactory;
|
||||
import me.lucko.luckperms.common.locale.CommandSpec;
|
||||
import me.lucko.luckperms.common.locale.LocaleManager;
|
||||
import me.lucko.luckperms.common.locale.Message;
|
||||
import me.lucko.luckperms.common.plugin.LuckPermsPlugin;
|
||||
import me.lucko.luckperms.common.utils.DateUtil;
|
||||
import me.lucko.luckperms.common.utils.Predicates;
|
||||
@ -63,14 +64,8 @@ import java.util.function.Function;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
public class SearchCommand extends SingleCommand {
|
||||
public SearchCommand() {
|
||||
super("Search", "Search for users/groups with a specific permission",
|
||||
"/%s search <permission>", Permission.SEARCH, Predicates.notInRange(1, 2),
|
||||
Arg.list(
|
||||
Arg.create("permission", true, "the permission to search for"),
|
||||
Arg.create("page", false, "the page to view")
|
||||
)
|
||||
);
|
||||
public SearchCommand(LocaleManager locale) {
|
||||
super(CommandSpec.SEARCH.spec(locale), "Search", Permission.SEARCH, Predicates.notInRange(1, 2));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -28,16 +28,18 @@ package me.lucko.luckperms.common.commands.impl.misc;
|
||||
import me.lucko.luckperms.common.commands.CommandResult;
|
||||
import me.lucko.luckperms.common.commands.abstraction.SingleCommand;
|
||||
import me.lucko.luckperms.common.commands.sender.Sender;
|
||||
import me.lucko.luckperms.common.constants.Message;
|
||||
import me.lucko.luckperms.common.constants.Permission;
|
||||
import me.lucko.luckperms.common.locale.CommandSpec;
|
||||
import me.lucko.luckperms.common.locale.LocaleManager;
|
||||
import me.lucko.luckperms.common.locale.Message;
|
||||
import me.lucko.luckperms.common.plugin.LuckPermsPlugin;
|
||||
import me.lucko.luckperms.common.utils.Predicates;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class SyncCommand extends SingleCommand {
|
||||
public SyncCommand() {
|
||||
super("Sync", "Sync changes with the storage", "/%s sync", Permission.SYNC, Predicates.alwaysFalse(), null);
|
||||
public SyncCommand(LocaleManager locale) {
|
||||
super(CommandSpec.SYNC.spec(locale), "Sync", Permission.SYNC, Predicates.alwaysFalse());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -26,16 +26,17 @@
|
||||
package me.lucko.luckperms.common.commands.impl.misc;
|
||||
|
||||
import me.lucko.luckperms.api.caching.PermissionData;
|
||||
import me.lucko.luckperms.common.commands.Arg;
|
||||
import me.lucko.luckperms.common.commands.CommandException;
|
||||
import me.lucko.luckperms.common.commands.CommandResult;
|
||||
import me.lucko.luckperms.common.commands.abstraction.SingleCommand;
|
||||
import me.lucko.luckperms.common.commands.sender.Sender;
|
||||
import me.lucko.luckperms.common.commands.utils.ArgumentUtils;
|
||||
import me.lucko.luckperms.common.commands.utils.Util;
|
||||
import me.lucko.luckperms.common.constants.Message;
|
||||
import me.lucko.luckperms.common.constants.Permission;
|
||||
import me.lucko.luckperms.common.core.model.User;
|
||||
import me.lucko.luckperms.common.locale.CommandSpec;
|
||||
import me.lucko.luckperms.common.locale.LocaleManager;
|
||||
import me.lucko.luckperms.common.locale.Message;
|
||||
import me.lucko.luckperms.common.plugin.LuckPermsPlugin;
|
||||
import me.lucko.luckperms.common.treeview.TreeView;
|
||||
import me.lucko.luckperms.common.treeview.TreeViewBuilder;
|
||||
@ -50,15 +51,8 @@ import java.util.List;
|
||||
import java.util.UUID;
|
||||
|
||||
public class TreeCommand extends SingleCommand {
|
||||
public TreeCommand() {
|
||||
super("Tree", "Generate a tree view of permissions",
|
||||
"/%s tree [selection] [max level] [player]", Permission.TREE, Predicates.alwaysFalse(),
|
||||
Arg.list(
|
||||
Arg.create("selection", false, "the root of the tree. specify \".\" to include all permissions"),
|
||||
Arg.create("max level", false, "how many branch levels should be returned"),
|
||||
Arg.create("player", false, "the name of an online player to check against")
|
||||
)
|
||||
);
|
||||
public TreeCommand(LocaleManager locale) {
|
||||
super(CommandSpec.TREE.spec(locale), "Tree", Permission.TREE, Predicates.alwaysFalse());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -27,12 +27,13 @@ package me.lucko.luckperms.common.commands.impl.misc;
|
||||
|
||||
import com.google.common.collect.ImmutableList;
|
||||
|
||||
import me.lucko.luckperms.common.commands.Arg;
|
||||
import me.lucko.luckperms.common.commands.CommandResult;
|
||||
import me.lucko.luckperms.common.commands.abstraction.SingleCommand;
|
||||
import me.lucko.luckperms.common.commands.sender.Sender;
|
||||
import me.lucko.luckperms.common.constants.Message;
|
||||
import me.lucko.luckperms.common.constants.Permission;
|
||||
import me.lucko.luckperms.common.locale.CommandSpec;
|
||||
import me.lucko.luckperms.common.locale.LocaleManager;
|
||||
import me.lucko.luckperms.common.locale.Message;
|
||||
import me.lucko.luckperms.common.plugin.LuckPermsPlugin;
|
||||
import me.lucko.luckperms.common.utils.Predicates;
|
||||
import me.lucko.luckperms.common.verbose.VerboseListener;
|
||||
@ -49,13 +50,8 @@ import java.util.stream.Collectors;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
public class VerboseCommand extends SingleCommand {
|
||||
public VerboseCommand() {
|
||||
super("Verbose", "Manage verbose permission checking", "/%s verbose <true|false> [filter]", Permission.VERBOSE, Predicates.is(0),
|
||||
Arg.list(
|
||||
Arg.create("on|record|off|paste", true, "whether to enable/disable logging, or to paste the logged output"),
|
||||
Arg.create("filter", false, "the filter to match entries against")
|
||||
)
|
||||
);
|
||||
public VerboseCommand(LocaleManager locale) {
|
||||
super(CommandSpec.VERBOSE.spec(locale), "Verbose", Permission.VERBOSE, Predicates.is(0));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -26,26 +26,23 @@
|
||||
package me.lucko.luckperms.common.commands.impl.track;
|
||||
|
||||
import me.lucko.luckperms.api.event.cause.CreationCause;
|
||||
import me.lucko.luckperms.common.commands.Arg;
|
||||
import me.lucko.luckperms.common.commands.CommandResult;
|
||||
import me.lucko.luckperms.common.commands.abstraction.SingleCommand;
|
||||
import me.lucko.luckperms.common.commands.sender.Sender;
|
||||
import me.lucko.luckperms.common.constants.DataConstraints;
|
||||
import me.lucko.luckperms.common.constants.Message;
|
||||
import me.lucko.luckperms.common.constants.Permission;
|
||||
import me.lucko.luckperms.common.data.LogEntry;
|
||||
import me.lucko.luckperms.common.locale.CommandSpec;
|
||||
import me.lucko.luckperms.common.locale.LocaleManager;
|
||||
import me.lucko.luckperms.common.locale.Message;
|
||||
import me.lucko.luckperms.common.plugin.LuckPermsPlugin;
|
||||
import me.lucko.luckperms.common.utils.Predicates;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class CreateTrack extends SingleCommand {
|
||||
public CreateTrack() {
|
||||
super("CreateTrack", "Create a new track", "/%s createtrack <track>", Permission.CREATE_TRACK, Predicates.not(1),
|
||||
Arg.list(
|
||||
Arg.create("name", true, "the name of the track")
|
||||
)
|
||||
);
|
||||
public CreateTrack(LocaleManager locale) {
|
||||
super(CommandSpec.CREATE_TRACK.spec(locale), "CreateTrack", Permission.CREATE_TRACK, Predicates.not(1));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -26,28 +26,24 @@
|
||||
package me.lucko.luckperms.common.commands.impl.track;
|
||||
|
||||
import me.lucko.luckperms.api.event.cause.DeletionCause;
|
||||
import me.lucko.luckperms.common.commands.Arg;
|
||||
import me.lucko.luckperms.common.commands.CommandResult;
|
||||
import me.lucko.luckperms.common.commands.abstraction.SingleCommand;
|
||||
import me.lucko.luckperms.common.commands.abstraction.SubCommand;
|
||||
import me.lucko.luckperms.common.commands.sender.Sender;
|
||||
import me.lucko.luckperms.common.constants.Message;
|
||||
import me.lucko.luckperms.common.constants.Permission;
|
||||
import me.lucko.luckperms.common.core.model.Track;
|
||||
import me.lucko.luckperms.common.data.LogEntry;
|
||||
import me.lucko.luckperms.common.locale.CommandSpec;
|
||||
import me.lucko.luckperms.common.locale.LocaleManager;
|
||||
import me.lucko.luckperms.common.locale.Message;
|
||||
import me.lucko.luckperms.common.plugin.LuckPermsPlugin;
|
||||
import me.lucko.luckperms.common.utils.Predicates;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class DeleteTrack extends SingleCommand {
|
||||
public DeleteTrack() {
|
||||
super("DeleteTrack", "Delete a track", "/%s deletetrack <track>", Permission.DELETE_TRACK, Predicates.not(1),
|
||||
Arg.list(
|
||||
Arg.create("name", true, "the name of the track")
|
||||
)
|
||||
);
|
||||
public DeleteTrack(LocaleManager locale) {
|
||||
super(CommandSpec.DELETE_TRACK.spec(locale), "DeleteTrack", Permission.DELETE_TRACK, Predicates.not(1));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -29,8 +29,10 @@ import me.lucko.luckperms.common.commands.CommandResult;
|
||||
import me.lucko.luckperms.common.commands.abstraction.SingleCommand;
|
||||
import me.lucko.luckperms.common.commands.sender.Sender;
|
||||
import me.lucko.luckperms.common.commands.utils.Util;
|
||||
import me.lucko.luckperms.common.constants.Message;
|
||||
import me.lucko.luckperms.common.constants.Permission;
|
||||
import me.lucko.luckperms.common.locale.CommandSpec;
|
||||
import me.lucko.luckperms.common.locale.LocaleManager;
|
||||
import me.lucko.luckperms.common.locale.Message;
|
||||
import me.lucko.luckperms.common.plugin.LuckPermsPlugin;
|
||||
import me.lucko.luckperms.common.utils.Predicates;
|
||||
|
||||
@ -38,8 +40,8 @@ import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
public class ListTracks extends SingleCommand {
|
||||
public ListTracks() {
|
||||
super("ListTracks", "List all tracks on the platform", "/%s listtracks", Permission.LIST_TRACKS, Predicates.alwaysFalse(), null);
|
||||
public ListTracks(LocaleManager locale) {
|
||||
super(CommandSpec.LIST_TRACKS.spec(locale), "ListTracks", Permission.LIST_TRACKS, Predicates.alwaysFalse());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -25,18 +25,19 @@
|
||||
|
||||
package me.lucko.luckperms.common.commands.impl.track;
|
||||
|
||||
import me.lucko.luckperms.common.commands.Arg;
|
||||
import me.lucko.luckperms.common.commands.CommandException;
|
||||
import me.lucko.luckperms.common.commands.CommandResult;
|
||||
import me.lucko.luckperms.common.commands.abstraction.SubCommand;
|
||||
import me.lucko.luckperms.common.commands.sender.Sender;
|
||||
import me.lucko.luckperms.common.commands.utils.Util;
|
||||
import me.lucko.luckperms.common.constants.DataConstraints;
|
||||
import me.lucko.luckperms.common.constants.Message;
|
||||
import me.lucko.luckperms.common.constants.Permission;
|
||||
import me.lucko.luckperms.common.core.model.Group;
|
||||
import me.lucko.luckperms.common.core.model.Track;
|
||||
import me.lucko.luckperms.common.data.LogEntry;
|
||||
import me.lucko.luckperms.common.locale.CommandSpec;
|
||||
import me.lucko.luckperms.common.locale.LocaleManager;
|
||||
import me.lucko.luckperms.common.locale.Message;
|
||||
import me.lucko.luckperms.common.plugin.LuckPermsPlugin;
|
||||
import me.lucko.luckperms.common.utils.Predicates;
|
||||
import me.lucko.luckperms.exceptions.ObjectAlreadyHasException;
|
||||
@ -44,10 +45,8 @@ import me.lucko.luckperms.exceptions.ObjectAlreadyHasException;
|
||||
import java.util.List;
|
||||
|
||||
public class TrackAppend extends SubCommand<Track> {
|
||||
public TrackAppend() {
|
||||
super("append", "Appends a group onto the end of the track", Permission.TRACK_APPEND, Predicates.not(1),
|
||||
Arg.list(Arg.create("group", true, "the group to append"))
|
||||
);
|
||||
public TrackAppend(LocaleManager locale) {
|
||||
super(CommandSpec.TRACK_APPEND.spec(locale), "append", Permission.TRACK_APPEND, Predicates.not(1));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -29,18 +29,20 @@ import me.lucko.luckperms.common.commands.CommandException;
|
||||
import me.lucko.luckperms.common.commands.CommandResult;
|
||||
import me.lucko.luckperms.common.commands.abstraction.SubCommand;
|
||||
import me.lucko.luckperms.common.commands.sender.Sender;
|
||||
import me.lucko.luckperms.common.constants.Message;
|
||||
import me.lucko.luckperms.common.constants.Permission;
|
||||
import me.lucko.luckperms.common.core.model.Track;
|
||||
import me.lucko.luckperms.common.data.LogEntry;
|
||||
import me.lucko.luckperms.common.locale.CommandSpec;
|
||||
import me.lucko.luckperms.common.locale.LocaleManager;
|
||||
import me.lucko.luckperms.common.locale.Message;
|
||||
import me.lucko.luckperms.common.plugin.LuckPermsPlugin;
|
||||
import me.lucko.luckperms.common.utils.Predicates;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class TrackClear extends SubCommand<Track> {
|
||||
public TrackClear() {
|
||||
super("clear", "Clears the groups on the track", Permission.TRACK_CLEAR, Predicates.alwaysFalse(), null);
|
||||
public TrackClear(LocaleManager locale) {
|
||||
super(CommandSpec.TRACK_CLEAR.spec(locale), "clear", Permission.TRACK_CLEAR, Predicates.alwaysFalse());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -26,26 +26,25 @@
|
||||
package me.lucko.luckperms.common.commands.impl.track;
|
||||
|
||||
import me.lucko.luckperms.api.event.cause.CreationCause;
|
||||
import me.lucko.luckperms.common.commands.Arg;
|
||||
import me.lucko.luckperms.common.commands.CommandException;
|
||||
import me.lucko.luckperms.common.commands.CommandResult;
|
||||
import me.lucko.luckperms.common.commands.abstraction.SubCommand;
|
||||
import me.lucko.luckperms.common.commands.sender.Sender;
|
||||
import me.lucko.luckperms.common.constants.DataConstraints;
|
||||
import me.lucko.luckperms.common.constants.Message;
|
||||
import me.lucko.luckperms.common.constants.Permission;
|
||||
import me.lucko.luckperms.common.core.model.Track;
|
||||
import me.lucko.luckperms.common.data.LogEntry;
|
||||
import me.lucko.luckperms.common.locale.CommandSpec;
|
||||
import me.lucko.luckperms.common.locale.LocaleManager;
|
||||
import me.lucko.luckperms.common.locale.Message;
|
||||
import me.lucko.luckperms.common.plugin.LuckPermsPlugin;
|
||||
import me.lucko.luckperms.common.utils.Predicates;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class TrackClone extends SubCommand<Track> {
|
||||
public TrackClone() {
|
||||
super("clone", "Clone the track", Permission.TRACK_CLONE, Predicates.not(1),
|
||||
Arg.list(Arg.create("name", true, "the name of the track to clone onto"))
|
||||
);
|
||||
public TrackClone(LocaleManager locale) {
|
||||
super(CommandSpec.TRACK_CLONE.spec(locale), "clone", Permission.TRACK_CLONE, Predicates.not(1));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -30,17 +30,19 @@ import me.lucko.luckperms.common.commands.CommandResult;
|
||||
import me.lucko.luckperms.common.commands.abstraction.SubCommand;
|
||||
import me.lucko.luckperms.common.commands.sender.Sender;
|
||||
import me.lucko.luckperms.common.commands.utils.Util;
|
||||
import me.lucko.luckperms.common.constants.Message;
|
||||
import me.lucko.luckperms.common.constants.Permission;
|
||||
import me.lucko.luckperms.common.core.model.Track;
|
||||
import me.lucko.luckperms.common.locale.CommandSpec;
|
||||
import me.lucko.luckperms.common.locale.LocaleManager;
|
||||
import me.lucko.luckperms.common.locale.Message;
|
||||
import me.lucko.luckperms.common.plugin.LuckPermsPlugin;
|
||||
import me.lucko.luckperms.common.utils.Predicates;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class TrackInfo extends SubCommand<Track> {
|
||||
public TrackInfo() {
|
||||
super("info", "Gives info about the track", Permission.TRACK_INFO, Predicates.alwaysFalse(), null);
|
||||
public TrackInfo(LocaleManager locale) {
|
||||
super(CommandSpec.TRACK_INFO.spec(locale), "info", Permission.TRACK_INFO, Predicates.alwaysFalse());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -25,18 +25,19 @@
|
||||
|
||||
package me.lucko.luckperms.common.commands.impl.track;
|
||||
|
||||
import me.lucko.luckperms.common.commands.Arg;
|
||||
import me.lucko.luckperms.common.commands.CommandException;
|
||||
import me.lucko.luckperms.common.commands.CommandResult;
|
||||
import me.lucko.luckperms.common.commands.abstraction.SubCommand;
|
||||
import me.lucko.luckperms.common.commands.sender.Sender;
|
||||
import me.lucko.luckperms.common.commands.utils.Util;
|
||||
import me.lucko.luckperms.common.constants.DataConstraints;
|
||||
import me.lucko.luckperms.common.constants.Message;
|
||||
import me.lucko.luckperms.common.constants.Permission;
|
||||
import me.lucko.luckperms.common.core.model.Group;
|
||||
import me.lucko.luckperms.common.core.model.Track;
|
||||
import me.lucko.luckperms.common.data.LogEntry;
|
||||
import me.lucko.luckperms.common.locale.CommandSpec;
|
||||
import me.lucko.luckperms.common.locale.LocaleManager;
|
||||
import me.lucko.luckperms.common.locale.Message;
|
||||
import me.lucko.luckperms.common.plugin.LuckPermsPlugin;
|
||||
import me.lucko.luckperms.common.utils.Predicates;
|
||||
import me.lucko.luckperms.exceptions.ObjectAlreadyHasException;
|
||||
@ -44,13 +45,8 @@ import me.lucko.luckperms.exceptions.ObjectAlreadyHasException;
|
||||
import java.util.List;
|
||||
|
||||
public class TrackInsert extends SubCommand<Track> {
|
||||
public TrackInsert() {
|
||||
super("insert", "Inserts a group at a given position along the track", Permission.TRACK_INSERT, Predicates.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)")
|
||||
)
|
||||
);
|
||||
public TrackInsert(LocaleManager locale) {
|
||||
super(CommandSpec.TRACK_INSERT.spec(locale), "insert", Permission.TRACK_INSERT, Predicates.not(2));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -30,23 +30,25 @@ import com.google.common.collect.ImmutableList;
|
||||
import me.lucko.luckperms.common.commands.abstraction.Command;
|
||||
import me.lucko.luckperms.common.commands.abstraction.MainCommand;
|
||||
import me.lucko.luckperms.common.commands.sender.Sender;
|
||||
import me.lucko.luckperms.common.constants.Message;
|
||||
import me.lucko.luckperms.common.core.model.Track;
|
||||
import me.lucko.luckperms.common.locale.CommandSpec;
|
||||
import me.lucko.luckperms.common.locale.LocaleManager;
|
||||
import me.lucko.luckperms.common.locale.Message;
|
||||
import me.lucko.luckperms.common.plugin.LuckPermsPlugin;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class TrackMainCommand extends MainCommand<Track> {
|
||||
public TrackMainCommand() {
|
||||
super("Track", "Track commands", "/%s track <track>", 2, ImmutableList.<Command<Track, ?>>builder()
|
||||
.add(new TrackInfo())
|
||||
.add(new TrackAppend())
|
||||
.add(new TrackInsert())
|
||||
.add(new TrackRemove())
|
||||
.add(new TrackClear())
|
||||
.add(new TrackRename())
|
||||
.add(new TrackClone())
|
||||
public TrackMainCommand(LocaleManager locale) {
|
||||
super(CommandSpec.TRACK.spec(locale), "Track", 2, ImmutableList.<Command<Track, ?>>builder()
|
||||
.add(new TrackInfo(locale))
|
||||
.add(new TrackAppend(locale))
|
||||
.add(new TrackInsert(locale))
|
||||
.add(new TrackRemove(locale))
|
||||
.add(new TrackClear(locale))
|
||||
.add(new TrackRename(locale))
|
||||
.add(new TrackClone(locale))
|
||||
.build()
|
||||
);
|
||||
}
|
||||
|
@ -25,17 +25,18 @@
|
||||
|
||||
package me.lucko.luckperms.common.commands.impl.track;
|
||||
|
||||
import me.lucko.luckperms.common.commands.Arg;
|
||||
import me.lucko.luckperms.common.commands.CommandException;
|
||||
import me.lucko.luckperms.common.commands.CommandResult;
|
||||
import me.lucko.luckperms.common.commands.abstraction.SubCommand;
|
||||
import me.lucko.luckperms.common.commands.sender.Sender;
|
||||
import me.lucko.luckperms.common.commands.utils.Util;
|
||||
import me.lucko.luckperms.common.constants.DataConstraints;
|
||||
import me.lucko.luckperms.common.constants.Message;
|
||||
import me.lucko.luckperms.common.constants.Permission;
|
||||
import me.lucko.luckperms.common.core.model.Track;
|
||||
import me.lucko.luckperms.common.data.LogEntry;
|
||||
import me.lucko.luckperms.common.locale.CommandSpec;
|
||||
import me.lucko.luckperms.common.locale.LocaleManager;
|
||||
import me.lucko.luckperms.common.locale.Message;
|
||||
import me.lucko.luckperms.common.plugin.LuckPermsPlugin;
|
||||
import me.lucko.luckperms.common.utils.Predicates;
|
||||
import me.lucko.luckperms.exceptions.ObjectLacksException;
|
||||
@ -43,10 +44,8 @@ import me.lucko.luckperms.exceptions.ObjectLacksException;
|
||||
import java.util.List;
|
||||
|
||||
public class TrackRemove extends SubCommand<Track> {
|
||||
public TrackRemove() {
|
||||
super("remove", "Removes a group from the track", Permission.TRACK_REMOVE, Predicates.not(1),
|
||||
Arg.list(Arg.create("group", true, "the group to remove"))
|
||||
);
|
||||
public TrackRemove(LocaleManager locale) {
|
||||
super(CommandSpec.TRACK_REMOVE.spec(locale), "remove", Permission.TRACK_REMOVE, Predicates.not(1));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -27,26 +27,25 @@ package me.lucko.luckperms.common.commands.impl.track;
|
||||
|
||||
import me.lucko.luckperms.api.event.cause.CreationCause;
|
||||
import me.lucko.luckperms.api.event.cause.DeletionCause;
|
||||
import me.lucko.luckperms.common.commands.Arg;
|
||||
import me.lucko.luckperms.common.commands.CommandException;
|
||||
import me.lucko.luckperms.common.commands.CommandResult;
|
||||
import me.lucko.luckperms.common.commands.abstraction.SubCommand;
|
||||
import me.lucko.luckperms.common.commands.sender.Sender;
|
||||
import me.lucko.luckperms.common.constants.DataConstraints;
|
||||
import me.lucko.luckperms.common.constants.Message;
|
||||
import me.lucko.luckperms.common.constants.Permission;
|
||||
import me.lucko.luckperms.common.core.model.Track;
|
||||
import me.lucko.luckperms.common.data.LogEntry;
|
||||
import me.lucko.luckperms.common.locale.CommandSpec;
|
||||
import me.lucko.luckperms.common.locale.LocaleManager;
|
||||
import me.lucko.luckperms.common.locale.Message;
|
||||
import me.lucko.luckperms.common.plugin.LuckPermsPlugin;
|
||||
import me.lucko.luckperms.common.utils.Predicates;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class TrackRename extends SubCommand<Track> {
|
||||
public TrackRename() {
|
||||
super("rename", "Rename the track", Permission.TRACK_RENAME, Predicates.not(1),
|
||||
Arg.list(Arg.create("name", true, "the new name"))
|
||||
);
|
||||
public TrackRename(LocaleManager locale) {
|
||||
super(CommandSpec.TRACK_RENAME.spec(locale), "rename", Permission.TRACK_RENAME, Predicates.not(1));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -27,7 +27,6 @@ package me.lucko.luckperms.common.commands.impl.user;
|
||||
|
||||
import me.lucko.luckperms.api.Node;
|
||||
import me.lucko.luckperms.api.context.MutableContextSet;
|
||||
import me.lucko.luckperms.common.commands.Arg;
|
||||
import me.lucko.luckperms.common.commands.CommandException;
|
||||
import me.lucko.luckperms.common.commands.CommandResult;
|
||||
import me.lucko.luckperms.common.commands.abstraction.SubCommand;
|
||||
@ -35,13 +34,15 @@ import me.lucko.luckperms.common.commands.sender.Sender;
|
||||
import me.lucko.luckperms.common.commands.utils.ArgumentUtils;
|
||||
import me.lucko.luckperms.common.commands.utils.Util;
|
||||
import me.lucko.luckperms.common.constants.DataConstraints;
|
||||
import me.lucko.luckperms.common.constants.Message;
|
||||
import me.lucko.luckperms.common.constants.Permission;
|
||||
import me.lucko.luckperms.common.core.NodeFactory;
|
||||
import me.lucko.luckperms.common.core.model.Group;
|
||||
import me.lucko.luckperms.common.core.model.Track;
|
||||
import me.lucko.luckperms.common.core.model.User;
|
||||
import me.lucko.luckperms.common.data.LogEntry;
|
||||
import me.lucko.luckperms.common.locale.CommandSpec;
|
||||
import me.lucko.luckperms.common.locale.LocaleManager;
|
||||
import me.lucko.luckperms.common.locale.Message;
|
||||
import me.lucko.luckperms.common.plugin.LuckPermsPlugin;
|
||||
import me.lucko.luckperms.common.utils.Predicates;
|
||||
import me.lucko.luckperms.exceptions.ObjectLacksException;
|
||||
@ -51,13 +52,8 @@ import java.util.Set;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
public class UserDemote extends SubCommand<User> {
|
||||
public UserDemote() {
|
||||
super("demote", "Demotes the user down a track", Permission.USER_DEMOTE, Predicates.is(0),
|
||||
Arg.list(
|
||||
Arg.create("track", true, "the track to demote the user down"),
|
||||
Arg.create("context...", false, "the contexts to demote the user in")
|
||||
)
|
||||
);
|
||||
public UserDemote(LocaleManager locale) {
|
||||
super(CommandSpec.USER_DEMOTE.spec(locale), "demote", Permission.USER_DEMOTE, Predicates.is(0));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -33,9 +33,11 @@ import me.lucko.luckperms.common.commands.CommandResult;
|
||||
import me.lucko.luckperms.common.commands.abstraction.SubCommand;
|
||||
import me.lucko.luckperms.common.commands.sender.Sender;
|
||||
import me.lucko.luckperms.common.commands.utils.Util;
|
||||
import me.lucko.luckperms.common.constants.Message;
|
||||
import me.lucko.luckperms.common.constants.Permission;
|
||||
import me.lucko.luckperms.common.core.model.User;
|
||||
import me.lucko.luckperms.common.locale.CommandSpec;
|
||||
import me.lucko.luckperms.common.locale.LocaleManager;
|
||||
import me.lucko.luckperms.common.locale.Message;
|
||||
import me.lucko.luckperms.common.plugin.LuckPermsPlugin;
|
||||
import me.lucko.luckperms.common.utils.DateUtil;
|
||||
import me.lucko.luckperms.common.utils.Predicates;
|
||||
@ -45,8 +47,8 @@ import java.util.Set;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
public class UserInfo extends SubCommand<User> {
|
||||
public UserInfo() {
|
||||
super("info", "Shows info about the user", Permission.USER_INFO, Predicates.alwaysFalse(), null);
|
||||
public UserInfo(LocaleManager locale) {
|
||||
super(CommandSpec.USER_INFO.spec(locale), "info", Permission.USER_INFO, Predicates.alwaysFalse());
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
|
@ -38,26 +38,28 @@ import me.lucko.luckperms.common.commands.impl.generic.permission.CommandPermiss
|
||||
import me.lucko.luckperms.common.commands.sender.Sender;
|
||||
import me.lucko.luckperms.common.commands.utils.Util;
|
||||
import me.lucko.luckperms.common.constants.DataConstraints;
|
||||
import me.lucko.luckperms.common.constants.Message;
|
||||
import me.lucko.luckperms.common.core.model.User;
|
||||
import me.lucko.luckperms.common.locale.CommandSpec;
|
||||
import me.lucko.luckperms.common.locale.LocaleManager;
|
||||
import me.lucko.luckperms.common.locale.Message;
|
||||
import me.lucko.luckperms.common.plugin.LuckPermsPlugin;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
|
||||
public class UserMainCommand extends MainCommand<User> {
|
||||
public UserMainCommand() {
|
||||
super("User", "User commands", "/%s user <user>", 2, ImmutableList.<Command<User, ?>>builder()
|
||||
.add(new UserInfo())
|
||||
.add(new CommandPermission<>(true))
|
||||
.add(new CommandParent<>(true))
|
||||
.add(new CommandMeta<>(true))
|
||||
.add(new HolderEditor<>(true))
|
||||
.add(new UserSwitchPrimaryGroup())
|
||||
.add(new UserPromote())
|
||||
.add(new UserDemote())
|
||||
.add(new HolderShowTracks<>(true))
|
||||
.add(new HolderClear<>(true))
|
||||
public UserMainCommand(LocaleManager locale) {
|
||||
super(CommandSpec.USER.spec(locale), "User", 2, ImmutableList.<Command<User, ?>>builder()
|
||||
.add(new UserInfo(locale))
|
||||
.add(new CommandPermission<>(locale, true))
|
||||
.add(new CommandParent<>(locale, true))
|
||||
.add(new CommandMeta<>(locale, true))
|
||||
.add(new HolderEditor<>(locale, true))
|
||||
.add(new UserSwitchPrimaryGroup(locale))
|
||||
.add(new UserPromote(locale))
|
||||
.add(new UserDemote(locale))
|
||||
.add(new HolderShowTracks<>(locale, true))
|
||||
.add(new HolderClear<>(locale, true))
|
||||
.build()
|
||||
);
|
||||
}
|
||||
|
@ -27,7 +27,6 @@ package me.lucko.luckperms.common.commands.impl.user;
|
||||
|
||||
import me.lucko.luckperms.api.Node;
|
||||
import me.lucko.luckperms.api.context.MutableContextSet;
|
||||
import me.lucko.luckperms.common.commands.Arg;
|
||||
import me.lucko.luckperms.common.commands.CommandException;
|
||||
import me.lucko.luckperms.common.commands.CommandResult;
|
||||
import me.lucko.luckperms.common.commands.abstraction.SubCommand;
|
||||
@ -35,13 +34,15 @@ import me.lucko.luckperms.common.commands.sender.Sender;
|
||||
import me.lucko.luckperms.common.commands.utils.ArgumentUtils;
|
||||
import me.lucko.luckperms.common.commands.utils.Util;
|
||||
import me.lucko.luckperms.common.constants.DataConstraints;
|
||||
import me.lucko.luckperms.common.constants.Message;
|
||||
import me.lucko.luckperms.common.constants.Permission;
|
||||
import me.lucko.luckperms.common.core.NodeFactory;
|
||||
import me.lucko.luckperms.common.core.model.Group;
|
||||
import me.lucko.luckperms.common.core.model.Track;
|
||||
import me.lucko.luckperms.common.core.model.User;
|
||||
import me.lucko.luckperms.common.data.LogEntry;
|
||||
import me.lucko.luckperms.common.locale.CommandSpec;
|
||||
import me.lucko.luckperms.common.locale.LocaleManager;
|
||||
import me.lucko.luckperms.common.locale.Message;
|
||||
import me.lucko.luckperms.common.plugin.LuckPermsPlugin;
|
||||
import me.lucko.luckperms.common.utils.Predicates;
|
||||
import me.lucko.luckperms.exceptions.ObjectLacksException;
|
||||
@ -51,13 +52,8 @@ import java.util.Set;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
public class UserPromote extends SubCommand<User> {
|
||||
public UserPromote() {
|
||||
super("promote", "Promotes the user up a track", Permission.USER_PROMOTE, Predicates.is(0),
|
||||
Arg.list(
|
||||
Arg.create("track", true, "the track to promote the user up"),
|
||||
Arg.create("context...", false, "the contexts to promote the user in")
|
||||
)
|
||||
);
|
||||
public UserPromote(LocaleManager locale) {
|
||||
super(CommandSpec.USER_PROMOTE.spec(locale), "promote", Permission.USER_PROMOTE, Predicates.is(0));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -26,27 +26,26 @@
|
||||
package me.lucko.luckperms.common.commands.impl.user;
|
||||
|
||||
import me.lucko.luckperms.api.context.ContextSet;
|
||||
import me.lucko.luckperms.common.commands.Arg;
|
||||
import me.lucko.luckperms.common.commands.CommandException;
|
||||
import me.lucko.luckperms.common.commands.CommandResult;
|
||||
import me.lucko.luckperms.common.commands.abstraction.SubCommand;
|
||||
import me.lucko.luckperms.common.commands.sender.Sender;
|
||||
import me.lucko.luckperms.common.config.ConfigKeys;
|
||||
import me.lucko.luckperms.common.constants.Message;
|
||||
import me.lucko.luckperms.common.constants.Permission;
|
||||
import me.lucko.luckperms.common.core.model.Group;
|
||||
import me.lucko.luckperms.common.core.model.User;
|
||||
import me.lucko.luckperms.common.data.LogEntry;
|
||||
import me.lucko.luckperms.common.locale.CommandSpec;
|
||||
import me.lucko.luckperms.common.locale.LocaleManager;
|
||||
import me.lucko.luckperms.common.locale.Message;
|
||||
import me.lucko.luckperms.common.plugin.LuckPermsPlugin;
|
||||
import me.lucko.luckperms.common.utils.Predicates;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class UserSwitchPrimaryGroup extends SubCommand<User> {
|
||||
public UserSwitchPrimaryGroup() {
|
||||
super("switchprimarygroup", "Switches the user's primary group", Permission.USER_SWITCHPRIMARYGROUP, Predicates.not(1),
|
||||
Arg.list(Arg.create("group", true, "the group to switch to"))
|
||||
);
|
||||
public UserSwitchPrimaryGroup(LocaleManager locale) {
|
||||
super(CommandSpec.USER_SWITCHPRIMARYGROUP.spec(locale), "switchprimarygroup", Permission.USER_SWITCHPRIMARYGROUP, Predicates.not(1));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -31,7 +31,7 @@ import me.lucko.luckperms.api.Node;
|
||||
import me.lucko.luckperms.api.Tristate;
|
||||
import me.lucko.luckperms.api.context.ContextSet;
|
||||
import me.lucko.luckperms.common.commands.sender.Sender;
|
||||
import me.lucko.luckperms.common.constants.Message;
|
||||
import me.lucko.luckperms.common.locale.Message;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
|
@ -28,11 +28,11 @@ package me.lucko.luckperms.common.data;
|
||||
import me.lucko.luckperms.api.Node;
|
||||
import me.lucko.luckperms.common.commands.sender.Sender;
|
||||
import me.lucko.luckperms.common.commands.utils.Util;
|
||||
import me.lucko.luckperms.common.constants.Message;
|
||||
import me.lucko.luckperms.common.core.NodeFactory;
|
||||
import me.lucko.luckperms.common.core.model.Group;
|
||||
import me.lucko.luckperms.common.core.model.Track;
|
||||
import me.lucko.luckperms.common.core.model.User;
|
||||
import me.lucko.luckperms.common.locale.Message;
|
||||
import me.lucko.luckperms.common.plugin.LuckPermsPlugin;
|
||||
import me.lucko.luckperms.common.storage.Storage;
|
||||
import me.lucko.luckperms.common.utils.ProgressLogger;
|
||||
|
@ -37,8 +37,8 @@ import me.lucko.luckperms.common.commands.CommandResult;
|
||||
import me.lucko.luckperms.common.commands.sender.Sender;
|
||||
import me.lucko.luckperms.common.commands.utils.Util;
|
||||
import me.lucko.luckperms.common.constants.Constants;
|
||||
import me.lucko.luckperms.common.constants.Message;
|
||||
import me.lucko.luckperms.common.constants.Permission;
|
||||
import me.lucko.luckperms.common.locale.Message;
|
||||
import me.lucko.luckperms.common.plugin.LuckPermsPlugin;
|
||||
import me.lucko.luckperms.common.utils.DateUtil;
|
||||
|
||||
|
@ -27,12 +27,12 @@ package me.lucko.luckperms.common.data;
|
||||
|
||||
import me.lucko.luckperms.common.commands.sender.Sender;
|
||||
import me.lucko.luckperms.common.config.ConfigKeys;
|
||||
import me.lucko.luckperms.common.constants.Message;
|
||||
import me.lucko.luckperms.common.constants.Permission;
|
||||
import me.lucko.luckperms.common.core.model.Group;
|
||||
import me.lucko.luckperms.common.core.model.PermissionHolder;
|
||||
import me.lucko.luckperms.common.core.model.Track;
|
||||
import me.lucko.luckperms.common.core.model.User;
|
||||
import me.lucko.luckperms.common.locale.Message;
|
||||
import me.lucko.luckperms.common.plugin.LuckPermsPlugin;
|
||||
import me.lucko.luckperms.common.utils.DateUtil;
|
||||
|
||||
|
@ -0,0 +1,656 @@
|
||||
/*
|
||||
* This file is part of LuckPerms, licensed under the MIT License.
|
||||
*
|
||||
* Copyright (c) lucko (Luck) <luck@lucko.me>
|
||||
* Copyright (c) contributors
|
||||
*
|
||||
* 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.common.locale;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Getter;
|
||||
import lombok.ToString;
|
||||
|
||||
import com.google.common.collect.ImmutableList;
|
||||
|
||||
import me.lucko.luckperms.common.commands.Arg;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.ListIterator;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* An enumeration of the command defintion/usage messages used in the plugin.
|
||||
*
|
||||
* <p>The values in this enum are only defaults, and are only returned if no value for the key is present in the
|
||||
* {@link LocaleManager}.</p>
|
||||
*/
|
||||
@SuppressWarnings("SpellCheckingInspection")
|
||||
public enum CommandSpec {
|
||||
|
||||
USER("User commands", "/%s user <user>"),
|
||||
GROUP("Group commands", "/%s group <group>"),
|
||||
TRACK("Track commands", "/%s track <track>"),
|
||||
LOG("Log commands", "/%s log"),
|
||||
|
||||
SYNC("Sync changes with the storage", "/%s sync"),
|
||||
INFO("Print general plugin info", "/%s info"),
|
||||
VERBOSE("Manage verbose permission checking", "/%s verbose <true|false> [filter]",
|
||||
Arg.list(
|
||||
Arg.create("on|record|off|paste", true, "whether to enable/disable logging, or to paste the logged output"),
|
||||
Arg.create("filter", false, "the filter to match entries against")
|
||||
)
|
||||
),
|
||||
TREE("Generate a tree view of permissions", "/%s tree [selection] [max level] [player]",
|
||||
Arg.list(
|
||||
Arg.create("selection", false, "the root of the tree. specify \".\" to include all permissions"),
|
||||
Arg.create("max level", false, "how many branch levels should be returned"),
|
||||
Arg.create("player", false, "the name of an online player to check against")
|
||||
)
|
||||
),
|
||||
SEARCH("Search for users/groups with a specific permission", "/%s search <permission>",
|
||||
Arg.list(
|
||||
Arg.create("permission", true, "the permission to search for"),
|
||||
Arg.create("page", false, "the page to view")
|
||||
)
|
||||
),
|
||||
CHECK("Perform a standard permission check on an online player", "/%s check <user> <permission>",
|
||||
Arg.list(
|
||||
Arg.create("user", true, "the user to check"),
|
||||
Arg.create("permission", true, "the permission to check for")
|
||||
)
|
||||
),
|
||||
NETWORK_SYNC("Sync changes with the storage and request that all other servers on the network do the same", "/%s networksync"),
|
||||
IMPORT("Import data from a file", "/%s import <file>",
|
||||
Arg.list(
|
||||
Arg.create("file", true, "the file to import from")
|
||||
)
|
||||
),
|
||||
EXPORT("Export data to a file", "/%s export <file>",
|
||||
Arg.list(
|
||||
Arg.create("file", true, "the file to export to")
|
||||
)
|
||||
),
|
||||
RELOAD_CONFIG("Reload some of the config options", "/%s reloadconfig"),
|
||||
BULK_UPDATE("Execute bulk change queries on all data", "/%s bulkupdate",
|
||||
Arg.list(
|
||||
Arg.create("data type", true, "the type of data being changed. ('all', 'users' or 'groups')"),
|
||||
Arg.create("action", true, "the action to perform on the data. ('update' or 'delete')"),
|
||||
Arg.create("action field", false, "the field to act upon. only required for 'update'. ('permission', 'server' or 'world')"),
|
||||
Arg.create("action value", false, "the value to replace with. only required for 'update'."),
|
||||
Arg.create("constraint...", false, "the constraints required for the update")
|
||||
)
|
||||
),
|
||||
MIGRATION("Migration commands", "/%s migration"),
|
||||
APPLY_EDITS("Applies permission changes made from the web editor", "/%s applyedits <code> [target]",
|
||||
Arg.list(
|
||||
Arg.create("code", true, "the unique code for the data"),
|
||||
Arg.create("target", false, "who to apply the data to")
|
||||
)
|
||||
),
|
||||
|
||||
CREATE_GROUP("Create a new group", "/%s creategroup <group>",
|
||||
Arg.list(
|
||||
Arg.create("name", true, "the name of the group")
|
||||
)
|
||||
),
|
||||
DELETE_GROUP("Delete a group", "/%s deletegroup <group>",
|
||||
Arg.list(
|
||||
Arg.create("name", true, "the name of the group")
|
||||
)
|
||||
),
|
||||
LIST_GROUPS("List all groups on the platform", "/%s listgroups"),
|
||||
|
||||
CREATE_TRACK("Create a new track", "/%s createtrack <track>",
|
||||
Arg.list(
|
||||
Arg.create("name", true, "the name of the track")
|
||||
)
|
||||
),
|
||||
DELETE_TRACK("Delete a track", "/%s deletetrack <track>",
|
||||
Arg.list(
|
||||
Arg.create("name", true, "the name of the track")
|
||||
)
|
||||
),
|
||||
LIST_TRACKS("List all tracks on the platform", "/%s listtracks"),
|
||||
|
||||
USER_INFO("Shows info about the user"),
|
||||
USER_SWITCHPRIMARYGROUP("Switches the user's primary group",
|
||||
Arg.list(
|
||||
Arg.create("group", true, "the group to switch to")
|
||||
)
|
||||
),
|
||||
USER_PROMOTE("Promotes the user up a track",
|
||||
Arg.list(
|
||||
Arg.create("track", true, "the track to promote the user up"),
|
||||
Arg.create("context...", false, "the contexts to promote the user in")
|
||||
)
|
||||
),
|
||||
USER_DEMOTE("Demotes the user down a track",
|
||||
Arg.list(
|
||||
Arg.create("track", true, "the track to demote the user down"),
|
||||
Arg.create("context...", false, "the contexts to demote the user in")
|
||||
)
|
||||
),
|
||||
|
||||
GROUP_INFO("Gives info about the group"),
|
||||
GROUP_LISTMEMBERS("Show the users/groups who inherit from this group",
|
||||
Arg.list(
|
||||
Arg.create("page", false, "the page to view")
|
||||
)
|
||||
),
|
||||
GROUP_SETWEIGHT("Set the groups weight",
|
||||
Arg.list(
|
||||
Arg.create("weight", true, "the weight to set")
|
||||
)
|
||||
),
|
||||
GROUP_RENAME("Rename the group",
|
||||
Arg.list(
|
||||
Arg.create("name", true, "the new name")
|
||||
)
|
||||
),
|
||||
GROUP_CLONE("Clone the group",
|
||||
Arg.list(
|
||||
Arg.create("name", true, "the name of the group to clone onto")
|
||||
)
|
||||
),
|
||||
|
||||
HOLDER_EDITOR("Opens the web permission editor"),
|
||||
HOLDER_SHOWTRACKS("Lists the tracks that the object is on"),
|
||||
HOLDER_CLEAR("Removes all permissions, parents and meta",
|
||||
Arg.list(
|
||||
Arg.create("context...", false, "the contexts to filter by")
|
||||
)
|
||||
),
|
||||
|
||||
PERMISSION("Edit permissions"),
|
||||
PARENT("Edit inheritances"),
|
||||
META("Edit metadata values"),
|
||||
|
||||
PERMISSION_INFO("Lists the permission nodes the object has",
|
||||
Arg.list(
|
||||
Arg.create("page", false, "the page to view"),
|
||||
Arg.create("filter", false, "the string to filter by")
|
||||
)
|
||||
),
|
||||
PERMISSION_SET("Sets a permission for the object",
|
||||
Arg.list(
|
||||
Arg.create("node", true, "the permission node to set"),
|
||||
Arg.create("true|false", false, "the value of the node"),
|
||||
Arg.create("context...", false, "the contexts to add the permission in")
|
||||
)
|
||||
),
|
||||
PERMISSION_UNSET("Unsets a permission for the object",
|
||||
Arg.list(
|
||||
Arg.create("node", true, "the permission node to unset"),
|
||||
Arg.create("context...", false, "the contexts to remove the permission in")
|
||||
)
|
||||
),
|
||||
PERMISSION_SETTEMP("Sets a permission for the object temporarily",
|
||||
Arg.list(
|
||||
Arg.create("node", true, "the permission node to set"),
|
||||
Arg.create("true|false", false, "the value of the node"),
|
||||
Arg.create("duration", true, "the duration until the permission node expires"),
|
||||
Arg.create("context...", false, "the contexts to add the permission in")
|
||||
)
|
||||
),
|
||||
PERMISSION_UNSETTEMP("Unsets a temporary permission for the object",
|
||||
Arg.list(
|
||||
Arg.create("node", true, "the permission node to unset"),
|
||||
Arg.create("context...", false, "the contexts to remove the permission in")
|
||||
)
|
||||
),
|
||||
PERMISSION_CHECK("Checks to see if the object has a certain permission node",
|
||||
Arg.list(
|
||||
Arg.create("node", true, "the permission node to check for"),
|
||||
Arg.create("context...", false, "the contexts to check in")
|
||||
)
|
||||
),
|
||||
PERMISSION_CHECK_INHERITS("Checks to see if the object inherits a certain permission node",
|
||||
Arg.list(
|
||||
Arg.create("node", true, "the permission node to check for"),
|
||||
Arg.create("context...", false, "the contexts to check in")
|
||||
)
|
||||
),
|
||||
|
||||
PARENT_INFO("Lists the groups that this object inherits from"),
|
||||
PARENT_SET("Removes all other groups the object inherits already and adds them to the one given",
|
||||
Arg.list(
|
||||
Arg.create("group", true, "the group to set to"),
|
||||
Arg.create("context...", false, "the contexts to set the group in")
|
||||
)
|
||||
),
|
||||
PARENT_ADD("Sets another group for the object to inherit permissions from",
|
||||
Arg.list(
|
||||
Arg.create("group", true, "the group to inherit from"),
|
||||
Arg.create("context...", false, "the contexts to inherit the group in")
|
||||
)
|
||||
),
|
||||
PARENT_REMOVE("Removes a previously set inheritance rule",
|
||||
Arg.list(
|
||||
Arg.create("group", true, "the group to remove"),
|
||||
Arg.create("context...", false, "the contexts to remove the group in")
|
||||
)
|
||||
),
|
||||
PARENT_SET_TRACK("Removes all other groups the object inherits from already on the given track and adds them to the one given",
|
||||
Arg.list(
|
||||
Arg.create("track", true, "the track to set on"),
|
||||
Arg.create("group", true, "the group to set to, or a number relating to the position of the group on the given track"),
|
||||
Arg.create("context...", false, "the contexts to set the group in")
|
||||
)
|
||||
),
|
||||
PARENT_ADD_TEMP("Sets another group for the object to inherit permissions from temporarily",
|
||||
Arg.list(
|
||||
Arg.create("group", true, "the group to inherit from"),
|
||||
Arg.create("duration", true, "the duration of the group membership"),
|
||||
Arg.create("context...", false, "the contexts to inherit the group in")
|
||||
)
|
||||
),
|
||||
PARENT_REMOVE_TEMP("Removes a previously set temporary inheritance rule",
|
||||
Arg.list(
|
||||
Arg.create("group", true, "the group to remove"),
|
||||
Arg.create("context...", false, "the contexts to remove the group in")
|
||||
)
|
||||
),
|
||||
PARENT_CLEAR("Clears all parents",
|
||||
Arg.list(
|
||||
Arg.create("context...", false, "the contexts to filter by")
|
||||
)
|
||||
),
|
||||
PARENT_CLEAR_TRACK("Clears all parents on a given track",
|
||||
Arg.list(
|
||||
Arg.create("track", true, "the track to remove on"),
|
||||
Arg.create("context...", false, "the contexts to filter by")
|
||||
)
|
||||
),
|
||||
|
||||
META_INFO("Shows all chat meta"),
|
||||
META_SET("Sets a meta value",
|
||||
Arg.list(
|
||||
Arg.create("key", true, "the key to set"),
|
||||
Arg.create("value", true, "the value to set"),
|
||||
Arg.create("context...", false, "the contexts to add the meta pair in")
|
||||
)
|
||||
),
|
||||
META_UNSET("Unsets a meta value",
|
||||
Arg.list(
|
||||
Arg.create("key", true, "the key to unset"),
|
||||
Arg.create("context...", false, "the contexts to remove the meta pair in")
|
||||
)
|
||||
),
|
||||
META_SETTEMP("Sets a meta value temporarily",
|
||||
Arg.list(
|
||||
Arg.create("key", true, "the key to set"),
|
||||
Arg.create("value", true, "the value to set"),
|
||||
Arg.create("duration", true, "the duration until the meta value expires"),
|
||||
Arg.create("context...", false, "the contexts to add the meta pair in")
|
||||
)
|
||||
),
|
||||
META_UNSETTEMP("Unsets a temporary meta value",
|
||||
Arg.list(
|
||||
Arg.create("key", true, "the key to unset"),
|
||||
Arg.create("context...", false, "the contexts to remove the meta pair in")
|
||||
)
|
||||
),
|
||||
META_ADDPREFIX("Adds a prefix",
|
||||
Arg.list(
|
||||
Arg.create("priority", true, "the priority to add the prefix at"),
|
||||
Arg.create("prefix", true, "the prefix string"),
|
||||
Arg.create("context...", false, "the contexts to add the prefix in")
|
||||
)
|
||||
),
|
||||
META_ADDSUFFIX("Adds a suffix",
|
||||
Arg.list(
|
||||
Arg.create("priority", true, "the priority to add the suffix at"),
|
||||
Arg.create("suffix", true, "the suffix string"),
|
||||
Arg.create("context...", false, "the contexts to add the suffix in")
|
||||
)
|
||||
),
|
||||
META_REMOVEPREFIX("Removes a prefix",
|
||||
Arg.list(
|
||||
Arg.create("priority", true, "the priority to remove the prefix at"),
|
||||
Arg.create("prefix", false, "the prefix string"),
|
||||
Arg.create("context...", false, "the contexts to remove the prefix in")
|
||||
)
|
||||
),
|
||||
META_REMOVESUFFIX("Removes a suffix",
|
||||
Arg.list(
|
||||
Arg.create("priority", true, "the priority to remove the suffix at"),
|
||||
Arg.create("suffix", false, "the suffix string"),
|
||||
Arg.create("context...", false, "the contexts to remove the suffix in")
|
||||
)
|
||||
),
|
||||
META_ADDTEMP_PREFIX("Adds a prefix temporarily",
|
||||
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("context...", false, "the contexts to add the prefix in")
|
||||
)
|
||||
),
|
||||
META_ADDTEMP_SUFFIX("Adds a suffix temporarily",
|
||||
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("context...", false, "the contexts to add the suffix in")
|
||||
)
|
||||
),
|
||||
META_REMOVETEMP_PREFIX("Removes a temporary prefix",
|
||||
Arg.list(
|
||||
Arg.create("priority", true, "the priority to remove the prefix at"),
|
||||
Arg.create("prefix", false, "the prefix string"),
|
||||
Arg.create("context...", false, "the contexts to remove the prefix in")
|
||||
)
|
||||
),
|
||||
META_REMOVETEMP_SUFFIX("Removes a temporary suffix",
|
||||
Arg.list(
|
||||
Arg.create("priority", true, "the priority to remove the suffix at"),
|
||||
Arg.create("suffix", false, "the suffix string"),
|
||||
Arg.create("context...", false, "the contexts to remove the suffix in")
|
||||
)
|
||||
),
|
||||
META_CLEAR("Clears all chat meta",
|
||||
Arg.list(
|
||||
Arg.create("context...", false, "the contexts to filter by")
|
||||
)
|
||||
),
|
||||
|
||||
TRACK_INFO("Gives info about the track"),
|
||||
TRACK_APPEND("Appends a group onto the end of the track",
|
||||
Arg.list(
|
||||
Arg.create("group", true, "the group to append")
|
||||
)
|
||||
),
|
||||
TRACK_INSERT("Inserts a group at a given position along the track",
|
||||
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)")
|
||||
)
|
||||
),
|
||||
TRACK_REMOVE("Removes a group from the track",
|
||||
Arg.list(
|
||||
Arg.create("group", true, "the group to remove")
|
||||
)
|
||||
),
|
||||
TRACK_CLEAR("Clears the groups on the track"),
|
||||
TRACK_RENAME("Rename the track",
|
||||
Arg.list(
|
||||
Arg.create("name", true, "the new name")
|
||||
)
|
||||
),
|
||||
TRACK_CLONE("Clone the track",
|
||||
Arg.list(
|
||||
Arg.create("name", true, "the name of the track to clone onto")
|
||||
)
|
||||
),
|
||||
|
||||
LOG_RECENT("View recent actions",
|
||||
Arg.list(
|
||||
Arg.create("user", false, "the name/uuid of the user to filter by"),
|
||||
Arg.create("page", false, "the page number to view")
|
||||
)
|
||||
),
|
||||
LOG_SEARCH("Search the log for an entry",
|
||||
Arg.list(
|
||||
Arg.create("query", true, "the query to search by"),
|
||||
Arg.create("page", false, "the page number to view")
|
||||
)
|
||||
),
|
||||
LOG_NOTIFY("Toggle log notifications",
|
||||
Arg.list(
|
||||
Arg.create("on|off", false, "whether to toggle on or off")
|
||||
)
|
||||
),
|
||||
LOG_USER_HISTORY("View a user's history",
|
||||
Arg.list(
|
||||
Arg.create("user", true, "the name/uuid of the user"),
|
||||
Arg.create("page", false, "the page number to view")
|
||||
)
|
||||
),
|
||||
LOG_GROUP_HISTORY("View an group's history",
|
||||
Arg.list(
|
||||
Arg.create("group", true, "the name of the group"),
|
||||
Arg.create("page", false, "the page number to view")
|
||||
)
|
||||
),
|
||||
LOG_TRACK_HISTORY("View a track's history",
|
||||
Arg.list(
|
||||
Arg.create("track", true, "the name of the track"),
|
||||
Arg.create("page", false, "the page number to view")
|
||||
)
|
||||
),
|
||||
|
||||
SPONGE("Edit extra Sponge data", "/%s sponge <collection> <subject>",
|
||||
Arg.list(
|
||||
Arg.create("collection", true, "the collection to query"),
|
||||
Arg.create("subject", true, "the subject to modify")
|
||||
)
|
||||
),
|
||||
SPONGE_PERMISSION_INFO("Shows info about the subject's permissions",
|
||||
Arg.list(
|
||||
Arg.create("contexts...", false, "the contexts to filter by")
|
||||
)
|
||||
),
|
||||
SPONGE_PERMISSION_SET("Sets a permission for the Subject",
|
||||
Arg.list(
|
||||
Arg.create("node", true, "the permission node to set"),
|
||||
Arg.create("tristate", true, "the value to set the permission to"),
|
||||
Arg.create("contexts...", false, "the contexts to set the permission in")
|
||||
)
|
||||
),
|
||||
SPONGE_PERMISSION_CLEAR("Clears the Subjects permissions",
|
||||
Arg.list(
|
||||
Arg.create("contexts...", false, "the contexts to clear permissions in")
|
||||
)
|
||||
),
|
||||
SPONGE_PARENT_INFO("Shows info about the subject's parents",
|
||||
Arg.list(
|
||||
Arg.create("contexts...", false, "the contexts to filter by")
|
||||
)
|
||||
),
|
||||
SPONGE_PARENT_ADD("Adds a parent to the Subject",
|
||||
Arg.list(
|
||||
Arg.create("collection", true, "the subject collection where the parent Subject is"),
|
||||
Arg.create("subject", true, "the name of the parent Subject"),
|
||||
Arg.create("contexts...", false, "the contexts to add the parent in")
|
||||
)
|
||||
),
|
||||
SPONGE_PARENT_REMOVE("Removes a parent from the Subject",
|
||||
Arg.list(
|
||||
Arg.create("collection", true, "the subject collection where the parent Subject is"),
|
||||
Arg.create("subject", true, "the name of the parent Subject"),
|
||||
Arg.create("contexts...", false, "the contexts to remove the parent in")
|
||||
)
|
||||
),
|
||||
SPONGE_PARENT_CLEAR("Clears the Subjects parents",
|
||||
Arg.list(
|
||||
Arg.create("contexts...", false, "the contexts to clear parents in")
|
||||
)
|
||||
),
|
||||
SPONGE_OPTION_INFO("Shows info about the subject's options",
|
||||
Arg.list(
|
||||
Arg.create("contexts...", false, "the contexts to filter by")
|
||||
)
|
||||
),
|
||||
SPONGE_OPTION_SET("Sets an option for the Subject",
|
||||
Arg.list(
|
||||
Arg.create("key", true, "the key to set"),
|
||||
Arg.create("value", true, "the value to set the key to"),
|
||||
Arg.create("contexts...", false, "the contexts to set the option in")
|
||||
)
|
||||
),
|
||||
SPONGE_OPTION_UNSET("Unsets an option for the Subject",
|
||||
Arg.list(
|
||||
Arg.create("key", true, "the key to unset"),
|
||||
Arg.create("contexts...", false, "the contexts to unset the key in")
|
||||
)
|
||||
),
|
||||
SPONGE_OPTION_CLEAR("Clears the Subjects options",
|
||||
Arg.list(
|
||||
Arg.create("contexts...", false, "the contexts to clear options in")
|
||||
)
|
||||
),
|
||||
|
||||
MIGRATION_COMMAND("Migration command"),
|
||||
MIGRATION_GROUPMANAGER("Migration command",
|
||||
Arg.list(
|
||||
Arg.create("migrate as global", true, "if world permissions should be ignored, and just migrated as global")
|
||||
)
|
||||
),
|
||||
MIGRATION_POWERFULPERMS("Migration command",
|
||||
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")
|
||||
)
|
||||
);
|
||||
|
||||
private final String description;
|
||||
private final String usage;
|
||||
private final List<Arg> args;
|
||||
|
||||
CommandSpec(String description, String usage, List<Arg> args) {
|
||||
this.description = description;
|
||||
this.usage = usage;
|
||||
this.args = args;
|
||||
}
|
||||
|
||||
CommandSpec(String description, String usage) {
|
||||
this(description, usage, null);
|
||||
}
|
||||
|
||||
CommandSpec(String description) {
|
||||
this(description, null, null);
|
||||
}
|
||||
|
||||
CommandSpec(String description, List<Arg> args) {
|
||||
this(description, null, args);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a {@link LocalizedSpec} for the spec using the platforms locale manager.
|
||||
*
|
||||
* @param localeManager the locale manager to use for the spec
|
||||
* @return a localized spec instance
|
||||
*/
|
||||
public LocalizedSpec spec(LocaleManager localeManager) {
|
||||
return new SimpleLocalizedSpec(this, localeManager);
|
||||
}
|
||||
|
||||
/**
|
||||
* The localized data for a {@link CommandSpec}.
|
||||
*/
|
||||
@Getter
|
||||
@ToString
|
||||
@AllArgsConstructor
|
||||
public static final class CommandSpecData {
|
||||
private final String description;
|
||||
private final String usage;
|
||||
private final Map<String, String> args;
|
||||
}
|
||||
|
||||
private static final class SimpleLocalizedSpec implements LocalizedSpec {
|
||||
|
||||
@Getter
|
||||
private final LocaleManager localeManager;
|
||||
|
||||
private final CommandSpec spec;
|
||||
|
||||
public SimpleLocalizedSpec(CommandSpec spec, LocaleManager localeManager) {
|
||||
this.localeManager = localeManager;
|
||||
this.spec = spec;
|
||||
}
|
||||
|
||||
public String description() {
|
||||
CommandSpecData translation = localeManager.getTranslation(spec);
|
||||
if (translation != null && translation.getDescription() != null) {
|
||||
return translation.getDescription();
|
||||
}
|
||||
|
||||
// fallback
|
||||
return spec.description;
|
||||
}
|
||||
|
||||
public String usage() {
|
||||
CommandSpecData translation = localeManager.getTranslation(spec);
|
||||
if (translation != null && translation.getUsage() != null) {
|
||||
return translation.getUsage();
|
||||
}
|
||||
|
||||
// fallback
|
||||
return spec.usage;
|
||||
}
|
||||
|
||||
public List<Arg> args() {
|
||||
CommandSpecData translation = localeManager.getTranslation(spec);
|
||||
if (translation == null || translation.getArgs() == null) {
|
||||
// fallback
|
||||
return spec.args;
|
||||
}
|
||||
|
||||
List<Arg> args = new ArrayList<>(spec.args);
|
||||
ListIterator<Arg> it = args.listIterator();
|
||||
while (it.hasNext()) {
|
||||
Arg next = it.next();
|
||||
String s = translation.getArgs().get(next.getName());
|
||||
|
||||
// if a translation for the given arg key is present, apply the new description.
|
||||
if (s != null) {
|
||||
it.set(Arg.create(next.getName(), next.isRequired(), s));
|
||||
}
|
||||
}
|
||||
|
||||
return ImmutableList.copyOf(args);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Prints this CommandSpec enum in a yml format, for reading by the {@link me.lucko.luckperms.common.locale.LocaleManager}
|
||||
* @param args not needed
|
||||
*/
|
||||
public static void main(String[] args) {
|
||||
System.out.println("command-specs:");
|
||||
|
||||
for (CommandSpec spec : values()) {
|
||||
String key = spec.name().replace('_', '-').toLowerCase();
|
||||
|
||||
System.out.println(" " + key + ":");
|
||||
|
||||
if (spec.description != null) {
|
||||
System.out.println(" description: \"" + spec.description.replace("\"", "\\\"") + "\"");
|
||||
}
|
||||
if (spec.usage != null) {
|
||||
System.out.println(" usage: \"" + spec.usage.replace("\"", "\\\"") + "\"");
|
||||
}
|
||||
|
||||
if (spec.args != null && !spec.args.isEmpty()) {
|
||||
System.out.println(" args:");
|
||||
for (Arg arg : spec.args) {
|
||||
System.out.println(" \"" + arg.getName() + "\": \"" + arg.getDescription().replace("\"", "\\\"") + "\"");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
@ -25,8 +25,6 @@
|
||||
|
||||
package me.lucko.luckperms.common.locale;
|
||||
|
||||
import me.lucko.luckperms.common.constants.Message;
|
||||
|
||||
import java.io.File;
|
||||
|
||||
/**
|
||||
@ -40,9 +38,18 @@ public interface LocaleManager {
|
||||
|
||||
/**
|
||||
* Gets a translation for a given message key
|
||||
*
|
||||
* @param key the key
|
||||
* @return the translation, or null if there isn't a translation available.
|
||||
* @return the translation, or null if there isn't any translation available.
|
||||
*/
|
||||
String getTranslation(Message key);
|
||||
|
||||
/**
|
||||
* Gets a translation for a given command spec key
|
||||
*
|
||||
* @param key the key
|
||||
* @return the translation data, or null if there isn't any translation available.
|
||||
*/
|
||||
CommandSpec.CommandSpecData getTranslation(CommandSpec key);
|
||||
|
||||
}
|
||||
|
@ -0,0 +1,50 @@
|
||||
/*
|
||||
* This file is part of LuckPerms, licensed under the MIT License.
|
||||
*
|
||||
* Copyright (c) lucko (Luck) <luck@lucko.me>
|
||||
* Copyright (c) contributors
|
||||
*
|
||||
* 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.common.locale;
|
||||
|
||||
import me.lucko.luckperms.common.commands.Arg;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Represents a localized instance of a {@link CommandSpec}.
|
||||
*/
|
||||
public interface LocalizedSpec {
|
||||
|
||||
/**
|
||||
* Gets the locale manager used to translate the {@link CommandSpec}.
|
||||
*
|
||||
* @return the locale manager
|
||||
*/
|
||||
LocaleManager getLocaleManager();
|
||||
|
||||
String description();
|
||||
|
||||
String usage();
|
||||
|
||||
List<Arg> args();
|
||||
|
||||
}
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user