Code style: move private constructors for singleton classes to the top of the file
This commit is contained in:
parent
3726f6de41
commit
0a50df6557
@ -42,6 +42,7 @@ import java.util.List;
|
|||||||
* checks made by plugins.
|
* checks made by plugins.
|
||||||
*/
|
*/
|
||||||
public final class PermissibleInjector {
|
public final class PermissibleInjector {
|
||||||
|
private PermissibleInjector() {}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* All permission checks made on standard Bukkit objects are effectively proxied to a
|
* All permission checks made on standard Bukkit objects are effectively proxied to a
|
||||||
@ -151,6 +152,4 @@ public final class PermissibleInjector {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private PermissibleInjector() {}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -33,6 +33,7 @@ import org.bukkit.Bukkit;
|
|||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
|
||||||
public final class BukkitUuids {
|
public final class BukkitUuids {
|
||||||
|
private BukkitUuids() {}
|
||||||
|
|
||||||
public static UUID lookupUuid(ProgressLogger log, String s) {
|
public static UUID lookupUuid(ProgressLogger log, String s) {
|
||||||
UUID uuid = Uuids.parse(s);
|
UUID uuid = Uuids.parse(s);
|
||||||
@ -50,6 +51,4 @@ public final class BukkitUuids {
|
|||||||
return uuid;
|
return uuid;
|
||||||
}
|
}
|
||||||
|
|
||||||
private BukkitUuids() {}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -31,6 +31,7 @@ import java.util.Optional;
|
|||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
|
||||||
public final class RedisBungeeUtil {
|
public final class RedisBungeeUtil {
|
||||||
|
private RedisBungeeUtil() {}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Looks up a UUID from username via RedisBungee's uuid cache.
|
* Looks up a UUID from username via RedisBungee's uuid cache.
|
||||||
@ -46,6 +47,4 @@ public final class RedisBungeeUtil {
|
|||||||
return Optional.ofNullable(RedisBungee.getApi()).map(a -> a.getNameFromUuid(uuid, true));
|
return Optional.ofNullable(RedisBungee.getApi()).map(a -> a.getNameFromUuid(uuid, true));
|
||||||
}
|
}
|
||||||
|
|
||||||
private RedisBungeeUtil() {}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -35,6 +35,7 @@ import me.lucko.luckperms.api.LogEntry;
|
|||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
|
||||||
public final class LogEntryJsonSerializer {
|
public final class LogEntryJsonSerializer {
|
||||||
|
private LogEntryJsonSerializer() {}
|
||||||
|
|
||||||
public static JsonObject serialize(LogEntry logEntry) {
|
public static JsonObject serialize(LogEntry logEntry) {
|
||||||
JsonObject data = new JsonObject();
|
JsonObject data = new JsonObject();
|
||||||
@ -68,5 +69,4 @@ public final class LogEntryJsonSerializer {
|
|||||||
return builder.build();
|
return builder.build();
|
||||||
}
|
}
|
||||||
|
|
||||||
private LogEntryJsonSerializer() {}
|
|
||||||
}
|
}
|
||||||
|
@ -34,6 +34,7 @@ import me.lucko.luckperms.common.storage.misc.DataConstraints;
|
|||||||
import java.util.function.Predicate;
|
import java.util.function.Predicate;
|
||||||
|
|
||||||
public final class ApiUtils {
|
public final class ApiUtils {
|
||||||
|
private ApiUtils() {}
|
||||||
|
|
||||||
public static String checkUsername(String s, LuckPermsPlugin plugin) {
|
public static String checkUsername(String s, LuckPermsPlugin plugin) {
|
||||||
if (s == null) {
|
if (s == null) {
|
||||||
@ -57,6 +58,4 @@ public final class ApiUtils {
|
|||||||
return s.toLowerCase();
|
return s.toLowerCase();
|
||||||
}
|
}
|
||||||
|
|
||||||
private ApiUtils() {}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -47,6 +47,8 @@ import java.util.function.Function;
|
|||||||
* Implements argument based permission checks for use in command implementations.
|
* Implements argument based permission checks for use in command implementations.
|
||||||
*/
|
*/
|
||||||
public final class ArgumentPermissions {
|
public final class ArgumentPermissions {
|
||||||
|
private ArgumentPermissions() {}
|
||||||
|
|
||||||
private static final String USER_MODIFY_SELF = CommandPermission.ROOT + "modify.user.self";
|
private static final String USER_MODIFY_SELF = CommandPermission.ROOT + "modify.user.self";
|
||||||
private static final String USER_MODIFY_OTHERS = CommandPermission.ROOT + "modify.user.others";
|
private static final String USER_MODIFY_OTHERS = CommandPermission.ROOT + "modify.user.others";
|
||||||
private static final Function<String, String> GROUP_MODIFY = s -> CommandPermission.ROOT + "modify.group." + s;
|
private static final Function<String, String> GROUP_MODIFY = s -> CommandPermission.ROOT + "modify.group." + s;
|
||||||
@ -301,7 +303,5 @@ public final class ArgumentPermissions {
|
|||||||
PermissionCache permissionData = user.getCachedData().getPermissionData(Contexts.global().setContexts(contextSet));
|
PermissionCache permissionData = user.getCachedData().getPermissionData(Contexts.global().setContexts(contextSet));
|
||||||
return !permissionData.getPermissionValue(NodeFactory.groupNode(targetGroupName), PermissionCheckEvent.Origin.INTERNAL).result().asBoolean();
|
return !permissionData.getPermissionValue(NodeFactory.groupNode(targetGroupName), PermissionCheckEvent.Origin.INTERNAL).result().asBoolean();
|
||||||
}
|
}
|
||||||
|
|
||||||
private ArgumentPermissions() {}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -38,6 +38,7 @@ import java.util.List;
|
|||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
public final class MessageUtils {
|
public final class MessageUtils {
|
||||||
|
private MessageUtils() {}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sends a message to the sender, formatted with the plugin prefix and color scheme
|
* Sends a message to the sender, formatted with the plugin prefix and color scheme
|
||||||
@ -177,6 +178,4 @@ public final class MessageUtils {
|
|||||||
return sb.delete(sb.length() - Message.CONTEXT_PAIR_SEP.asString(localeManager).length(), sb.length()).toString();
|
return sb.delete(sb.length() - Message.CONTEXT_PAIR_SEP.asString(localeManager).length(), sb.length()).toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
private MessageUtils() {}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -41,6 +41,7 @@ import java.util.Optional;
|
|||||||
* Utility methods for saving users, groups and tracks.
|
* Utility methods for saving users, groups and tracks.
|
||||||
*/
|
*/
|
||||||
public final class StorageAssistant {
|
public final class StorageAssistant {
|
||||||
|
private StorageAssistant() {}
|
||||||
|
|
||||||
public static Group loadGroup(String target, Sender sender, LuckPermsPlugin plugin, boolean auditTemporary) {
|
public static Group loadGroup(String target, Sender sender, LuckPermsPlugin plugin, boolean auditTemporary) {
|
||||||
// special handling for the importer
|
// special handling for the importer
|
||||||
@ -176,5 +177,4 @@ public final class StorageAssistant {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private StorageAssistant() {}
|
|
||||||
}
|
}
|
||||||
|
@ -31,6 +31,7 @@ import me.lucko.luckperms.common.model.Group;
|
|||||||
import me.lucko.luckperms.common.node.factory.NodeFactory;
|
import me.lucko.luckperms.common.node.factory.NodeFactory;
|
||||||
|
|
||||||
public final class MigrationUtils {
|
public final class MigrationUtils {
|
||||||
|
private MigrationUtils() {}
|
||||||
|
|
||||||
public static Node.Builder parseNode(String permission, boolean value) {
|
public static Node.Builder parseNode(String permission, boolean value) {
|
||||||
if (permission.startsWith("-") || permission.startsWith("!")) {
|
if (permission.startsWith("-") || permission.startsWith("!")) {
|
||||||
@ -61,6 +62,4 @@ public final class MigrationUtils {
|
|||||||
return string.trim().replace(':', '-').replace(' ', '-').replace('.', '-').toLowerCase();
|
return string.trim().replace(':', '-').replace(' ', '-').replace('.', '-').toLowerCase();
|
||||||
}
|
}
|
||||||
|
|
||||||
private MigrationUtils() {}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -70,6 +70,7 @@ import static me.lucko.luckperms.common.config.ConfigKeyTypes.stringKey;
|
|||||||
* to function a bit like an enum, but with generics.</p>
|
* to function a bit like an enum, but with generics.</p>
|
||||||
*/
|
*/
|
||||||
public final class ConfigKeys {
|
public final class ConfigKeys {
|
||||||
|
private ConfigKeys() {}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The name of the server
|
* The name of the server
|
||||||
@ -593,6 +594,4 @@ public final class ConfigKeys {
|
|||||||
return SIZE;
|
return SIZE;
|
||||||
}
|
}
|
||||||
|
|
||||||
private ConfigKeys() {}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -39,6 +39,7 @@ import java.util.List;
|
|||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
public final class ContextSetConfigurateSerializer {
|
public final class ContextSetConfigurateSerializer {
|
||||||
|
private ContextSetConfigurateSerializer() {}
|
||||||
|
|
||||||
public static ConfigurationNode serializeContextSet(ContextSet contextSet) {
|
public static ConfigurationNode serializeContextSet(ContextSet contextSet) {
|
||||||
ConfigurationNode data = SimpleConfigurationNode.root();
|
ConfigurationNode data = SimpleConfigurationNode.root();
|
||||||
@ -84,6 +85,4 @@ public final class ContextSetConfigurateSerializer {
|
|||||||
return map;
|
return map;
|
||||||
}
|
}
|
||||||
|
|
||||||
private ContextSetConfigurateSerializer() {}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -42,6 +42,7 @@ import java.util.Map;
|
|||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
|
|
||||||
public final class ContextSetJsonSerializer {
|
public final class ContextSetJsonSerializer {
|
||||||
|
private ContextSetJsonSerializer() {}
|
||||||
|
|
||||||
public static JsonObject serializeContextSet(ContextSet contextSet) {
|
public static JsonObject serializeContextSet(ContextSet contextSet) {
|
||||||
JsonObject data = new JsonObject();
|
JsonObject data = new JsonObject();
|
||||||
@ -104,6 +105,4 @@ public final class ContextSetJsonSerializer {
|
|||||||
return map;
|
return map;
|
||||||
}
|
}
|
||||||
|
|
||||||
private ContextSetJsonSerializer() {}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -57,6 +57,7 @@ import java.util.Set;
|
|||||||
* @author Jens Nyman
|
* @author Jens Nyman
|
||||||
*/
|
*/
|
||||||
public final class GraphTraversers {
|
public final class GraphTraversers {
|
||||||
|
private GraphTraversers() {}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns an unmodifiable {@code Iterable} over the nodes reachable from
|
* Returns an unmodifiable {@code Iterable} over the nodes reachable from
|
||||||
@ -210,6 +211,4 @@ public final class GraphTraversers {
|
|||||||
POST_ORDER
|
POST_ORDER
|
||||||
}
|
}
|
||||||
|
|
||||||
private GraphTraversers() {}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -44,6 +44,7 @@ import java.util.Objects;
|
|||||||
* Contains the standard {@link MetaStackElement}s provided by LuckPerms.
|
* Contains the standard {@link MetaStackElement}s provided by LuckPerms.
|
||||||
*/
|
*/
|
||||||
public final class StandardStackElements {
|
public final class StandardStackElements {
|
||||||
|
private StandardStackElements() {}
|
||||||
|
|
||||||
public static MetaStackElement parseFromString(LuckPermsPlugin plugin, String s) {
|
public static MetaStackElement parseFromString(LuckPermsPlugin plugin, String s) {
|
||||||
s = s.toLowerCase();
|
s = s.toLowerCase();
|
||||||
@ -317,6 +318,4 @@ public final class StandardStackElements {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private StandardStackElements() {}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -36,6 +36,7 @@ import java.util.Optional;
|
|||||||
* Utility class for creating instances of {@link DemotionResult}.
|
* Utility class for creating instances of {@link DemotionResult}.
|
||||||
*/
|
*/
|
||||||
public final class DemotionResults {
|
public final class DemotionResults {
|
||||||
|
private DemotionResults() {}
|
||||||
|
|
||||||
public static DemotionResult success(String groupFrom, String groupTo) {
|
public static DemotionResult success(String groupFrom, String groupTo) {
|
||||||
return new Impl(DemotionResult.Status.SUCCESS, groupFrom, groupTo);
|
return new Impl(DemotionResult.Status.SUCCESS, groupFrom, groupTo);
|
||||||
@ -115,7 +116,4 @@ public final class DemotionResults {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private DemotionResults() {}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -36,6 +36,7 @@ import java.util.Optional;
|
|||||||
* Utility class for creating instances of {@link PromotionResult}.
|
* Utility class for creating instances of {@link PromotionResult}.
|
||||||
*/
|
*/
|
||||||
public final class PromotionResults {
|
public final class PromotionResults {
|
||||||
|
private PromotionResults() {}
|
||||||
|
|
||||||
public static PromotionResult success(String groupFrom, String groupTo) {
|
public static PromotionResult success(String groupFrom, String groupTo) {
|
||||||
return new Impl(PromotionResult.Status.SUCCESS, groupFrom, groupTo);
|
return new Impl(PromotionResult.Status.SUCCESS, groupFrom, groupTo);
|
||||||
@ -115,7 +116,4 @@ public final class PromotionResults {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private PromotionResults() {}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -34,6 +34,7 @@ import java.util.Comparator;
|
|||||||
* Compares permission nodes based upon their supposed "priority".
|
* Compares permission nodes based upon their supposed "priority".
|
||||||
*/
|
*/
|
||||||
public class NodeWithContextComparator implements Comparator<Node> {
|
public class NodeWithContextComparator implements Comparator<Node> {
|
||||||
|
private NodeWithContextComparator() {}
|
||||||
|
|
||||||
private static final Comparator<? super Node> INSTANCE = new NodeWithContextComparator();
|
private static final Comparator<? super Node> INSTANCE = new NodeWithContextComparator();
|
||||||
private static final Comparator<? super Node> REVERSE = INSTANCE.reversed();
|
private static final Comparator<? super Node> REVERSE = INSTANCE.reversed();
|
||||||
@ -46,8 +47,6 @@ public class NodeWithContextComparator implements Comparator<Node> {
|
|||||||
return REVERSE;
|
return REVERSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
private NodeWithContextComparator() {}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int compare(Node o1, Node o2) {
|
public int compare(Node o1, Node o2) {
|
||||||
if (o1.equals(o2)) {
|
if (o1.equals(o2)) {
|
||||||
|
@ -36,6 +36,7 @@ import java.util.Map;
|
|||||||
import java.util.regex.Pattern;
|
import java.util.regex.Pattern;
|
||||||
|
|
||||||
public final class LegacyNodeFactory {
|
public final class LegacyNodeFactory {
|
||||||
|
private LegacyNodeFactory() {}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The characters which are delimited when serializing a context set
|
* The characters which are delimited when serializing a context set
|
||||||
@ -201,6 +202,4 @@ public final class LegacyNodeFactory {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private LegacyNodeFactory() {}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -38,6 +38,8 @@ import java.util.Map;
|
|||||||
* Utility class to make Node(Builder) instances from strings or existing Nodes
|
* Utility class to make Node(Builder) instances from strings or existing Nodes
|
||||||
*/
|
*/
|
||||||
public final class NodeFactory {
|
public final class NodeFactory {
|
||||||
|
private NodeFactory() {}
|
||||||
|
|
||||||
public static final String DEFAULT_GROUP_NAME = "default";
|
public static final String DEFAULT_GROUP_NAME = "default";
|
||||||
|
|
||||||
public static Node.Builder builder(String s) {
|
public static Node.Builder builder(String s) {
|
||||||
@ -344,6 +346,4 @@ public final class NodeFactory {
|
|||||||
return sb;
|
return sb;
|
||||||
}
|
}
|
||||||
|
|
||||||
private NodeFactory() {}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -52,6 +52,7 @@ import java.util.Optional;
|
|||||||
import java.util.regex.Pattern;
|
import java.util.regex.Pattern;
|
||||||
|
|
||||||
public final class NodeTypes {
|
public final class NodeTypes {
|
||||||
|
private NodeTypes() {}
|
||||||
|
|
||||||
public static final String PREFIX_KEY = "prefix";
|
public static final String PREFIX_KEY = "prefix";
|
||||||
public static final String SUFFIX_KEY = "suffix";
|
public static final String SUFFIX_KEY = "suffix";
|
||||||
@ -509,6 +510,4 @@ public final class NodeTypes {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private NodeTypes() {}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -37,6 +37,7 @@ import java.util.Set;
|
|||||||
import java.util.function.Predicate;
|
import java.util.function.Predicate;
|
||||||
|
|
||||||
public final class NodeTools {
|
public final class NodeTools {
|
||||||
|
private NodeTools() {}
|
||||||
|
|
||||||
public static <T extends Node> void removeEqual(Iterator<T> it, NodeEqualityPredicate equalityPredicate) {
|
public static <T extends Node> void removeEqual(Iterator<T> it, NodeEqualityPredicate equalityPredicate) {
|
||||||
List<T> alreadyIn = new ArrayList<>();
|
List<T> alreadyIn = new ArrayList<>();
|
||||||
@ -78,5 +79,4 @@ public final class NodeTools {
|
|||||||
return localizedNode -> delegate.test(localizedNode.getNode());
|
return localizedNode -> delegate.test(localizedNode.getNode());
|
||||||
}
|
}
|
||||||
|
|
||||||
private NodeTools() {}
|
|
||||||
}
|
}
|
||||||
|
@ -38,6 +38,8 @@ import java.util.stream.Collectors;
|
|||||||
import java.util.stream.IntStream;
|
import java.util.stream.IntStream;
|
||||||
|
|
||||||
public final class ShorthandParser {
|
public final class ShorthandParser {
|
||||||
|
private ShorthandParser() {}
|
||||||
|
|
||||||
private static final List<Function<String, Iterable<String>>> PARSERS = ImmutableList.<Function<String, Iterable<String>>>builder()
|
private static final List<Function<String, Iterable<String>>> PARSERS = ImmutableList.<Function<String, Iterable<String>>>builder()
|
||||||
.add(new ListParser())
|
.add(new ListParser())
|
||||||
.add(new CharacterRangeParser())
|
.add(new CharacterRangeParser())
|
||||||
@ -169,6 +171,4 @@ public final class ShorthandParser {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private ShorthandParser() {}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -29,6 +29,8 @@ package me.lucko.luckperms.common.storage.implementation.custom;
|
|||||||
* Hook to allow external code to provide a storage dao
|
* Hook to allow external code to provide a storage dao
|
||||||
*/
|
*/
|
||||||
public final class CustomStorageProviders {
|
public final class CustomStorageProviders {
|
||||||
|
private CustomStorageProviders() {}
|
||||||
|
|
||||||
private static CustomStorageProvider provider = null;
|
private static CustomStorageProvider provider = null;
|
||||||
|
|
||||||
public static void register(CustomStorageProvider provider) {
|
public static void register(CustomStorageProvider provider) {
|
||||||
@ -43,6 +45,4 @@ public final class CustomStorageProviders {
|
|||||||
return provider;
|
return provider;
|
||||||
}
|
}
|
||||||
|
|
||||||
private CustomStorageProviders() {}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -29,6 +29,7 @@ import java.util.function.Predicate;
|
|||||||
import java.util.regex.Pattern;
|
import java.util.regex.Pattern;
|
||||||
|
|
||||||
public final class DataConstraints {
|
public final class DataConstraints {
|
||||||
|
private DataConstraints() {}
|
||||||
|
|
||||||
public static final int MAX_PERMISSION_LENGTH = 200;
|
public static final int MAX_PERMISSION_LENGTH = 200;
|
||||||
|
|
||||||
@ -59,6 +60,4 @@ public final class DataConstraints {
|
|||||||
|
|
||||||
public static final Predicate<String> WORLD_NAME_TEST = s -> !s.isEmpty() && s.length() <= MAX_WORLD_LENGTH;
|
public static final Predicate<String> WORLD_NAME_TEST = s -> !s.isEmpty() && s.length() <= MAX_WORLD_LENGTH;
|
||||||
|
|
||||||
private DataConstraints() {}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -39,6 +39,8 @@ import java.util.stream.Stream;
|
|||||||
* see: https://github.com/drtshock/Essentials/blob/2.x/Essentials/src/com/earth2me/essentials/utils/DateUtil.java
|
* see: https://github.com/drtshock/Essentials/blob/2.x/Essentials/src/com/earth2me/essentials/utils/DateUtil.java
|
||||||
*/
|
*/
|
||||||
public final class DateParser {
|
public final class DateParser {
|
||||||
|
private DateParser() {}
|
||||||
|
|
||||||
private static final Pattern TIME_PATTERN = Pattern.compile(Stream.of("y", "mo", "w", "d", "h", "m").map(i -> "(?:([0-9]+)\\s*" + i + "[a-z]*[,\\s]*)?").collect(Collectors.joining()) + "(?:([0-9]+)\\s*(?:s[a-z]*)?)?", Pattern.CASE_INSENSITIVE);
|
private static final Pattern TIME_PATTERN = Pattern.compile(Stream.of("y", "mo", "w", "d", "h", "m").map(i -> "(?:([0-9]+)\\s*" + i + "[a-z]*[,\\s]*)?").collect(Collectors.joining()) + "(?:([0-9]+)\\s*(?:s[a-z]*)?)?", Pattern.CASE_INSENSITIVE);
|
||||||
private static final int MAX_YEARS = 100000;
|
private static final int MAX_YEARS = 100000;
|
||||||
|
|
||||||
@ -130,6 +132,4 @@ public final class DateParser {
|
|||||||
return (c.getTimeInMillis() / 1000) + 1;
|
return (c.getTimeInMillis() / 1000) + 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
private DateParser() {}
|
|
||||||
|
|
||||||
}
|
}
|
@ -26,7 +26,6 @@
|
|||||||
package me.lucko.luckperms.common.util;
|
package me.lucko.luckperms.common.util;
|
||||||
|
|
||||||
import com.github.benmanes.caffeine.cache.Cache;
|
import com.github.benmanes.caffeine.cache.Cache;
|
||||||
import com.github.benmanes.caffeine.cache.Caffeine;
|
|
||||||
import com.google.common.collect.ForwardingSet;
|
import com.google.common.collect.ForwardingSet;
|
||||||
|
|
||||||
import org.checkerframework.checker.nullness.qual.NonNull;
|
import org.checkerframework.checker.nullness.qual.NonNull;
|
||||||
@ -45,7 +44,7 @@ public class ExpiringSet<E> extends ForwardingSet<E> {
|
|||||||
private final Set<E> setView;
|
private final Set<E> setView;
|
||||||
|
|
||||||
public ExpiringSet(long duration, TimeUnit unit) {
|
public ExpiringSet(long duration, TimeUnit unit) {
|
||||||
this.cache = Caffeine.newBuilder().expireAfterAccess(duration, unit).build();
|
this.cache = CaffeineFactory.newBuilder().expireAfterAccess(duration, unit).build();
|
||||||
this.setView = this.cache.asMap().keySet();
|
this.setView = this.cache.asMap().keySet();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -37,6 +37,7 @@ import java.util.function.Function;
|
|||||||
import java.util.stream.Collector;
|
import java.util.stream.Collector;
|
||||||
|
|
||||||
public final class ImmutableCollectors {
|
public final class ImmutableCollectors {
|
||||||
|
private ImmutableCollectors() {}
|
||||||
|
|
||||||
private static final Collector<Object, ImmutableList.Builder<Object>, ImmutableList<Object>> LIST = Collector.of(
|
private static final Collector<Object, ImmutableList.Builder<Object>, ImmutableList<Object>> LIST = Collector.of(
|
||||||
ImmutableList.Builder::new,
|
ImmutableList.Builder::new,
|
||||||
@ -98,6 +99,4 @@ public final class ImmutableCollectors {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
private ImmutableCollectors() {}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -32,6 +32,7 @@ import java.util.function.Consumer;
|
|||||||
import java.util.function.Function;
|
import java.util.function.Function;
|
||||||
|
|
||||||
public final class Iterators {
|
public final class Iterators {
|
||||||
|
private Iterators() {}
|
||||||
|
|
||||||
public static <I> void iterate(Iterable<I> iterable, Consumer<I> action) {
|
public static <I> void iterate(Iterable<I> iterable, Consumer<I> action) {
|
||||||
for (I i : iterable) {
|
for (I i : iterable) {
|
||||||
@ -86,6 +87,4 @@ public final class Iterators {
|
|||||||
return lists;
|
return lists;
|
||||||
}
|
}
|
||||||
|
|
||||||
private Iterators() {}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -30,6 +30,7 @@ import java.nio.file.Files;
|
|||||||
import java.nio.file.Path;
|
import java.nio.file.Path;
|
||||||
|
|
||||||
public final class MoreFiles {
|
public final class MoreFiles {
|
||||||
|
private MoreFiles() {}
|
||||||
|
|
||||||
public static Path createFileIfNotExists(Path path) throws IOException {
|
public static Path createFileIfNotExists(Path path) throws IOException {
|
||||||
if (!Files.exists(path)) {
|
if (!Files.exists(path)) {
|
||||||
@ -56,5 +57,4 @@ public final class MoreFiles {
|
|||||||
return path;
|
return path;
|
||||||
}
|
}
|
||||||
|
|
||||||
private MoreFiles() {}
|
|
||||||
}
|
}
|
||||||
|
@ -33,6 +33,7 @@ import java.util.regex.Pattern;
|
|||||||
import java.util.regex.PatternSyntaxException;
|
import java.util.regex.PatternSyntaxException;
|
||||||
|
|
||||||
public final class PatternCache {
|
public final class PatternCache {
|
||||||
|
private PatternCache() {}
|
||||||
|
|
||||||
private static final Map<String, CachedPattern> CACHE = LoadingMap.of(s -> {
|
private static final Map<String, CachedPattern> CACHE = LoadingMap.of(s -> {
|
||||||
try {
|
try {
|
||||||
@ -92,6 +93,4 @@ public final class PatternCache {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private PatternCache() {}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -33,6 +33,8 @@ import java.util.function.Predicate;
|
|||||||
* A collection of predicate utilities used mostly in command classes
|
* A collection of predicate utilities used mostly in command classes
|
||||||
*/
|
*/
|
||||||
public final class Predicates {
|
public final class Predicates {
|
||||||
|
private Predicates() {}
|
||||||
|
|
||||||
private static final Predicate FALSE = new Predicate() {
|
private static final Predicate FALSE = new Predicate() {
|
||||||
@Override public boolean test(Object o) { return false; }
|
@Override public boolean test(Object o) { return false; }
|
||||||
@Override public Predicate and(Predicate other) { return this; }
|
@Override public Predicate and(Predicate other) { return this; }
|
||||||
@ -74,5 +76,4 @@ public final class Predicates {
|
|||||||
return t::equals;
|
return t::equals;
|
||||||
}
|
}
|
||||||
|
|
||||||
private Predicates() {}
|
|
||||||
}
|
}
|
||||||
|
@ -30,7 +30,6 @@ import java.lang.reflect.Constructor;
|
|||||||
import java.lang.reflect.InvocationTargetException;
|
import java.lang.reflect.InvocationTargetException;
|
||||||
|
|
||||||
public final class PrivateMethodHandles {
|
public final class PrivateMethodHandles {
|
||||||
|
|
||||||
private PrivateMethodHandles() {}
|
private PrivateMethodHandles() {}
|
||||||
|
|
||||||
private static final Constructor<MethodHandles.Lookup> LOOKUP_CONSTRUCTOR;
|
private static final Constructor<MethodHandles.Lookup> LOOKUP_CONSTRUCTOR;
|
||||||
|
@ -32,6 +32,8 @@ import javax.script.ScriptEngineManager;
|
|||||||
* Provides a nashorn script engine (lazily)
|
* Provides a nashorn script engine (lazily)
|
||||||
*/
|
*/
|
||||||
public final class Scripting {
|
public final class Scripting {
|
||||||
|
private Scripting() {}
|
||||||
|
|
||||||
private static ScriptEngine engine = null;
|
private static ScriptEngine engine = null;
|
||||||
|
|
||||||
// Lazily load
|
// Lazily load
|
||||||
@ -42,6 +44,4 @@ public final class Scripting {
|
|||||||
return engine;
|
return engine;
|
||||||
}
|
}
|
||||||
|
|
||||||
private Scripting() {}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -35,6 +35,7 @@ import java.util.stream.Stream;
|
|||||||
|
|
||||||
@SuppressWarnings("deprecation")
|
@SuppressWarnings("deprecation")
|
||||||
public final class TextUtils {
|
public final class TextUtils {
|
||||||
|
private TextUtils() {}
|
||||||
|
|
||||||
public static String joinNewline(String... strings) {
|
public static String joinNewline(String... strings) {
|
||||||
return joinNewline(Arrays.stream(strings));
|
return joinNewline(Arrays.stream(strings));
|
||||||
@ -68,6 +69,4 @@ public final class TextUtils {
|
|||||||
return input;
|
return input;
|
||||||
}
|
}
|
||||||
|
|
||||||
private TextUtils() {}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -34,6 +34,8 @@ import java.util.function.Predicate;
|
|||||||
* Utilities for working with {@link UUID}s.
|
* Utilities for working with {@link UUID}s.
|
||||||
*/
|
*/
|
||||||
public final class Uuids {
|
public final class Uuids {
|
||||||
|
private Uuids() {}
|
||||||
|
|
||||||
public static final Predicate<String> PREDICATE = s -> parse(s) != null;
|
public static final Predicate<String> PREDICATE = s -> parse(s) != null;
|
||||||
|
|
||||||
public static @Nullable UUID fromString(String s) {
|
public static @Nullable UUID fromString(String s) {
|
||||||
@ -59,6 +61,4 @@ public final class Uuids {
|
|||||||
return uuid;
|
return uuid;
|
||||||
}
|
}
|
||||||
|
|
||||||
private Uuids() {}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -37,7 +37,6 @@ import java.io.IOException;
|
|||||||
* Utilities for the OkHttp client
|
* Utilities for the OkHttp client
|
||||||
*/
|
*/
|
||||||
public final class HttpClient {
|
public final class HttpClient {
|
||||||
|
|
||||||
private HttpClient() {}
|
private HttpClient() {}
|
||||||
|
|
||||||
private static final OkHttpClient CLIENT = new OkHttpClient.Builder()
|
private static final OkHttpClient CLIENT = new OkHttpClient.Builder()
|
||||||
|
@ -63,6 +63,8 @@ import java.util.stream.Stream;
|
|||||||
* Utility methods for interacting with the LuckPerms web permission editor.
|
* Utility methods for interacting with the LuckPerms web permission editor.
|
||||||
*/
|
*/
|
||||||
public final class WebEditor {
|
public final class WebEditor {
|
||||||
|
private WebEditor() {}
|
||||||
|
|
||||||
private static final String USER_ID_PATTERN = "user/";
|
private static final String USER_ID_PATTERN = "user/";
|
||||||
private static final String GROUP_ID_PATTERN = "group/";
|
private static final String GROUP_ID_PATTERN = "group/";
|
||||||
|
|
||||||
@ -235,6 +237,4 @@ public final class WebEditor {
|
|||||||
return nodes;
|
return nodes;
|
||||||
}
|
}
|
||||||
|
|
||||||
private WebEditor() {}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -41,6 +41,7 @@ import java.util.Set;
|
|||||||
* checks made by plugins.
|
* checks made by plugins.
|
||||||
*/
|
*/
|
||||||
public final class PermissibleInjector {
|
public final class PermissibleInjector {
|
||||||
|
private PermissibleInjector() {}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* All permission checks made on standard Nukkit objects are effectively proxied to a
|
* All permission checks made on standard Nukkit objects are effectively proxied to a
|
||||||
@ -141,6 +142,4 @@ public final class PermissibleInjector {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private PermissibleInjector() {}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -42,6 +42,8 @@ import java.util.Set;
|
|||||||
* Utility class for converting between Sponge and LuckPerms context and tristate classes
|
* Utility class for converting between Sponge and LuckPerms context and tristate classes
|
||||||
*/
|
*/
|
||||||
public final class CompatibilityUtil {
|
public final class CompatibilityUtil {
|
||||||
|
private CompatibilityUtil() {}
|
||||||
|
|
||||||
private static final Set<Context> EMPTY = ImmutableSet.of();
|
private static final Set<Context> EMPTY = ImmutableSet.of();
|
||||||
|
|
||||||
public static ImmutableContextSet convertContexts(Set<Context> contexts) {
|
public static ImmutableContextSet convertContexts(Set<Context> contexts) {
|
||||||
@ -92,6 +94,4 @@ public final class CompatibilityUtil {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private CompatibilityUtil() {}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -36,6 +36,7 @@ import java.util.List;
|
|||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
public final class SpongeCommandUtils {
|
public final class SpongeCommandUtils {
|
||||||
|
private SpongeCommandUtils() {}
|
||||||
|
|
||||||
public static Tristate parseTristate(int index, List<String> args) throws ArgumentParser.ArgumentException {
|
public static Tristate parseTristate(int index, List<String> args) throws ArgumentParser.ArgumentException {
|
||||||
String s = args.get(index).toLowerCase();
|
String s = args.get(index).toLowerCase();
|
||||||
@ -90,6 +91,4 @@ public final class SpongeCommandUtils {
|
|||||||
return MessageUtils.contextSetToString(localeManager, set);
|
return MessageUtils.contextSetToString(localeManager, set);
|
||||||
}
|
}
|
||||||
|
|
||||||
private SpongeCommandUtils() {}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -42,6 +42,8 @@ import org.spongepowered.api.service.permission.SubjectData;
|
|||||||
* Provides proxy instances which implement the SpongeAPI using the LuckPerms model.
|
* Provides proxy instances which implement the SpongeAPI using the LuckPerms model.
|
||||||
*/
|
*/
|
||||||
public final class ProxyFactory {
|
public final class ProxyFactory {
|
||||||
|
private ProxyFactory() {}
|
||||||
|
|
||||||
private static final boolean IS_API_7 = isApi7();
|
private static final boolean IS_API_7 = isApi7();
|
||||||
private static boolean isApi7() {
|
private static boolean isApi7() {
|
||||||
try {
|
try {
|
||||||
@ -89,6 +91,4 @@ public final class ProxyFactory {
|
|||||||
me.lucko.luckperms.sponge.service.proxy.api6.DescriptionBuilder.registerDescription(service, description);
|
me.lucko.luckperms.sponge.service.proxy.api6.DescriptionBuilder.registerDescription(service, description);
|
||||||
}
|
}
|
||||||
|
|
||||||
private ProxyFactory() {}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -31,8 +31,9 @@ import me.lucko.luckperms.sponge.service.model.calculated.CalculatedSubject;
|
|||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
public final class SubjectInheritanceGraphs {
|
public final class SubjectInheritanceGraphs {
|
||||||
private static final SubjectInheritanceGraph NON_CONTEXTUAL = new NonContextual();
|
private SubjectInheritanceGraphs() {}
|
||||||
|
|
||||||
|
private static final SubjectInheritanceGraph NON_CONTEXTUAL = new NonContextual();
|
||||||
|
|
||||||
public static SubjectInheritanceGraph getGraph() {
|
public static SubjectInheritanceGraph getGraph() {
|
||||||
return NON_CONTEXTUAL;
|
return NON_CONTEXTUAL;
|
||||||
@ -73,6 +74,4 @@ public final class SubjectInheritanceGraphs {
|
|||||||
.collect(Collectors.toList());
|
.collect(Collectors.toList());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private SubjectInheritanceGraphs() {}
|
|
||||||
}
|
}
|
||||||
|
@ -33,6 +33,7 @@ import java.util.Objects;
|
|||||||
* Utility class for converting between Velocity and LuckPerms tristate classes
|
* Utility class for converting between Velocity and LuckPerms tristate classes
|
||||||
*/
|
*/
|
||||||
public final class CompatibilityUtil {
|
public final class CompatibilityUtil {
|
||||||
|
private CompatibilityUtil() {}
|
||||||
|
|
||||||
public static com.velocitypowered.api.permission.Tristate convertTristate(Tristate tristate) {
|
public static com.velocitypowered.api.permission.Tristate convertTristate(Tristate tristate) {
|
||||||
Objects.requireNonNull(tristate, "tristate");
|
Objects.requireNonNull(tristate, "tristate");
|
||||||
@ -58,6 +59,4 @@ public final class CompatibilityUtil {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private CompatibilityUtil() {}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user