Remove static imports

This commit is contained in:
Luck 2018-12-18 12:51:26 +00:00
parent 879a88a398
commit 8c57c2b46d
No known key found for this signature in database
GPG Key ID: EFA9B3EC5FD90F8B
4 changed files with 141 additions and 151 deletions

View File

@ -35,6 +35,7 @@ import me.lucko.luckperms.api.ChatMetaType;
import me.lucko.luckperms.api.event.cause.CreationCause;
import me.lucko.luckperms.common.command.CommandResult;
import me.lucko.luckperms.common.command.abstraction.SubCommand;
import me.lucko.luckperms.common.command.access.CommandPermission;
import me.lucko.luckperms.common.commands.migration.MigrationUtils;
import me.lucko.luckperms.common.locale.LocaleManager;
import me.lucko.luckperms.common.locale.command.CommandSpec;
@ -59,8 +60,6 @@ import java.util.Set;
import java.util.UUID;
import java.util.concurrent.atomic.AtomicInteger;
import static me.lucko.luckperms.common.command.access.CommandPermission.MIGRATION;
public class MigrationBPermissions extends SubCommand<Object> {
private static final Field UCONFIG_FIELD;
static {
@ -73,7 +72,7 @@ public class MigrationBPermissions extends SubCommand<Object> {
}
public MigrationBPermissions(LocaleManager locale) {
super(CommandSpec.MIGRATION_COMMAND.localize(locale), "bpermissions", MIGRATION, Predicates.alwaysFalse());
super(CommandSpec.MIGRATION_COMMAND.localize(locale), "bpermissions", CommandPermission.MIGRATION, Predicates.alwaysFalse());
}
@Override

View File

@ -37,6 +37,7 @@ import me.lucko.luckperms.api.Node;
import me.lucko.luckperms.api.event.cause.CreationCause;
import me.lucko.luckperms.common.command.CommandResult;
import me.lucko.luckperms.common.command.abstraction.SubCommand;
import me.lucko.luckperms.common.command.access.CommandPermission;
import me.lucko.luckperms.common.commands.migration.MigrationUtils;
import me.lucko.luckperms.common.config.ConfigKeys;
import me.lucko.luckperms.common.locale.LocaleManager;
@ -68,12 +69,10 @@ import java.util.concurrent.ExecutionException;
import java.util.concurrent.Future;
import java.util.concurrent.atomic.AtomicInteger;
import static me.lucko.luckperms.common.command.access.CommandPermission.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(LocaleManager locale) {
super(CommandSpec.MIGRATION_POWERFULPERMS.localize(locale), "powerfulperms", MIGRATION, Predicates.not(5));
super(CommandSpec.MIGRATION_POWERFULPERMS.localize(locale), "powerfulperms", CommandPermission.MIGRATION, Predicates.not(5));
}
@Override

View File

@ -27,156 +27,149 @@ package me.lucko.luckperms.common.command.access;
import me.lucko.luckperms.common.sender.Sender;
import static me.lucko.luckperms.common.command.access.CommandPermission.Type.GROUP;
import static me.lucko.luckperms.common.command.access.CommandPermission.Type.LOG;
import static me.lucko.luckperms.common.command.access.CommandPermission.Type.NONE;
import static me.lucko.luckperms.common.command.access.CommandPermission.Type.SPONGE;
import static me.lucko.luckperms.common.command.access.CommandPermission.Type.TRACK;
import static me.lucko.luckperms.common.command.access.CommandPermission.Type.USER;
/**
* An enumeration of the permissions required to execute built in LuckPerms commands.
*/
public enum CommandPermission {
SYNC("sync", NONE),
INFO("info", NONE),
EDITOR("editor", NONE),
DEBUG("debug", NONE),
VERBOSE("verbose", NONE),
TREE("tree", NONE),
SEARCH("search", NONE),
CHECK("check", NONE),
IMPORT("import", NONE),
EXPORT("export", NONE),
RELOAD_CONFIG("reloadconfig", NONE),
BULK_UPDATE("bulkupdate", NONE),
APPLY_EDITS("applyedits", NONE),
MIGRATION("migration", NONE),
SYNC("sync", Type.NONE),
INFO("info", Type.NONE),
EDITOR("editor", Type.NONE),
DEBUG("debug", Type.NONE),
VERBOSE("verbose", Type.NONE),
TREE("tree", Type.NONE),
SEARCH("search", Type.NONE),
CHECK("check", Type.NONE),
IMPORT("import", Type.NONE),
EXPORT("export", Type.NONE),
RELOAD_CONFIG("reloadconfig", Type.NONE),
BULK_UPDATE("bulkupdate", Type.NONE),
APPLY_EDITS("applyedits", Type.NONE),
MIGRATION("migration", Type.NONE),
CREATE_GROUP("creategroup", NONE),
DELETE_GROUP("deletegroup", NONE),
LIST_GROUPS("listgroups", NONE),
CREATE_GROUP("creategroup", Type.NONE),
DELETE_GROUP("deletegroup", Type.NONE),
LIST_GROUPS("listgroups", Type.NONE),
CREATE_TRACK("createtrack", NONE),
DELETE_TRACK("deletetrack", NONE),
LIST_TRACKS("listtracks", NONE),
CREATE_TRACK("createtrack", Type.NONE),
DELETE_TRACK("deletetrack", Type.NONE),
LIST_TRACKS("listtracks", Type.NONE),
USER_INFO("info", USER),
USER_PERM_INFO("permission.info", USER),
USER_PERM_SET("permission.set", USER),
USER_PERM_UNSET("permission.unset", USER),
USER_PERM_SET_TEMP("permission.settemp", USER),
USER_PERM_UNSET_TEMP("permission.unsettemp", USER),
USER_PERM_CHECK("permission.check", USER),
USER_PERM_CHECK_INHERITS("permission.checkinherits", USER),
USER_PERM_CLEAR("permission.clear", USER),
USER_PARENT_INFO("parent.info", USER),
USER_PARENT_SET("parent.set", USER),
USER_PARENT_SET_TRACK("parent.settrack", USER),
USER_PARENT_ADD("parent.add", USER),
USER_PARENT_REMOVE("parent.remove", USER),
USER_PARENT_ADD_TEMP("parent.addtemp", USER),
USER_PARENT_REMOVE_TEMP("parent.removetemp", USER),
USER_PARENT_CLEAR("parent.clear", USER),
USER_PARENT_CLEAR_TRACK("parent.cleartrack", USER),
USER_PARENT_SWITCHPRIMARYGROUP("parent.switchprimarygroup", USER),
USER_META_INFO("meta.info", USER),
USER_META_SET("meta.set", USER),
USER_META_UNSET("meta.unset", USER),
USER_META_SET_TEMP("meta.settemp", USER),
USER_META_UNSET_TEMP("meta.unsettemp", USER),
USER_META_ADD_PREFIX("meta.addprefix", USER),
USER_META_ADD_SUFFIX("meta.addsuffix", USER),
USER_META_SET_PREFIX("meta.setprefix", USER),
USER_META_SET_SUFFIX("meta.setsuffix", USER),
USER_META_REMOVE_PREFIX("meta.removeprefix", USER),
USER_META_REMOVE_SUFFIX("meta.removesuffix", USER),
USER_META_ADD_TEMP_PREFIX("meta.addtempprefix", USER),
USER_META_ADD_TEMP_SUFFIX("meta.addtempsuffix", USER),
USER_META_SET_TEMP_PREFIX("meta.settempprefix", USER),
USER_META_SET_TEMP_SUFFIX("meta.settempsuffix", USER),
USER_META_REMOVE_TEMP_PREFIX("meta.removetempprefix", USER),
USER_META_REMOVE_TEMP_SUFFIX("meta.removetempsuffix", USER),
USER_META_CLEAR("meta.clear", USER),
USER_EDITOR("editor", USER),
USER_SHOW_TRACKS("showtracks", USER),
USER_PROMOTE("promote", USER),
USER_DEMOTE("demote", USER),
USER_CLEAR("clear", USER),
USER_CLONE("clone", USER),
USER_INFO("info", Type.USER),
USER_PERM_INFO("permission.info", Type.USER),
USER_PERM_SET("permission.set", Type.USER),
USER_PERM_UNSET("permission.unset", Type.USER),
USER_PERM_SET_TEMP("permission.settemp", Type.USER),
USER_PERM_UNSET_TEMP("permission.unsettemp", Type.USER),
USER_PERM_CHECK("permission.check", Type.USER),
USER_PERM_CHECK_INHERITS("permission.checkinherits", Type.USER),
USER_PERM_CLEAR("permission.clear", Type.USER),
USER_PARENT_INFO("parent.info", Type.USER),
USER_PARENT_SET("parent.set", Type.USER),
USER_PARENT_SET_TRACK("parent.settrack", Type.USER),
USER_PARENT_ADD("parent.add", Type.USER),
USER_PARENT_REMOVE("parent.remove", Type.USER),
USER_PARENT_ADD_TEMP("parent.addtemp", Type.USER),
USER_PARENT_REMOVE_TEMP("parent.removetemp", Type.USER),
USER_PARENT_CLEAR("parent.clear", Type.USER),
USER_PARENT_CLEAR_TRACK("parent.cleartrack", Type.USER),
USER_PARENT_SWITCHPRIMARYGROUP("parent.switchprimarygroup", Type.USER),
USER_META_INFO("meta.info", Type.USER),
USER_META_SET("meta.set", Type.USER),
USER_META_UNSET("meta.unset", Type.USER),
USER_META_SET_TEMP("meta.settemp", Type.USER),
USER_META_UNSET_TEMP("meta.unsettemp", Type.USER),
USER_META_ADD_PREFIX("meta.addprefix", Type.USER),
USER_META_ADD_SUFFIX("meta.addsuffix", Type.USER),
USER_META_SET_PREFIX("meta.setprefix", Type.USER),
USER_META_SET_SUFFIX("meta.setsuffix", Type.USER),
USER_META_REMOVE_PREFIX("meta.removeprefix", Type.USER),
USER_META_REMOVE_SUFFIX("meta.removesuffix", Type.USER),
USER_META_ADD_TEMP_PREFIX("meta.addtempprefix", Type.USER),
USER_META_ADD_TEMP_SUFFIX("meta.addtempsuffix", Type.USER),
USER_META_SET_TEMP_PREFIX("meta.settempprefix", Type.USER),
USER_META_SET_TEMP_SUFFIX("meta.settempsuffix", Type.USER),
USER_META_REMOVE_TEMP_PREFIX("meta.removetempprefix", Type.USER),
USER_META_REMOVE_TEMP_SUFFIX("meta.removetempsuffix", Type.USER),
USER_META_CLEAR("meta.clear", Type.USER),
USER_EDITOR("editor", Type.USER),
USER_SHOW_TRACKS("showtracks", Type.USER),
USER_PROMOTE("promote", Type.USER),
USER_DEMOTE("demote", Type.USER),
USER_CLEAR("clear", Type.USER),
USER_CLONE("clone", Type.USER),
GROUP_INFO("info", GROUP),
GROUP_PERM_INFO("permission.info", GROUP),
GROUP_PERM_SET("permission.set", GROUP),
GROUP_PERM_UNSET("permission.unset", GROUP),
GROUP_PERM_SET_TEMP("permission.settemp", GROUP),
GROUP_PERM_UNSET_TEMP("permission.unsettemp", GROUP),
GROUP_PERM_CHECK("permission.check", GROUP),
GROUP_PERM_CHECK_INHERITS("permission.checkinherits", GROUP),
GROUP_PERM_CLEAR("permission.clear", GROUP),
GROUP_PARENT_INFO("parent.info", GROUP),
GROUP_PARENT_SET("parent.set", GROUP),
GROUP_PARENT_SET_TRACK("parent.settrack", GROUP),
GROUP_PARENT_ADD("parent.add", GROUP),
GROUP_PARENT_REMOVE("parent.remove", GROUP),
GROUP_PARENT_ADD_TEMP("parent.addtemp", GROUP),
GROUP_PARENT_REMOVE_TEMP("parent.removetemp", GROUP),
GROUP_PARENT_CLEAR("parent.clear", GROUP),
GROUP_PARENT_CLEAR_TRACK("parent.cleartrack", GROUP),
GROUP_META_INFO("meta.info", GROUP),
GROUP_META_SET("meta.set", GROUP),
GROUP_META_UNSET("meta.unset", GROUP),
GROUP_META_SET_TEMP("meta.settemp", GROUP),
GROUP_META_UNSET_TEMP("meta.unsettemp", GROUP),
GROUP_META_ADD_PREFIX("meta.addprefix", GROUP),
GROUP_META_ADD_SUFFIX("meta.addsuffix", GROUP),
GROUP_META_SET_PREFIX("meta.setprefix", GROUP),
GROUP_META_SET_SUFFIX("meta.setsuffix", GROUP),
GROUP_META_REMOVE_PREFIX("meta.removeprefix", GROUP),
GROUP_META_REMOVE_SUFFIX("meta.removesuffix", GROUP),
GROUP_META_ADD_TEMP_PREFIX("meta.addtempprefix", GROUP),
GROUP_META_ADD_TEMP_SUFFIX("meta.addtempsuffix", GROUP),
GROUP_META_SET_TEMP_PREFIX("meta.settempprefix", GROUP),
GROUP_META_SET_TEMP_SUFFIX("meta.settempsuffix", GROUP),
GROUP_META_REMOVE_TEMP_PREFIX("meta.removetempprefix", GROUP),
GROUP_META_REMOVE_TEMP_SUFFIX("meta.removetempsuffix", GROUP),
GROUP_META_CLEAR("meta.clear", GROUP),
GROUP_EDITOR("editor", GROUP),
GROUP_LIST_MEMBERS("listmembers", GROUP),
GROUP_SHOW_TRACKS("showtracks", GROUP),
GROUP_SET_WEIGHT("setweight", GROUP),
GROUP_SET_DISPLAY_NAME("setdisplayname", GROUP),
GROUP_CLEAR("clear", GROUP),
GROUP_RENAME("rename", GROUP),
GROUP_CLONE("clone", GROUP),
GROUP_INFO("info", Type.GROUP),
GROUP_PERM_INFO("permission.info", Type.GROUP),
GROUP_PERM_SET("permission.set", Type.GROUP),
GROUP_PERM_UNSET("permission.unset", Type.GROUP),
GROUP_PERM_SET_TEMP("permission.settemp", Type.GROUP),
GROUP_PERM_UNSET_TEMP("permission.unsettemp", Type.GROUP),
GROUP_PERM_CHECK("permission.check", Type.GROUP),
GROUP_PERM_CHECK_INHERITS("permission.checkinherits", Type.GROUP),
GROUP_PERM_CLEAR("permission.clear", Type.GROUP),
GROUP_PARENT_INFO("parent.info", Type.GROUP),
GROUP_PARENT_SET("parent.set", Type.GROUP),
GROUP_PARENT_SET_TRACK("parent.settrack", Type.GROUP),
GROUP_PARENT_ADD("parent.add", Type.GROUP),
GROUP_PARENT_REMOVE("parent.remove", Type.GROUP),
GROUP_PARENT_ADD_TEMP("parent.addtemp", Type.GROUP),
GROUP_PARENT_REMOVE_TEMP("parent.removetemp", Type.GROUP),
GROUP_PARENT_CLEAR("parent.clear", Type.GROUP),
GROUP_PARENT_CLEAR_TRACK("parent.cleartrack", Type.GROUP),
GROUP_META_INFO("meta.info", Type.GROUP),
GROUP_META_SET("meta.set", Type.GROUP),
GROUP_META_UNSET("meta.unset", Type.GROUP),
GROUP_META_SET_TEMP("meta.settemp", Type.GROUP),
GROUP_META_UNSET_TEMP("meta.unsettemp", Type.GROUP),
GROUP_META_ADD_PREFIX("meta.addprefix", Type.GROUP),
GROUP_META_ADD_SUFFIX("meta.addsuffix", Type.GROUP),
GROUP_META_SET_PREFIX("meta.setprefix", Type.GROUP),
GROUP_META_SET_SUFFIX("meta.setsuffix", Type.GROUP),
GROUP_META_REMOVE_PREFIX("meta.removeprefix", Type.GROUP),
GROUP_META_REMOVE_SUFFIX("meta.removesuffix", Type.GROUP),
GROUP_META_ADD_TEMP_PREFIX("meta.addtempprefix", Type.GROUP),
GROUP_META_ADD_TEMP_SUFFIX("meta.addtempsuffix", Type.GROUP),
GROUP_META_SET_TEMP_PREFIX("meta.settempprefix", Type.GROUP),
GROUP_META_SET_TEMP_SUFFIX("meta.settempsuffix", Type.GROUP),
GROUP_META_REMOVE_TEMP_PREFIX("meta.removetempprefix", Type.GROUP),
GROUP_META_REMOVE_TEMP_SUFFIX("meta.removetempsuffix", Type.GROUP),
GROUP_META_CLEAR("meta.clear", Type.GROUP),
GROUP_EDITOR("editor", Type.GROUP),
GROUP_LIST_MEMBERS("listmembers", Type.GROUP),
GROUP_SHOW_TRACKS("showtracks", Type.GROUP),
GROUP_SET_WEIGHT("setweight", Type.GROUP),
GROUP_SET_DISPLAY_NAME("setdisplayname", Type.GROUP),
GROUP_CLEAR("clear", Type.GROUP),
GROUP_RENAME("rename", Type.GROUP),
GROUP_CLONE("clone", Type.GROUP),
TRACK_INFO("info", TRACK),
TRACK_APPEND("append", TRACK),
TRACK_INSERT("insert", TRACK),
TRACK_REMOVE("remove", TRACK),
TRACK_CLEAR("clear", TRACK),
TRACK_RENAME("rename", TRACK),
TRACK_CLONE("clone", TRACK),
TRACK_INFO("info", Type.TRACK),
TRACK_APPEND("append", Type.TRACK),
TRACK_INSERT("insert", Type.TRACK),
TRACK_REMOVE("remove", Type.TRACK),
TRACK_CLEAR("clear", Type.TRACK),
TRACK_RENAME("rename", Type.TRACK),
TRACK_CLONE("clone", Type.TRACK),
LOG_RECENT("recent", LOG),
LOG_USER_HISTORY("userhistory", LOG),
LOG_GROUP_HISTORY("grouphistory", LOG),
LOG_TRACK_HISTORY("trackhistory", LOG),
LOG_SEARCH("search", LOG),
LOG_NOTIFY("notify", LOG),
LOG_RECENT("recent", Type.LOG),
LOG_USER_HISTORY("userhistory", Type.LOG),
LOG_GROUP_HISTORY("grouphistory", Type.LOG),
LOG_TRACK_HISTORY("trackhistory", Type.LOG),
LOG_SEARCH("search", Type.LOG),
LOG_NOTIFY("notify", Type.LOG),
SPONGE_PERMISSION_INFO("permission.info", SPONGE),
SPONGE_PERMISSION_SET("permission.set", SPONGE),
SPONGE_PERMISSION_CLEAR("permission.clear", SPONGE),
SPONGE_PARENT_INFO("parent.info", SPONGE),
SPONGE_PARENT_ADD("parent.add", SPONGE),
SPONGE_PARENT_REMOVE("parent.remove", SPONGE),
SPONGE_PARENT_CLEAR("parent.clear", SPONGE),
SPONGE_OPTION_INFO("option.info", SPONGE),
SPONGE_OPTION_SET("option.set", SPONGE),
SPONGE_OPTION_UNSET("option.unset", SPONGE),
SPONGE_OPTION_CLEAR("option.clear", SPONGE);
SPONGE_PERMISSION_INFO("permission.info", Type.SPONGE),
SPONGE_PERMISSION_SET("permission.set", Type.SPONGE),
SPONGE_PERMISSION_CLEAR("permission.clear", Type.SPONGE),
SPONGE_PARENT_INFO("parent.info", Type.SPONGE),
SPONGE_PARENT_ADD("parent.add", Type.SPONGE),
SPONGE_PARENT_REMOVE("parent.remove", Type.SPONGE),
SPONGE_PARENT_CLEAR("parent.clear", Type.SPONGE),
SPONGE_OPTION_INFO("option.info", Type.SPONGE),
SPONGE_OPTION_SET("option.set", Type.SPONGE),
SPONGE_OPTION_UNSET("option.unset", Type.SPONGE),
SPONGE_OPTION_CLEAR("option.clear", Type.SPONGE);
public static final String ROOT = "luckperms.";
@ -187,7 +180,7 @@ public enum CommandPermission {
CommandPermission(String node, Type type) {
this.type = type;
if (type == NONE) {
if (type == Type.NONE) {
this.node = ROOT + node;
} else {
this.node = ROOT + type.getTag() + "." + node;

View File

@ -25,6 +25,7 @@
package me.lucko.luckperms.common.node.model;
import com.google.common.base.Preconditions;
import com.google.common.collect.ImmutableList;
import me.lucko.luckperms.api.Contexts;
@ -50,8 +51,6 @@ import java.util.Map;
import java.util.Objects;
import java.util.Optional;
import static com.google.common.base.Preconditions.checkState;
/**
* An immutable implementation of {@link Node}.
*/
@ -219,19 +218,19 @@ public final class ImmutableNode implements Node {
@Override
public long getExpiryUnixTime() {
checkState(isTemporary(), "Node does not have an expiry time.");
Preconditions.checkState(isTemporary(), "Node does not have an expiry time.");
return this.expireAt;
}
@Override
public @NonNull Date getExpiry() {
checkState(isTemporary(), "Node does not have an expiry time.");
Preconditions.checkState(isTemporary(), "Node does not have an expiry time.");
return new Date(this.expireAt * 1000L);
}
@Override
public long getSecondsTilExpiry() {
checkState(isTemporary(), "Node does not have an expiry time.");
Preconditions.checkState(isTemporary(), "Node does not have an expiry time.");
return this.expireAt - System.currentTimeMillis() / 1000L;
}
@ -247,7 +246,7 @@ public final class ImmutableNode implements Node {
@Override
public int getWildcardLevel() {
checkState(isWildcard(), "Node is not a wildcard");
Preconditions.checkState(isWildcard(), "Node is not a wildcard");
return this.wildcardLevel;
}