diff --git a/api/src/main/java/net/luckperms/api/node/ChatMetaType.java b/api/src/main/java/net/luckperms/api/node/ChatMetaType.java index 87a85c177..0f73c912e 100644 --- a/api/src/main/java/net/luckperms/api/node/ChatMetaType.java +++ b/api/src/main/java/net/luckperms/api/node/ChatMetaType.java @@ -31,6 +31,8 @@ import net.luckperms.api.node.types.SuffixNode; import org.checkerframework.checker.nullness.qual.NonNull; +import java.util.Locale; + /** * Represents a type of chat meta */ @@ -70,7 +72,7 @@ public enum ChatMetaType { private final NodeType> nodeType; ChatMetaType(NodeType> nodeType) { - this.name = nodeType.name().toLowerCase(); + this.name = nodeType.name().toLowerCase(Locale.ROOT); this.nodeType = nodeType; } diff --git a/api/src/main/java/net/luckperms/api/node/metadata/SimpleNodeMetadataKey.java b/api/src/main/java/net/luckperms/api/node/metadata/SimpleNodeMetadataKey.java index 44a00074f..6350538ae 100644 --- a/api/src/main/java/net/luckperms/api/node/metadata/SimpleNodeMetadataKey.java +++ b/api/src/main/java/net/luckperms/api/node/metadata/SimpleNodeMetadataKey.java @@ -27,6 +27,7 @@ package net.luckperms.api.node.metadata; import org.checkerframework.checker.nullness.qual.NonNull; +import java.util.Locale; import java.util.Objects; final class SimpleNodeMetadataKey implements NodeMetadataKey { @@ -34,7 +35,7 @@ final class SimpleNodeMetadataKey implements NodeMetadataKey { private final Class type; SimpleNodeMetadataKey(String name, Class type) { - this.name = name.toLowerCase(); + this.name = name.toLowerCase(Locale.ROOT); this.type = type; } diff --git a/api/src/main/java/net/luckperms/api/query/SimpleOptionKey.java b/api/src/main/java/net/luckperms/api/query/SimpleOptionKey.java index 1a5dccb67..6efc5e2ba 100644 --- a/api/src/main/java/net/luckperms/api/query/SimpleOptionKey.java +++ b/api/src/main/java/net/luckperms/api/query/SimpleOptionKey.java @@ -27,6 +27,7 @@ package net.luckperms.api.query; import org.checkerframework.checker.nullness.qual.NonNull; +import java.util.Locale; import java.util.Objects; final class SimpleOptionKey implements OptionKey { @@ -35,7 +36,7 @@ final class SimpleOptionKey implements OptionKey { private final int hashCode; SimpleOptionKey(String name, Class type) { - this.name = name.toLowerCase(); + this.name = name.toLowerCase(Locale.ROOT); this.type = type; this.hashCode = Objects.hash(this.name, this.type); // cache hashcode } diff --git a/bukkit/src/main/java/me/lucko/luckperms/bukkit/inject/permissible/LuckPermsPermissionAttachment.java b/bukkit/src/main/java/me/lucko/luckperms/bukkit/inject/permissible/LuckPermsPermissionAttachment.java index 0a9f10ac0..db31a08b8 100644 --- a/bukkit/src/main/java/me/lucko/luckperms/bukkit/inject/permissible/LuckPermsPermissionAttachment.java +++ b/bukkit/src/main/java/me/lucko/luckperms/bukkit/inject/permissible/LuckPermsPermissionAttachment.java @@ -46,6 +46,7 @@ import java.lang.reflect.Field; import java.util.Collection; import java.util.Collections; import java.util.HashMap; +import java.util.Locale; import java.util.Map; import java.util.Objects; import java.util.Set; @@ -239,7 +240,7 @@ public class LuckPermsPermissionAttachment extends PermissionAttachment { Objects.requireNonNull(name, "name is null"); Preconditions.checkArgument(!name.isEmpty(), "name is empty"); - String permission = name.toLowerCase(); + String permission = name.toLowerCase(Locale.ROOT); Boolean previous = this.perms.put(permission, value); if (previous != null && previous == value) { @@ -264,7 +265,7 @@ public class LuckPermsPermissionAttachment extends PermissionAttachment { Objects.requireNonNull(name, "name is null"); Preconditions.checkArgument(!name.isEmpty(), "name is empty"); - String permission = name.toLowerCase(); + String permission = name.toLowerCase(Locale.ROOT); Boolean previous = this.perms.remove(permission); if (previous == null) { diff --git a/bukkit/src/main/java/me/lucko/luckperms/bukkit/inject/server/LuckPermsDefaultsMap.java b/bukkit/src/main/java/me/lucko/luckperms/bukkit/inject/server/LuckPermsDefaultsMap.java index b1d9b93d4..bcc77146a 100644 --- a/bukkit/src/main/java/me/lucko/luckperms/bukkit/inject/server/LuckPermsDefaultsMap.java +++ b/bukkit/src/main/java/me/lucko/luckperms/bukkit/inject/server/LuckPermsDefaultsMap.java @@ -43,6 +43,7 @@ import org.checkerframework.checker.nullness.qual.NonNull; import java.util.Collection; import java.util.Collections; import java.util.HashMap; +import java.util.Locale; import java.util.Map; import java.util.Set; import java.util.concurrent.ConcurrentHashMap; @@ -140,7 +141,7 @@ public final class LuckPermsDefaultsMap implements Map> protected @NonNull Map supply() { Map builder = new HashMap<>(); for (Permission perm : LuckPermsDefaultsMap.this.get(this.op)) { - String name = perm.getName().toLowerCase(); + String name = perm.getName().toLowerCase(Locale.ROOT); builder.put(name, true); for (Map.Entry child : LuckPermsDefaultsMap.this.plugin.getPermissionMap().getChildPermissions(name, true).entrySet()) { builder.putIfAbsent(child.getKey(), child.getValue()); diff --git a/bukkit/src/main/java/me/lucko/luckperms/bukkit/inject/server/LuckPermsPermissionMap.java b/bukkit/src/main/java/me/lucko/luckperms/bukkit/inject/server/LuckPermsPermissionMap.java index bfd4f46cb..fb5c43039 100644 --- a/bukkit/src/main/java/me/lucko/luckperms/bukkit/inject/server/LuckPermsPermissionMap.java +++ b/bukkit/src/main/java/me/lucko/luckperms/bukkit/inject/server/LuckPermsPermissionMap.java @@ -40,6 +40,7 @@ import org.checkerframework.checker.nullness.qual.Nullable; import java.lang.reflect.Field; import java.util.Collections; import java.util.HashMap; +import java.util.Locale; import java.util.Map; import java.util.Objects; import java.util.concurrent.ConcurrentHashMap; @@ -180,7 +181,7 @@ public final class LuckPermsPermissionMap extends ForwardingMap { public TristateResult apply(@NonNull String permission) { // convert the permission to lowercase, as all values in the backing map are also lowercase. // this allows fast case insensitive lookups - permission = permission.toLowerCase(); + permission = permission.toLowerCase(Locale.ROOT); // offer the permission to the permission vault // we only need to do this once per permission, so it doesn't matter diff --git a/common/src/main/java/me/lucko/luckperms/common/command/CommandManager.java b/common/src/main/java/me/lucko/luckperms/common/command/CommandManager.java index dbb9da189..e9d206227 100644 --- a/common/src/main/java/me/lucko/luckperms/common/command/CommandManager.java +++ b/common/src/main/java/me/lucko/luckperms/common/command/CommandManager.java @@ -75,6 +75,7 @@ import java.util.Arrays; import java.util.Collection; import java.util.Collections; import java.util.List; +import java.util.Locale; import java.util.Map; import java.util.concurrent.CompletableFuture; import java.util.concurrent.ExecutorService; @@ -130,7 +131,7 @@ public class CommandManager { .add(new ListTracks()) .build() .stream() - .collect(ImmutableCollectors.toMap(c -> c.getName().toLowerCase(), Function.identity())); + .collect(ImmutableCollectors.toMap(c -> c.getName().toLowerCase(Locale.ROOT), Function.identity())); } public LuckPermsPlugin getPlugin() { @@ -235,7 +236,7 @@ public class CommandManager { } // Look for the main command. - Command main = this.mainCommands.get(arguments.get(0).toLowerCase()); + Command main = this.mainCommands.get(arguments.get(0).toLowerCase(Locale.ROOT)); // Main command not found if (main == null) { @@ -276,7 +277,7 @@ public class CommandManager { .collect(Collectors.toList()); return TabCompleter.create() - .at(0, CompletionSupplier.startsWith(() -> mains.stream().map(c -> c.getName().toLowerCase()))) + .at(0, CompletionSupplier.startsWith(() -> mains.stream().map(c -> c.getName().toLowerCase(Locale.ROOT)))) .from(1, partial -> mains.stream() .filter(m -> m.getName().equalsIgnoreCase(arguments.get(0))) .findFirst() @@ -333,7 +334,7 @@ public class CommandManager { // '/lp user Luck p set --> /lp user Luck permission set' etc // ^ ^^^^^^^^^^ if (args.size() >= 3 && (rewriteLastArgument || args.size() >= 4)) { - String arg0 = args.get(0).toLowerCase(); + String arg0 = args.get(0).toLowerCase(Locale.ROOT); if (arg0.equals("user") || arg0.equals("group")) { replaceArgs(args, 2, arg -> { switch (arg) { @@ -353,7 +354,7 @@ public class CommandManager { // '/lp user Luck permission i' --> '/lp user Luck permission info' etc // ^ ^^^^ if (args.size() >= 4 && (rewriteLastArgument || args.size() >= 5)) { - String arg2 = args.get(2).toLowerCase(); + String arg2 = args.get(2).toLowerCase(Locale.ROOT); if (arg2.equals("permission") || arg2.equals("parent") || arg2.equals("meta")) { replaceArgs(args, 3, arg -> arg.equals("i") ? "info" : null); } @@ -363,7 +364,7 @@ public class CommandManager { } private static void replaceArgs(List args, int i, Function rewrites) { - String arg = args.get(i).toLowerCase(); + String arg = args.get(i).toLowerCase(Locale.ROOT); String rewrite = rewrites.apply(arg); if (rewrite != null) { args.remove(i); diff --git a/common/src/main/java/me/lucko/luckperms/common/command/abstraction/ChildCommand.java b/common/src/main/java/me/lucko/luckperms/common/command/abstraction/ChildCommand.java index a3f6cc67e..d388ab0bf 100644 --- a/common/src/main/java/me/lucko/luckperms/common/command/abstraction/ChildCommand.java +++ b/common/src/main/java/me/lucko/luckperms/common/command/abstraction/ChildCommand.java @@ -36,6 +36,7 @@ import net.kyori.adventure.text.TextComponent; import net.kyori.adventure.text.format.NamedTextColor; import java.util.List; +import java.util.Locale; import java.util.function.Predicate; import java.util.stream.Collectors; @@ -58,7 +59,7 @@ public abstract class ChildCommand extends Command { TextComponent.Builder builder = Component.text() .append(Component.text('>', NamedTextColor.DARK_AQUA)) .append(Component.space()) - .append(Component.text(getName().toLowerCase(), NamedTextColor.GREEN)); + .append(Component.text(getName().toLowerCase(Locale.ROOT), NamedTextColor.GREEN)); if (getArgs().isPresent()) { List argUsages = getArgs().get().stream() diff --git a/common/src/main/java/me/lucko/luckperms/common/command/abstraction/GenericChildCommand.java b/common/src/main/java/me/lucko/luckperms/common/command/abstraction/GenericChildCommand.java index c92340c77..853af290e 100644 --- a/common/src/main/java/me/lucko/luckperms/common/command/abstraction/GenericChildCommand.java +++ b/common/src/main/java/me/lucko/luckperms/common/command/abstraction/GenericChildCommand.java @@ -41,6 +41,7 @@ import net.kyori.adventure.text.format.NamedTextColor; import java.util.Collections; import java.util.List; +import java.util.Locale; import java.util.function.Predicate; import java.util.stream.Collectors; @@ -106,7 +107,7 @@ public abstract class GenericChildCommand { TextComponent.Builder builder = Component.text() .append(Component.text('>', NamedTextColor.DARK_AQUA)) .append(Component.space()) - .append(Component.text(getName().toLowerCase(), NamedTextColor.GREEN)); + .append(Component.text(getName().toLowerCase(Locale.ROOT), NamedTextColor.GREEN)); if (getArgs() != null) { List argUsages = getArgs().stream() diff --git a/common/src/main/java/me/lucko/luckperms/common/command/abstraction/GenericParentCommand.java b/common/src/main/java/me/lucko/luckperms/common/command/abstraction/GenericParentCommand.java index 510eee3cb..6b80a3305 100644 --- a/common/src/main/java/me/lucko/luckperms/common/command/abstraction/GenericParentCommand.java +++ b/common/src/main/java/me/lucko/luckperms/common/command/abstraction/GenericParentCommand.java @@ -38,6 +38,7 @@ import me.lucko.luckperms.common.util.Predicates; import java.util.Collections; import java.util.List; +import java.util.Locale; import java.util.stream.Collectors; /** @@ -96,7 +97,7 @@ public class GenericParentCommand extends ChildComma return TabCompleter.create() .at(0, CompletionSupplier.startsWith(() -> this.children.stream() .filter(s -> s.isAuthorized(sender, this.type)) - .map(s -> s.getName().toLowerCase()) + .map(s -> s.getName().toLowerCase(Locale.ROOT)) )) .from(1, partial -> this.children.stream() .filter(s -> s.isAuthorized(sender, this.type)) @@ -121,10 +122,10 @@ public class GenericParentCommand extends ChildComma if (!subs.isEmpty()) { switch (this.type) { case USER: - Message.MAIN_COMMAND_USAGE_HEADER.send(sender, getName(), String.format("/%s user " + getName().toLowerCase(), label)); + Message.MAIN_COMMAND_USAGE_HEADER.send(sender, getName(), String.format("/%s user " + getName().toLowerCase(Locale.ROOT), label)); break; case GROUP: - Message.MAIN_COMMAND_USAGE_HEADER.send(sender, getName(), String.format("/%s group " + getName().toLowerCase(), label)); + Message.MAIN_COMMAND_USAGE_HEADER.send(sender, getName(), String.format("/%s group " + getName().toLowerCase(Locale.ROOT), label)); break; default: throw new AssertionError(this.type); diff --git a/common/src/main/java/me/lucko/luckperms/common/command/abstraction/ParentCommand.java b/common/src/main/java/me/lucko/luckperms/common/command/abstraction/ParentCommand.java index 0f41f74e6..cbde0a9c8 100644 --- a/common/src/main/java/me/lucko/luckperms/common/command/abstraction/ParentCommand.java +++ b/common/src/main/java/me/lucko/luckperms/common/command/abstraction/ParentCommand.java @@ -38,6 +38,7 @@ import org.checkerframework.checker.nullness.qual.NonNull; import java.util.Collections; import java.util.List; +import java.util.Locale; import java.util.concurrent.locks.ReentrantLock; import java.util.stream.Collectors; @@ -123,7 +124,7 @@ public abstract class ParentCommand extends Command { .at(0, CompletionSupplier.startsWith(() -> getTargets(plugin).stream())) .at(1, CompletionSupplier.startsWith(() -> getChildren().stream() .filter(s -> s.isAuthorized(sender)) - .map(s -> s.getName().toLowerCase()) + .map(s -> s.getName().toLowerCase(Locale.ROOT)) )) .from(2, partial -> getChildren().stream() .filter(s -> s.isAuthorized(sender)) @@ -137,7 +138,7 @@ public abstract class ParentCommand extends Command { return TabCompleter.create() .at(0, CompletionSupplier.startsWith(() -> getChildren().stream() .filter(s -> s.isAuthorized(sender)) - .map(s -> s.getName().toLowerCase()) + .map(s -> s.getName().toLowerCase(Locale.ROOT)) )) .from(1, partial -> getChildren().stream() .filter(s -> s.isAuthorized(sender)) diff --git a/common/src/main/java/me/lucko/luckperms/common/command/abstraction/SingleCommand.java b/common/src/main/java/me/lucko/luckperms/common/command/abstraction/SingleCommand.java index ea9663f7c..4575e5939 100644 --- a/common/src/main/java/me/lucko/luckperms/common/command/abstraction/SingleCommand.java +++ b/common/src/main/java/me/lucko/luckperms/common/command/abstraction/SingleCommand.java @@ -38,6 +38,7 @@ import net.kyori.adventure.text.TextComponent; import net.kyori.adventure.text.format.NamedTextColor; import java.util.List; +import java.util.Locale; import java.util.function.Predicate; import java.util.stream.Collectors; @@ -62,7 +63,7 @@ public abstract class SingleCommand extends Command { TextComponent.Builder builder = Component.text() .append(Component.text('>', NamedTextColor.DARK_AQUA)) .append(Component.space()) - .append(Component.text(getName().toLowerCase(), NamedTextColor.GREEN)); + .append(Component.text(getName().toLowerCase(Locale.ROOT), NamedTextColor.GREEN)); if (getArgs().isPresent()) { List argUsages = getArgs().get().stream() diff --git a/common/src/main/java/me/lucko/luckperms/common/command/spec/CommandSpec.java b/common/src/main/java/me/lucko/luckperms/common/command/spec/CommandSpec.java index ebf9f665c..fe5a97409 100644 --- a/common/src/main/java/me/lucko/luckperms/common/command/spec/CommandSpec.java +++ b/common/src/main/java/me/lucko/luckperms/common/command/spec/CommandSpec.java @@ -31,6 +31,7 @@ import net.kyori.adventure.text.Component; import java.util.Arrays; import java.util.List; +import java.util.Locale; /** * An enumeration of the command defintion/usage messages used in the plugin. @@ -437,7 +438,7 @@ public enum CommandSpec { } public String key() { - return name().toLowerCase().replace('_', '-'); + return name().toLowerCase(Locale.ROOT).replace('_', '-'); } private static PartialArgument arg(String id, String name, boolean required) { diff --git a/common/src/main/java/me/lucko/luckperms/common/command/tabcomplete/TabCompleter.java b/common/src/main/java/me/lucko/luckperms/common/command/tabcomplete/TabCompleter.java index 07a9b5e4a..da985c438 100644 --- a/common/src/main/java/me/lucko/luckperms/common/command/tabcomplete/TabCompleter.java +++ b/common/src/main/java/me/lucko/luckperms/common/command/tabcomplete/TabCompleter.java @@ -29,6 +29,7 @@ import com.google.common.base.Preconditions; import java.util.HashMap; import java.util.List; +import java.util.Locale; import java.util.Map; import java.util.function.Predicate; @@ -112,7 +113,7 @@ public class TabCompleter { if (string.length() < substring.length()) { return false; } - return string.toLowerCase().contains(substring.toLowerCase()); + return string.toLowerCase(Locale.ROOT).contains(substring.toLowerCase(Locale.ROOT)); }; } diff --git a/common/src/main/java/me/lucko/luckperms/common/command/tabcomplete/TabCompletions.java b/common/src/main/java/me/lucko/luckperms/common/command/tabcomplete/TabCompletions.java index f2bbdab6a..e87c7fc13 100644 --- a/common/src/main/java/me/lucko/luckperms/common/command/tabcomplete/TabCompletions.java +++ b/common/src/main/java/me/lucko/luckperms/common/command/tabcomplete/TabCompletions.java @@ -36,6 +36,7 @@ import net.luckperms.api.context.ImmutableContextSet; import java.util.ArrayList; import java.util.Collections; import java.util.List; +import java.util.Locale; import java.util.Set; import java.util.stream.Collectors; @@ -57,7 +58,7 @@ public final class TabCompletions { this.permissions = partial -> { PermissionRegistry cache = plugin.getPermissionRegistry(); - String start = partial.toLowerCase(); + String start = partial.toLowerCase(Locale.ROOT); List parts = new ArrayList<>(Splitter.on('.').splitToList(start)); TreeNode root = cache.getRootNode(); diff --git a/common/src/main/java/me/lucko/luckperms/common/command/utils/ArgumentList.java b/common/src/main/java/me/lucko/luckperms/common/command/utils/ArgumentList.java index 016d7da04..09216ee66 100644 --- a/common/src/main/java/me/lucko/luckperms/common/command/utils/ArgumentList.java +++ b/common/src/main/java/me/lucko/luckperms/common/command/utils/ArgumentList.java @@ -47,6 +47,7 @@ import java.time.Duration; import java.time.Instant; import java.time.temporal.ChronoUnit; import java.util.List; +import java.util.Locale; import java.util.Optional; import java.util.UUID; import java.util.function.Predicate; @@ -101,7 +102,7 @@ public class ArgumentList extends ForwardingList { } public String getLowercase(int index, Predicate test) throws ArgumentException.DetailedUsage { - String arg = get(index).toLowerCase(); + String arg = get(index).toLowerCase(Locale.ROOT); if (!test.test(arg)) { throw new ArgumentException.DetailedUsage(); } @@ -188,7 +189,7 @@ public class ArgumentList extends ForwardingList { } private static TemporaryNodeMergeStrategy parseTemporaryModifier(String s) { - switch (s.toLowerCase()) { + switch (s.toLowerCase(Locale.ROOT)) { case "accumulate": return TemporaryNodeMergeStrategy.ADD_NEW_DURATION_TO_EXISTING; case "replace": diff --git a/common/src/main/java/me/lucko/luckperms/common/command/utils/SortType.java b/common/src/main/java/me/lucko/luckperms/common/command/utils/SortType.java index 7a08413f6..1cc2b5913 100644 --- a/common/src/main/java/me/lucko/luckperms/common/command/utils/SortType.java +++ b/common/src/main/java/me/lucko/luckperms/common/command/utils/SortType.java @@ -25,6 +25,8 @@ package me.lucko.luckperms.common.command.utils; +import java.util.Locale; + public enum SortType { PRIORITY, @@ -32,6 +34,6 @@ public enum SortType { @Override public String toString() { - return name().toLowerCase(); + return name().toLowerCase(Locale.ROOT); } } diff --git a/common/src/main/java/me/lucko/luckperms/common/commands/generic/meta/MetaAddChatMeta.java b/common/src/main/java/me/lucko/luckperms/common/commands/generic/meta/MetaAddChatMeta.java index 66eb7e8ee..8df2295ac 100644 --- a/common/src/main/java/me/lucko/luckperms/common/commands/generic/meta/MetaAddChatMeta.java +++ b/common/src/main/java/me/lucko/luckperms/common/commands/generic/meta/MetaAddChatMeta.java @@ -47,6 +47,7 @@ import net.luckperms.api.model.data.DataType; import net.luckperms.api.node.ChatMetaType; import java.util.List; +import java.util.Locale; public class MetaAddChatMeta extends GenericChildCommand { @@ -99,7 +100,7 @@ public class MetaAddChatMeta extends GenericChildCommand { Message.ADD_CHATMETA_SUCCESS.send(sender, target, this.type, meta, priority, context); LoggedAction.build().source(sender).target(target) - .description("meta" , "add" + this.type.name().toLowerCase(), priority, meta, context) + .description("meta" , "add" + this.type.name().toLowerCase(Locale.ROOT), priority, meta, context) .build().submit(plugin, sender); StorageAssistant.save(target, sender, plugin); diff --git a/common/src/main/java/me/lucko/luckperms/common/commands/generic/meta/MetaAddTempChatMeta.java b/common/src/main/java/me/lucko/luckperms/common/commands/generic/meta/MetaAddTempChatMeta.java index a2050e03f..b37c73451 100644 --- a/common/src/main/java/me/lucko/luckperms/common/commands/generic/meta/MetaAddTempChatMeta.java +++ b/common/src/main/java/me/lucko/luckperms/common/commands/generic/meta/MetaAddTempChatMeta.java @@ -50,6 +50,7 @@ import net.luckperms.api.node.ChatMetaType; import java.time.Duration; import java.util.List; +import java.util.Locale; public class MetaAddTempChatMeta extends GenericChildCommand { @@ -107,7 +108,7 @@ public class MetaAddTempChatMeta extends GenericChildCommand { Message.ADD_TEMP_CHATMETA_SUCCESS.send(sender, target, this.type, meta, priority, duration, context); LoggedAction.build().source(sender).target(target) - .description("meta" , "addtemp" + this.type.name().toLowerCase(), priority, meta, duration, context) + .description("meta" , "addtemp" + this.type.name().toLowerCase(Locale.ROOT), priority, meta, duration, context) .build().submit(plugin, sender); StorageAssistant.save(target, sender, plugin); diff --git a/common/src/main/java/me/lucko/luckperms/common/commands/generic/meta/MetaClear.java b/common/src/main/java/me/lucko/luckperms/common/commands/generic/meta/MetaClear.java index 6f8a66b05..5bd4bfc80 100644 --- a/common/src/main/java/me/lucko/luckperms/common/commands/generic/meta/MetaClear.java +++ b/common/src/main/java/me/lucko/luckperms/common/commands/generic/meta/MetaClear.java @@ -46,6 +46,7 @@ import net.luckperms.api.model.data.DataType; import net.luckperms.api.node.NodeType; import java.util.List; +import java.util.Locale; public class MetaClear extends GenericChildCommand { public MetaClear() { @@ -61,7 +62,7 @@ public class MetaClear extends GenericChildCommand { NodeType type = null; if (!args.isEmpty()) { - String typeId = args.get(0).toLowerCase(); + String typeId = args.get(0).toLowerCase(Locale.ROOT); if (typeId.equals("any") || typeId.equals("all") || typeId.equals("*")) { type = NodeType.META_OR_CHAT_META; } @@ -104,7 +105,7 @@ public class MetaClear extends GenericChildCommand { } int changed = before - target.normalData().size(); - Message.META_CLEAR_SUCCESS.send(sender, target, type.name().toLowerCase(), context, changed); + Message.META_CLEAR_SUCCESS.send(sender, target, type.name().toLowerCase(Locale.ROOT), context, changed); LoggedAction.build().source(sender).target(target) .description("meta", "clear", context) diff --git a/common/src/main/java/me/lucko/luckperms/common/commands/generic/meta/MetaRemoveChatMeta.java b/common/src/main/java/me/lucko/luckperms/common/commands/generic/meta/MetaRemoveChatMeta.java index 6d3e2889d..9fc80c568 100644 --- a/common/src/main/java/me/lucko/luckperms/common/commands/generic/meta/MetaRemoveChatMeta.java +++ b/common/src/main/java/me/lucko/luckperms/common/commands/generic/meta/MetaRemoveChatMeta.java @@ -47,6 +47,7 @@ import net.luckperms.api.model.data.DataType; import net.luckperms.api.node.ChatMetaType; import java.util.List; +import java.util.Locale; public class MetaRemoveChatMeta extends GenericChildCommand { @@ -100,7 +101,7 @@ public class MetaRemoveChatMeta extends GenericChildCommand { Message.BULK_REMOVE_CHATMETA_SUCCESS.send(sender, target, this.type, priority, context); LoggedAction.build().source(sender).target(target) - .description("meta" , "remove" + this.type.name().toLowerCase(), priority, "*", context) + .description("meta" , "remove" + this.type.name().toLowerCase(Locale.ROOT), priority, "*", context) .build().submit(plugin, sender); StorageAssistant.save(target, sender, plugin); @@ -113,7 +114,7 @@ public class MetaRemoveChatMeta extends GenericChildCommand { Message.REMOVE_CHATMETA_SUCCESS.send(sender, target, this.type, meta, priority, context); LoggedAction.build().source(sender).target(target) - .description("meta" , "remove" + this.type.name().toLowerCase(), priority, meta, context) + .description("meta" , "remove" + this.type.name().toLowerCase(Locale.ROOT), priority, meta, context) .build().submit(plugin, sender); StorageAssistant.save(target, sender, plugin); diff --git a/common/src/main/java/me/lucko/luckperms/common/commands/generic/meta/MetaRemoveTempChatMeta.java b/common/src/main/java/me/lucko/luckperms/common/commands/generic/meta/MetaRemoveTempChatMeta.java index cd8951103..19c391ec9 100644 --- a/common/src/main/java/me/lucko/luckperms/common/commands/generic/meta/MetaRemoveTempChatMeta.java +++ b/common/src/main/java/me/lucko/luckperms/common/commands/generic/meta/MetaRemoveTempChatMeta.java @@ -47,6 +47,7 @@ import net.luckperms.api.model.data.DataType; import net.luckperms.api.node.ChatMetaType; import java.util.List; +import java.util.Locale; public class MetaRemoveTempChatMeta extends GenericChildCommand { @@ -100,7 +101,7 @@ public class MetaRemoveTempChatMeta extends GenericChildCommand { Message.BULK_REMOVE_TEMP_CHATMETA_SUCCESS.send(sender, target, this.type, priority, context); LoggedAction.build().source(sender).target(target) - .description("meta" , "removetemp" + this.type.name().toLowerCase(), priority, "*", context) + .description("meta" , "removetemp" + this.type.name().toLowerCase(Locale.ROOT), priority, "*", context) .build().submit(plugin, sender); StorageAssistant.save(target, sender, plugin); @@ -113,7 +114,7 @@ public class MetaRemoveTempChatMeta extends GenericChildCommand { Message.REMOVE_TEMP_CHATMETA_SUCCESS.send(sender, target, this.type, meta, priority, context); LoggedAction.build().source(sender).target(target) - .description("meta" , "removetemp" + this.type.name().toLowerCase(), priority, meta, context) + .description("meta" , "removetemp" + this.type.name().toLowerCase(Locale.ROOT), priority, meta, context) .build().submit(plugin, sender); StorageAssistant.save(target, sender, plugin); diff --git a/common/src/main/java/me/lucko/luckperms/common/commands/generic/meta/MetaSetChatMeta.java b/common/src/main/java/me/lucko/luckperms/common/commands/generic/meta/MetaSetChatMeta.java index 4f115f64c..6a6da7122 100644 --- a/common/src/main/java/me/lucko/luckperms/common/commands/generic/meta/MetaSetChatMeta.java +++ b/common/src/main/java/me/lucko/luckperms/common/commands/generic/meta/MetaSetChatMeta.java @@ -50,6 +50,7 @@ import net.luckperms.api.model.data.DataType; import net.luckperms.api.node.ChatMetaType; import java.util.List; +import java.util.Locale; import java.util.OptionalInt; public class MetaSetChatMeta extends GenericChildCommand { @@ -134,7 +135,7 @@ public class MetaSetChatMeta extends GenericChildCommand { Message.ADD_CHATMETA_SUCCESS.send(sender, target, this.type, meta, priority, context); LoggedAction.build().source(sender).target(target) - .description("meta" , "set" + this.type.name().toLowerCase(), priority, meta, context) + .description("meta" , "set" + this.type.name().toLowerCase(Locale.ROOT), priority, meta, context) .build().submit(plugin, sender); StorageAssistant.save(target, sender, plugin); diff --git a/common/src/main/java/me/lucko/luckperms/common/commands/generic/meta/MetaSetTempChatMeta.java b/common/src/main/java/me/lucko/luckperms/common/commands/generic/meta/MetaSetTempChatMeta.java index 964049533..09bb41a71 100644 --- a/common/src/main/java/me/lucko/luckperms/common/commands/generic/meta/MetaSetTempChatMeta.java +++ b/common/src/main/java/me/lucko/luckperms/common/commands/generic/meta/MetaSetTempChatMeta.java @@ -53,6 +53,7 @@ import net.luckperms.api.node.ChatMetaType; import java.time.Duration; import java.util.List; +import java.util.Locale; import java.util.OptionalInt; public class MetaSetTempChatMeta extends GenericChildCommand { @@ -146,7 +147,7 @@ public class MetaSetTempChatMeta extends GenericChildCommand { Message.ADD_TEMP_CHATMETA_SUCCESS.send(sender, target, this.type, meta, priority, duration, context); LoggedAction.build().source(sender).target(target) - .description("meta" , "settemp" + this.type.name().toLowerCase(), priority, meta, duration, context) + .description("meta" , "settemp" + this.type.name().toLowerCase(Locale.ROOT), priority, meta, duration, context) .build().submit(plugin, sender); StorageAssistant.save(target, sender, plugin); diff --git a/common/src/main/java/me/lucko/luckperms/common/commands/generic/parent/ParentClearTrack.java b/common/src/main/java/me/lucko/luckperms/common/commands/generic/parent/ParentClearTrack.java index 1a20d7226..7b936234d 100644 --- a/common/src/main/java/me/lucko/luckperms/common/commands/generic/parent/ParentClearTrack.java +++ b/common/src/main/java/me/lucko/luckperms/common/commands/generic/parent/ParentClearTrack.java @@ -50,6 +50,7 @@ import net.luckperms.api.model.data.DataType; import net.luckperms.api.node.NodeType; import java.util.List; +import java.util.Locale; public class ParentClearTrack extends GenericChildCommand { public ParentClearTrack() { @@ -63,7 +64,7 @@ public class ParentClearTrack extends GenericChildCommand { return; } - final String trackName = args.get(0).toLowerCase(); + final String trackName = args.get(0).toLowerCase(Locale.ROOT); if (!DataConstraints.TRACK_NAME_TEST.test(trackName)) { Message.TRACK_INVALID_ENTRY.send(sender, trackName); return; diff --git a/common/src/main/java/me/lucko/luckperms/common/commands/generic/parent/ParentSetTrack.java b/common/src/main/java/me/lucko/luckperms/common/commands/generic/parent/ParentSetTrack.java index 36b63606b..a306da03b 100644 --- a/common/src/main/java/me/lucko/luckperms/common/commands/generic/parent/ParentSetTrack.java +++ b/common/src/main/java/me/lucko/luckperms/common/commands/generic/parent/ParentSetTrack.java @@ -50,6 +50,7 @@ import net.luckperms.api.model.data.DataType; import net.luckperms.api.node.NodeType; import java.util.List; +import java.util.Locale; public class ParentSetTrack extends GenericChildCommand { public ParentSetTrack() { @@ -63,7 +64,7 @@ public class ParentSetTrack extends GenericChildCommand { return; } - final String trackName = args.get(0).toLowerCase(); + final String trackName = args.get(0).toLowerCase(Locale.ROOT); if (!DataConstraints.TRACK_NAME_TEST.test(trackName)) { Message.TRACK_INVALID_ENTRY.send(sender, trackName); return; diff --git a/common/src/main/java/me/lucko/luckperms/common/commands/generic/parent/UserSwitchPrimaryGroup.java b/common/src/main/java/me/lucko/luckperms/common/commands/generic/parent/UserSwitchPrimaryGroup.java index 483235fc7..41b2c6efb 100644 --- a/common/src/main/java/me/lucko/luckperms/common/commands/generic/parent/UserSwitchPrimaryGroup.java +++ b/common/src/main/java/me/lucko/luckperms/common/commands/generic/parent/UserSwitchPrimaryGroup.java @@ -51,6 +51,7 @@ import net.luckperms.api.node.Node; import net.luckperms.api.node.NodeEqualityPredicate; import java.util.List; +import java.util.Locale; public class UserSwitchPrimaryGroup extends GenericChildCommand { public UserSwitchPrimaryGroup() { @@ -74,9 +75,9 @@ public class UserSwitchPrimaryGroup extends GenericChildCommand { Message.USER_PRIMARYGROUP_WARN_OPTION.send(sender, opt); } - Group group = plugin.getGroupManager().getIfLoaded(args.get(0).toLowerCase()); + Group group = plugin.getGroupManager().getIfLoaded(args.get(0).toLowerCase(Locale.ROOT)); if (group == null) { - Message.DOES_NOT_EXIST.send(sender, args.get(0).toLowerCase()); + Message.DOES_NOT_EXIST.send(sender, args.get(0).toLowerCase(Locale.ROOT)); return; } diff --git a/common/src/main/java/me/lucko/luckperms/common/commands/group/CreateGroup.java b/common/src/main/java/me/lucko/luckperms/common/commands/group/CreateGroup.java index b7592bac8..2e9aaf5ae 100644 --- a/common/src/main/java/me/lucko/luckperms/common/commands/group/CreateGroup.java +++ b/common/src/main/java/me/lucko/luckperms/common/commands/group/CreateGroup.java @@ -46,6 +46,8 @@ import net.luckperms.api.actionlog.Action; import net.luckperms.api.event.cause.CreationCause; import net.luckperms.api.model.data.DataType; +import java.util.Locale; + public class CreateGroup extends SingleCommand { public CreateGroup() { super(CommandSpec.CREATE_GROUP, "CreateGroup", CommandPermission.CREATE_GROUP, Predicates.notInRange(1, 3)); @@ -58,7 +60,7 @@ public class CreateGroup extends SingleCommand { return; } - String groupName = args.get(0).toLowerCase(); + String groupName = args.get(0).toLowerCase(Locale.ROOT); if (!DataConstraints.GROUP_NAME_TEST.test(groupName)) { Message.GROUP_INVALID_ENTRY.send(sender, groupName); return; diff --git a/common/src/main/java/me/lucko/luckperms/common/commands/group/DeleteGroup.java b/common/src/main/java/me/lucko/luckperms/common/commands/group/DeleteGroup.java index 9a59556f2..57794664e 100644 --- a/common/src/main/java/me/lucko/luckperms/common/commands/group/DeleteGroup.java +++ b/common/src/main/java/me/lucko/luckperms/common/commands/group/DeleteGroup.java @@ -56,6 +56,7 @@ import net.luckperms.api.actionlog.Action; import net.luckperms.api.event.cause.DeletionCause; import java.util.List; +import java.util.Locale; import java.util.Optional; public class DeleteGroup extends SingleCommand { @@ -70,7 +71,7 @@ public class DeleteGroup extends SingleCommand { return; } - String groupName = args.get(0).toLowerCase(); + String groupName = args.get(0).toLowerCase(Locale.ROOT); if (groupName.equalsIgnoreCase(GroupManager.DEFAULT_GROUP_NAME)) { Message.DELETE_GROUP_ERROR_DEFAULT.send(sender); diff --git a/common/src/main/java/me/lucko/luckperms/common/commands/group/GroupClone.java b/common/src/main/java/me/lucko/luckperms/common/commands/group/GroupClone.java index 2461bb742..02be4069a 100644 --- a/common/src/main/java/me/lucko/luckperms/common/commands/group/GroupClone.java +++ b/common/src/main/java/me/lucko/luckperms/common/commands/group/GroupClone.java @@ -42,6 +42,8 @@ import me.lucko.luckperms.common.util.Predicates; import net.luckperms.api.event.cause.CreationCause; import net.luckperms.api.model.data.DataType; +import java.util.Locale; + public class GroupClone extends ChildCommand { public GroupClone() { super(CommandSpec.GROUP_CLONE, "clone", CommandPermission.GROUP_CLONE, Predicates.not(1)); @@ -54,7 +56,7 @@ public class GroupClone extends ChildCommand { return; } - String newGroupName = args.get(0).toLowerCase(); + String newGroupName = args.get(0).toLowerCase(Locale.ROOT); if (!DataConstraints.GROUP_NAME_TEST.test(newGroupName)) { Message.GROUP_INVALID_ENTRY.send(sender, newGroupName); return; diff --git a/common/src/main/java/me/lucko/luckperms/common/commands/group/GroupParentCommand.java b/common/src/main/java/me/lucko/luckperms/common/commands/group/GroupParentCommand.java index 8262a55e0..ead05681d 100644 --- a/common/src/main/java/me/lucko/luckperms/common/commands/group/GroupParentCommand.java +++ b/common/src/main/java/me/lucko/luckperms/common/commands/group/GroupParentCommand.java @@ -46,6 +46,7 @@ import me.lucko.luckperms.common.util.CaffeineFactory; import java.util.ArrayList; import java.util.List; +import java.util.Locale; import java.util.concurrent.TimeUnit; import java.util.concurrent.locks.ReentrantLock; @@ -83,7 +84,7 @@ public class GroupParentCommand extends ParentCommand { if (group != null) { return group.getName(); } else { - return target.toLowerCase(); + return target.toLowerCase(Locale.ROOT); } } diff --git a/common/src/main/java/me/lucko/luckperms/common/commands/group/GroupRename.java b/common/src/main/java/me/lucko/luckperms/common/commands/group/GroupRename.java index 23c625fce..0300ea2d6 100644 --- a/common/src/main/java/me/lucko/luckperms/common/commands/group/GroupRename.java +++ b/common/src/main/java/me/lucko/luckperms/common/commands/group/GroupRename.java @@ -55,6 +55,7 @@ import net.luckperms.api.event.cause.DeletionCause; import net.luckperms.api.model.data.DataType; import java.util.List; +import java.util.Locale; import java.util.concurrent.CompletableFuture; public class GroupRename extends ChildCommand { @@ -69,7 +70,7 @@ public class GroupRename extends ChildCommand { return; } - String newGroupName = args.get(0).toLowerCase(); + String newGroupName = args.get(0).toLowerCase(Locale.ROOT); if (!DataConstraints.GROUP_NAME_TEST.test(newGroupName)) { Message.GROUP_INVALID_ENTRY.send(sender, newGroupName); return; diff --git a/common/src/main/java/me/lucko/luckperms/common/commands/log/LogGroupHistory.java b/common/src/main/java/me/lucko/luckperms/common/commands/log/LogGroupHistory.java index 6b92bb910..a5a58fa0d 100644 --- a/common/src/main/java/me/lucko/luckperms/common/commands/log/LogGroupHistory.java +++ b/common/src/main/java/me/lucko/luckperms/common/commands/log/LogGroupHistory.java @@ -41,6 +41,7 @@ import me.lucko.luckperms.common.util.Paginated; import me.lucko.luckperms.common.util.Predicates; import java.util.List; +import java.util.Locale; public class LogGroupHistory extends ChildCommand { private static final int ENTRIES_PER_PAGE = 10; @@ -51,7 +52,7 @@ public class LogGroupHistory extends ChildCommand { @Override public void execute(LuckPermsPlugin plugin, Sender sender, Log log, ArgumentList args, String label) { - String group = args.get(0).toLowerCase(); + String group = args.get(0).toLowerCase(Locale.ROOT); if (!DataConstraints.GROUP_NAME_TEST.test(group)) { Message.GROUP_INVALID_ENTRY.send(sender, group); return; diff --git a/common/src/main/java/me/lucko/luckperms/common/commands/log/LogTrackHistory.java b/common/src/main/java/me/lucko/luckperms/common/commands/log/LogTrackHistory.java index a7a6de3f2..0a655a3c1 100644 --- a/common/src/main/java/me/lucko/luckperms/common/commands/log/LogTrackHistory.java +++ b/common/src/main/java/me/lucko/luckperms/common/commands/log/LogTrackHistory.java @@ -41,6 +41,7 @@ import me.lucko.luckperms.common.util.Paginated; import me.lucko.luckperms.common.util.Predicates; import java.util.List; +import java.util.Locale; public class LogTrackHistory extends ChildCommand { private static final int ENTRIES_PER_PAGE = 10; @@ -51,7 +52,7 @@ public class LogTrackHistory extends ChildCommand { @Override public void execute(LuckPermsPlugin plugin, Sender sender, Log log, ArgumentList args, String label) { - String track = args.get(0).toLowerCase(); + String track = args.get(0).toLowerCase(Locale.ROOT); if (!DataConstraints.TRACK_NAME_TEST.test(track)) { Message.TRACK_INVALID_ENTRY.send(sender, track); return; diff --git a/common/src/main/java/me/lucko/luckperms/common/commands/misc/BulkUpdateCommand.java b/common/src/main/java/me/lucko/luckperms/common/commands/misc/BulkUpdateCommand.java index 9f6d9d78d..85feafb78 100644 --- a/common/src/main/java/me/lucko/luckperms/common/commands/misc/BulkUpdateCommand.java +++ b/common/src/main/java/me/lucko/luckperms/common/commands/misc/BulkUpdateCommand.java @@ -51,6 +51,7 @@ import me.lucko.luckperms.common.sender.Sender; import me.lucko.luckperms.common.util.CaffeineFactory; import me.lucko.luckperms.common.util.Predicates; +import java.util.Locale; import java.util.concurrent.ThreadLocalRandom; import java.util.concurrent.TimeUnit; @@ -90,13 +91,13 @@ public class BulkUpdateCommand extends SingleCommand { bulkUpdateBuilder.trackStatistics(!args.remove("-s")); try { - bulkUpdateBuilder.dataType(DataType.valueOf(args.remove(0).toUpperCase())); + bulkUpdateBuilder.dataType(DataType.valueOf(args.remove(0).toUpperCase(Locale.ROOT))); } catch (IllegalArgumentException e) { Message.BULK_UPDATE_INVALID_DATA_TYPE.send(sender); return; } - String action = args.remove(0).toLowerCase(); + String action = args.remove(0).toLowerCase(Locale.ROOT); switch (action) { case "delete": bulkUpdateBuilder.action(DeleteAction.create()); diff --git a/common/src/main/java/me/lucko/luckperms/common/commands/misc/EditorCommand.java b/common/src/main/java/me/lucko/luckperms/common/commands/misc/EditorCommand.java index 3542ca1ad..459003b41 100644 --- a/common/src/main/java/me/lucko/luckperms/common/commands/misc/EditorCommand.java +++ b/common/src/main/java/me/lucko/luckperms/common/commands/misc/EditorCommand.java @@ -45,6 +45,7 @@ import net.luckperms.api.node.Node; import java.util.ArrayList; import java.util.List; +import java.util.Locale; public class EditorCommand extends SingleCommand { public EditorCommand() { @@ -60,7 +61,7 @@ public class EditorCommand extends SingleCommand { String arg0 = args.getOrDefault(0, null); if (arg0 != null) { try { - type = Type.valueOf(arg0.toUpperCase()); + type = Type.valueOf(arg0.toUpperCase(Locale.ROOT)); } catch (IllegalArgumentException e) { // assume they meant it as a filter filter = arg0; diff --git a/common/src/main/java/me/lucko/luckperms/common/commands/misc/VerboseCommand.java b/common/src/main/java/me/lucko/luckperms/common/commands/misc/VerboseCommand.java index a9acd5361..4f7ceb338 100644 --- a/common/src/main/java/me/lucko/luckperms/common/commands/misc/VerboseCommand.java +++ b/common/src/main/java/me/lucko/luckperms/common/commands/misc/VerboseCommand.java @@ -45,6 +45,7 @@ import me.lucko.luckperms.common.verbose.VerboseListener; import java.io.IOException; import java.util.ArrayList; import java.util.List; +import java.util.Locale; public class VerboseCommand extends SingleCommand { public VerboseCommand() { @@ -59,7 +60,7 @@ public class VerboseCommand extends SingleCommand { } VerboseHandler verboseHandler = plugin.getVerboseHandler(); - String mode = args.get(0).toLowerCase(); + String mode = args.get(0).toLowerCase(Locale.ROOT); if (mode.equals("command") || mode.equals("cmd")) { if (args.size() < 3) { diff --git a/common/src/main/java/me/lucko/luckperms/common/commands/track/CreateTrack.java b/common/src/main/java/me/lucko/luckperms/common/commands/track/CreateTrack.java index 7f0e76380..bb1d324a5 100644 --- a/common/src/main/java/me/lucko/luckperms/common/commands/track/CreateTrack.java +++ b/common/src/main/java/me/lucko/luckperms/common/commands/track/CreateTrack.java @@ -40,6 +40,8 @@ import net.kyori.adventure.text.Component; import net.luckperms.api.actionlog.Action; import net.luckperms.api.event.cause.CreationCause; +import java.util.Locale; + public class CreateTrack extends SingleCommand { public CreateTrack() { super(CommandSpec.CREATE_TRACK, "CreateTrack", CommandPermission.CREATE_TRACK, Predicates.not(1)); @@ -52,7 +54,7 @@ public class CreateTrack extends SingleCommand { return; } - String trackName = args.get(0).toLowerCase(); + String trackName = args.get(0).toLowerCase(Locale.ROOT); if (!DataConstraints.TRACK_NAME_TEST.test(trackName)) { Message.TRACK_INVALID_ENTRY.send(sender, trackName); return; diff --git a/common/src/main/java/me/lucko/luckperms/common/commands/track/DeleteTrack.java b/common/src/main/java/me/lucko/luckperms/common/commands/track/DeleteTrack.java index 75c250a25..8dc2ad274 100644 --- a/common/src/main/java/me/lucko/luckperms/common/commands/track/DeleteTrack.java +++ b/common/src/main/java/me/lucko/luckperms/common/commands/track/DeleteTrack.java @@ -44,6 +44,7 @@ import net.luckperms.api.actionlog.Action; import net.luckperms.api.event.cause.DeletionCause; import java.util.List; +import java.util.Locale; public class DeleteTrack extends SingleCommand { public DeleteTrack() { @@ -57,7 +58,7 @@ public class DeleteTrack extends SingleCommand { return; } - String trackName = args.get(0).toLowerCase(); + String trackName = args.get(0).toLowerCase(Locale.ROOT); Track track = plugin.getStorage().loadTrack(trackName).join().orElse(null); if (track == null) { Message.TRACK_LOAD_ERROR.send(sender); diff --git a/common/src/main/java/me/lucko/luckperms/common/commands/track/TrackAppend.java b/common/src/main/java/me/lucko/luckperms/common/commands/track/TrackAppend.java index 898dfc4b0..f0b6ae9ba 100644 --- a/common/src/main/java/me/lucko/luckperms/common/commands/track/TrackAppend.java +++ b/common/src/main/java/me/lucko/luckperms/common/commands/track/TrackAppend.java @@ -45,6 +45,7 @@ import me.lucko.luckperms.common.util.Predicates; import net.luckperms.api.model.data.DataMutateResult; import java.util.List; +import java.util.Locale; public class TrackAppend extends ChildCommand { public TrackAppend() { @@ -58,7 +59,7 @@ public class TrackAppend extends ChildCommand { return; } - String groupName = args.get(0).toLowerCase(); + String groupName = args.get(0).toLowerCase(Locale.ROOT); if (!DataConstraints.GROUP_NAME_TEST.test(groupName)) { sendDetailedUsage(sender, label); return; diff --git a/common/src/main/java/me/lucko/luckperms/common/commands/track/TrackClone.java b/common/src/main/java/me/lucko/luckperms/common/commands/track/TrackClone.java index 8abddced4..c4d9e19ce 100644 --- a/common/src/main/java/me/lucko/luckperms/common/commands/track/TrackClone.java +++ b/common/src/main/java/me/lucko/luckperms/common/commands/track/TrackClone.java @@ -42,6 +42,8 @@ import me.lucko.luckperms.common.util.Predicates; import net.kyori.adventure.text.Component; import net.luckperms.api.event.cause.CreationCause; +import java.util.Locale; + public class TrackClone extends ChildCommand { public TrackClone() { super(CommandSpec.TRACK_CLONE, "clone", CommandPermission.TRACK_CLONE, Predicates.not(1)); @@ -54,7 +56,7 @@ public class TrackClone extends ChildCommand { return; } - String newTrackName = args.get(0).toLowerCase(); + String newTrackName = args.get(0).toLowerCase(Locale.ROOT); if (!DataConstraints.TRACK_NAME_TEST.test(newTrackName)) { Message.TRACK_INVALID_ENTRY.send(sender, newTrackName); return; diff --git a/common/src/main/java/me/lucko/luckperms/common/commands/track/TrackInsert.java b/common/src/main/java/me/lucko/luckperms/common/commands/track/TrackInsert.java index 3c77671f4..b6fe12edc 100644 --- a/common/src/main/java/me/lucko/luckperms/common/commands/track/TrackInsert.java +++ b/common/src/main/java/me/lucko/luckperms/common/commands/track/TrackInsert.java @@ -45,6 +45,7 @@ import me.lucko.luckperms.common.util.Predicates; import net.luckperms.api.model.data.DataMutateResult; import java.util.List; +import java.util.Locale; public class TrackInsert extends ChildCommand { public TrackInsert() { @@ -58,7 +59,7 @@ public class TrackInsert extends ChildCommand { return; } - String groupName = args.get(0).toLowerCase(); + String groupName = args.get(0).toLowerCase(Locale.ROOT); if (!DataConstraints.GROUP_NAME_TEST.test(groupName)) { sendDetailedUsage(sender, label); return; diff --git a/common/src/main/java/me/lucko/luckperms/common/commands/track/TrackParentCommand.java b/common/src/main/java/me/lucko/luckperms/common/commands/track/TrackParentCommand.java index 770efc4d2..ea79419d5 100644 --- a/common/src/main/java/me/lucko/luckperms/common/commands/track/TrackParentCommand.java +++ b/common/src/main/java/me/lucko/luckperms/common/commands/track/TrackParentCommand.java @@ -39,6 +39,7 @@ import me.lucko.luckperms.common.util.CaffeineFactory; import java.util.ArrayList; import java.util.List; +import java.util.Locale; import java.util.concurrent.TimeUnit; import java.util.concurrent.locks.ReentrantLock; @@ -68,7 +69,7 @@ public class TrackParentCommand extends ParentCommand { @Override protected String parseTarget(String target, LuckPermsPlugin plugin, Sender sender) { - return target.toLowerCase(); + return target.toLowerCase(Locale.ROOT); } @Override diff --git a/common/src/main/java/me/lucko/luckperms/common/commands/track/TrackRemove.java b/common/src/main/java/me/lucko/luckperms/common/commands/track/TrackRemove.java index cd2464e52..01fc0c9d1 100644 --- a/common/src/main/java/me/lucko/luckperms/common/commands/track/TrackRemove.java +++ b/common/src/main/java/me/lucko/luckperms/common/commands/track/TrackRemove.java @@ -44,6 +44,7 @@ import me.lucko.luckperms.common.util.Predicates; import net.luckperms.api.model.data.DataMutateResult; import java.util.List; +import java.util.Locale; public class TrackRemove extends ChildCommand { public TrackRemove() { @@ -57,7 +58,7 @@ public class TrackRemove extends ChildCommand { return; } - String groupName = args.get(0).toLowerCase(); + String groupName = args.get(0).toLowerCase(Locale.ROOT); if (!DataConstraints.GROUP_NAME_TEST.test(groupName)) { sendDetailedUsage(sender, label); return; diff --git a/common/src/main/java/me/lucko/luckperms/common/commands/track/TrackRename.java b/common/src/main/java/me/lucko/luckperms/common/commands/track/TrackRename.java index c88c8a879..358d3dada 100644 --- a/common/src/main/java/me/lucko/luckperms/common/commands/track/TrackRename.java +++ b/common/src/main/java/me/lucko/luckperms/common/commands/track/TrackRename.java @@ -43,6 +43,8 @@ import net.kyori.adventure.text.Component; import net.luckperms.api.event.cause.CreationCause; import net.luckperms.api.event.cause.DeletionCause; +import java.util.Locale; + public class TrackRename extends ChildCommand { public TrackRename() { super(CommandSpec.TRACK_RENAME, "rename", CommandPermission.TRACK_RENAME, Predicates.not(1)); @@ -55,7 +57,7 @@ public class TrackRename extends ChildCommand { return; } - String newTrackName = args.get(0).toLowerCase(); + String newTrackName = args.get(0).toLowerCase(Locale.ROOT); if (!DataConstraints.TRACK_NAME_TEST.test(newTrackName)) { Message.TRACK_INVALID_ENTRY.send(sender, newTrackName); return; diff --git a/common/src/main/java/me/lucko/luckperms/common/commands/user/UserDemote.java b/common/src/main/java/me/lucko/luckperms/common/commands/user/UserDemote.java index 0dd89f5e5..d4ac566e2 100644 --- a/common/src/main/java/me/lucko/luckperms/common/commands/user/UserDemote.java +++ b/common/src/main/java/me/lucko/luckperms/common/commands/user/UserDemote.java @@ -47,6 +47,7 @@ import net.luckperms.api.context.MutableContextSet; import net.luckperms.api.track.DemotionResult; import java.util.List; +import java.util.Locale; import java.util.Set; import java.util.function.Predicate; @@ -77,7 +78,7 @@ public class UserDemote extends ChildCommand { } } - final String trackName = args.get(0).toLowerCase(); + final String trackName = args.get(0).toLowerCase(Locale.ROOT); if (!DataConstraints.TRACK_NAME_TEST.test(trackName)) { Message.TRACK_INVALID_ENTRY.send(sender, trackName); return; diff --git a/common/src/main/java/me/lucko/luckperms/common/commands/user/UserPromote.java b/common/src/main/java/me/lucko/luckperms/common/commands/user/UserPromote.java index c7faa2b11..6bf891f2f 100644 --- a/common/src/main/java/me/lucko/luckperms/common/commands/user/UserPromote.java +++ b/common/src/main/java/me/lucko/luckperms/common/commands/user/UserPromote.java @@ -47,6 +47,7 @@ import net.luckperms.api.context.MutableContextSet; import net.luckperms.api.track.PromotionResult; import java.util.List; +import java.util.Locale; import java.util.Set; import java.util.function.Predicate; @@ -77,7 +78,7 @@ public class UserPromote extends ChildCommand { } } - final String trackName = args.get(0).toLowerCase(); + final String trackName = args.get(0).toLowerCase(Locale.ROOT); if (!DataConstraints.TRACK_NAME_TEST.test(trackName)) { Message.TRACK_INVALID_ENTRY.send(sender, trackName); return; diff --git a/common/src/main/java/me/lucko/luckperms/common/config/ConfigKeys.java b/common/src/main/java/me/lucko/luckperms/common/config/ConfigKeys.java index 1c4a27204..1aa8d32e7 100644 --- a/common/src/main/java/me/lucko/luckperms/common/config/ConfigKeys.java +++ b/common/src/main/java/me/lucko/luckperms/common/config/ConfigKeys.java @@ -59,6 +59,7 @@ import java.util.ArrayList; import java.util.EnumMap; import java.util.EnumSet; import java.util.List; +import java.util.Locale; import java.util.Map; import java.util.Objects; import java.util.Set; @@ -86,9 +87,9 @@ public final class ConfigKeys { * The name of the server */ public static final ConfigKey SERVER = key(c -> { - String server = c.getString("server", "global").toLowerCase(); + String server = c.getString("server", "global").toLowerCase(Locale.ROOT); if (server.equals("load-from-system-property")) { - server = System.getProperty("luckperms.server", "global").toLowerCase(); + server = System.getProperty("luckperms.server", "global").toLowerCase(Locale.ROOT); } return server; }); @@ -191,7 +192,7 @@ public final class ConfigKeys { */ public static final ConfigKey TEMPORARY_ADD_BEHAVIOUR = key(c -> { String value = c.getString("temporary-add-behaviour", "deny"); - switch (value.toLowerCase()) { + switch (value.toLowerCase(Locale.ROOT)) { case "accumulate": return TemporaryNodeMergeStrategy.ADD_NEW_DURATION_TO_EXISTING; case "replace": @@ -205,7 +206,7 @@ public final class ConfigKeys { * How primary groups should be calculated. */ public static final ConfigKey PRIMARY_GROUP_CALCULATION_METHOD = notReloadable(key(c -> { - String option = c.getString("primary-group-calculation", "stored").toLowerCase(); + String option = c.getString("primary-group-calculation", "stored").toLowerCase(Locale.ROOT); if (!option.equals("stored") && !option.equals("parents-by-weight") && !option.equals("all-parents-by-weight")) { option = "stored"; } @@ -318,7 +319,7 @@ public final class ConfigKeys { */ public static final ConfigKey INHERITANCE_TRAVERSAL_ALGORITHM = key(c -> { String value = c.getString("inheritance-traversal-algorithm", "depth-first-pre-order"); - switch (value.toLowerCase()) { + switch (value.toLowerCase(Locale.ROOT)) { case "breadth-first": return TraversalAlgorithm.BREADTH_FIRST; case "depth-first-post-order": @@ -355,7 +356,7 @@ public final class ConfigKeys { */ public static final ConfigKey> GROUP_WEIGHTS = key(c -> { return c.getStringMap("group-weight", ImmutableMap.of()).entrySet().stream().collect(ImmutableCollectors.toMap( - e -> e.getKey().toLowerCase(), + e -> e.getKey().toLowerCase(Locale.ROOT), e -> { try { return Integer.parseInt(e.getValue()); @@ -378,7 +379,7 @@ public final class ConfigKeys { String middleSpacer = l.getString("meta-formatting.prefix.middle-spacer", " "); String endSpacer = l.getString("meta-formatting.prefix.end-spacer", ""); DuplicateRemovalFunction duplicateRemovalFunction; - switch (l.getString("meta-formatting.prefix.duplicates", "").toLowerCase()) { + switch (l.getString("meta-formatting.prefix.duplicates", "").toLowerCase(Locale.ROOT)) { case "first-only": duplicateRemovalFunction = DuplicateRemovalFunction.FIRST_ONLY; break; @@ -405,7 +406,7 @@ public final class ConfigKeys { String middleSpacer = l.getString("meta-formatting.suffix.middle-spacer", " "); String endSpacer = l.getString("meta-formatting.suffix.end-spacer", ""); DuplicateRemovalFunction duplicateRemovalFunction; - switch (l.getString("meta-formatting.prefix.duplicates", "").toLowerCase()) { + switch (l.getString("meta-formatting.prefix.duplicates", "").toLowerCase(Locale.ROOT)) { case "first-only": duplicateRemovalFunction = DuplicateRemovalFunction.FIRST_ONLY; break; @@ -493,7 +494,7 @@ public final class ConfigKeys { public static final ConfigKey VAULT_SERVER = key(c -> { // default to true for backwards compatibility if (USE_VAULT_SERVER.get(c)) { - return c.getString("vault-server", "global").toLowerCase(); + return c.getString("vault-server", "global").toLowerCase(Locale.ROOT); } else { return SERVER.get(c); } @@ -520,8 +521,8 @@ public final class ConfigKeys { public static final ConfigKey WORLD_REWRITES = key(c -> { return WorldNameRewriter.of(c.getStringMap("world-rewrite", ImmutableMap.of()).entrySet().stream() .collect(ImmutableCollectors.toMap( - e -> e.getKey().toLowerCase(), - e -> e.getValue().toLowerCase() + e -> e.getKey().toLowerCase(Locale.ROOT), + e -> e.getValue().toLowerCase(Locale.ROOT) ))); }); diff --git a/common/src/main/java/me/lucko/luckperms/common/config/generic/key/ConfigKeyFactory.java b/common/src/main/java/me/lucko/luckperms/common/config/generic/key/ConfigKeyFactory.java index 58afb78b3..ac9a76773 100644 --- a/common/src/main/java/me/lucko/luckperms/common/config/generic/key/ConfigKeyFactory.java +++ b/common/src/main/java/me/lucko/luckperms/common/config/generic/key/ConfigKeyFactory.java @@ -29,6 +29,7 @@ import com.google.common.collect.ImmutableMap; import me.lucko.luckperms.common.config.generic.adapter.ConfigurationAdapter; +import java.util.Locale; import java.util.Map; import java.util.function.Function; @@ -36,7 +37,7 @@ public interface ConfigKeyFactory { ConfigKeyFactory BOOLEAN = ConfigurationAdapter::getBoolean; ConfigKeyFactory STRING = ConfigurationAdapter::getString; - ConfigKeyFactory LOWERCASE_STRING = (adapter, path, def) -> adapter.getString(path, def).toLowerCase(); + ConfigKeyFactory LOWERCASE_STRING = (adapter, path, def) -> adapter.getString(path, def).toLowerCase(Locale.ROOT); ConfigKeyFactory> STRING_MAP = (config, path, def) -> ImmutableMap.copyOf(config.getStringMap(path, ImmutableMap.of())); static SimpleConfigKey key(Function function) { diff --git a/common/src/main/java/me/lucko/luckperms/common/context/WorldNameRewriter.java b/common/src/main/java/me/lucko/luckperms/common/context/WorldNameRewriter.java index 148ee01d4..cc52ca597 100644 --- a/common/src/main/java/me/lucko/luckperms/common/context/WorldNameRewriter.java +++ b/common/src/main/java/me/lucko/luckperms/common/context/WorldNameRewriter.java @@ -32,6 +32,7 @@ import net.luckperms.api.context.ContextConsumer; import net.luckperms.api.context.DefaultContextKeys; import java.util.HashSet; +import java.util.Locale; import java.util.Map; import java.util.Set; @@ -69,7 +70,7 @@ public interface WorldNameRewriter { @Override public void rewriteAndSubmit(String worldName, ContextConsumer consumer) { Set seen = new HashSet<>(); - worldName = worldName.toLowerCase(); + worldName = worldName.toLowerCase(Locale.ROOT); while (Context.isValidValue(worldName) && seen.add(worldName)) { consumer.accept(DefaultContextKeys.WORLD_KEY, worldName); diff --git a/common/src/main/java/me/lucko/luckperms/common/context/contextset/AbstractContextSet.java b/common/src/main/java/me/lucko/luckperms/common/context/contextset/AbstractContextSet.java index 87388ce5e..b61c52e53 100644 --- a/common/src/main/java/me/lucko/luckperms/common/context/contextset/AbstractContextSet.java +++ b/common/src/main/java/me/lucko/luckperms/common/context/contextset/AbstractContextSet.java @@ -39,6 +39,7 @@ import org.checkerframework.checker.nullness.qual.NonNull; import java.util.Arrays; import java.util.Collection; import java.util.Iterator; +import java.util.Locale; import java.util.Objects; import java.util.Set; import java.util.Spliterator; @@ -127,7 +128,7 @@ public abstract class AbstractContextSet implements ContextSet { if (!Context.isValidKey(key)) { throw new IllegalArgumentException("key is (effectively) empty"); } - return key.toLowerCase(); + return key.toLowerCase(Locale.ROOT); } static String sanitizeValue(String value) { @@ -135,7 +136,7 @@ public abstract class AbstractContextSet implements ContextSet { if (!Context.isValidValue(value)) { throw new IllegalArgumentException("value is (effectively) empty"); } - return value.toLowerCase(); + return value.toLowerCase(Locale.ROOT); } public static boolean isGlobalServerWorldEntry(String key, String value) { diff --git a/common/src/main/java/me/lucko/luckperms/common/dependencies/Dependency.java b/common/src/main/java/me/lucko/luckperms/common/dependencies/Dependency.java index 9c26c5be5..9b21961c6 100644 --- a/common/src/main/java/me/lucko/luckperms/common/dependencies/Dependency.java +++ b/common/src/main/java/me/lucko/luckperms/common/dependencies/Dependency.java @@ -35,6 +35,7 @@ import java.security.NoSuchAlgorithmException; import java.util.Arrays; import java.util.Base64; import java.util.List; +import java.util.Locale; /** * The dependencies used by LuckPerms. @@ -314,7 +315,7 @@ public enum Dependency { } public String getFileName(String classifier) { - String name = name().toLowerCase().replace('_', '-'); + String name = name().toLowerCase(Locale.ROOT).replace('_', '-'); String extra = classifier == null || classifier.isEmpty() ? "" : "-" + classifier; diff --git a/common/src/main/java/me/lucko/luckperms/common/messaging/MessagingFactory.java b/common/src/main/java/me/lucko/luckperms/common/messaging/MessagingFactory.java index 8fa0d4f91..db92439e9 100644 --- a/common/src/main/java/me/lucko/luckperms/common/messaging/MessagingFactory.java +++ b/common/src/main/java/me/lucko/luckperms/common/messaging/MessagingFactory.java @@ -42,6 +42,8 @@ import net.luckperms.api.messenger.MessengerProvider; import org.checkerframework.checker.nullness.qual.NonNull; +import java.util.Locale; + public class MessagingFactory

{ private final P plugin; @@ -82,7 +84,7 @@ public class MessagingFactory

{ return null; } - this.plugin.getLogger().info("Loading messaging service... [" + messagingType.toUpperCase() + "]"); + this.plugin.getLogger().info("Loading messaging service... [" + messagingType.toUpperCase(Locale.ROOT) + "]"); InternalMessagingService service = getServiceFor(messagingType); if (service != null) { diff --git a/common/src/main/java/me/lucko/luckperms/common/metastacking/StandardStackElements.java b/common/src/main/java/me/lucko/luckperms/common/metastacking/StandardStackElements.java index 0c94af9cd..4f071abe7 100644 --- a/common/src/main/java/me/lucko/luckperms/common/metastacking/StandardStackElements.java +++ b/common/src/main/java/me/lucko/luckperms/common/metastacking/StandardStackElements.java @@ -39,6 +39,7 @@ import org.checkerframework.checker.nullness.qual.NonNull; import org.checkerframework.checker.nullness.qual.Nullable; import java.util.List; +import java.util.Locale; import java.util.Objects; /** @@ -48,7 +49,7 @@ public final class StandardStackElements { private StandardStackElements() {} public static MetaStackElement parseFromString(LuckPermsPlugin plugin, String s) { - s = s.toLowerCase(); + s = s.toLowerCase(Locale.ROOT); // static if (s.equals("highest")) return HIGHEST; diff --git a/common/src/main/java/me/lucko/luckperms/common/model/Group.java b/common/src/main/java/me/lucko/luckperms/common/model/Group.java index af1273472..2814b8d80 100644 --- a/common/src/main/java/me/lucko/luckperms/common/model/Group.java +++ b/common/src/main/java/me/lucko/luckperms/common/model/Group.java @@ -40,6 +40,7 @@ import net.luckperms.api.query.QueryOptions; import org.checkerframework.checker.nullness.qual.NonNull; +import java.util.Locale; import java.util.Optional; import java.util.OptionalInt; @@ -68,7 +69,7 @@ public class Group extends PermissionHolder { public Group(String name, LuckPermsPlugin plugin) { super(plugin); - this.name = name.toLowerCase(); + this.name = name.toLowerCase(Locale.ROOT); this.cachedData = new GroupCachedDataManager(this); getPlugin().getEventDispatcher().dispatchGroupCacheLoad(this, this.cachedData); diff --git a/common/src/main/java/me/lucko/luckperms/common/model/HolderType.java b/common/src/main/java/me/lucko/luckperms/common/model/HolderType.java index 21bf3f1d7..a46e85f7b 100644 --- a/common/src/main/java/me/lucko/luckperms/common/model/HolderType.java +++ b/common/src/main/java/me/lucko/luckperms/common/model/HolderType.java @@ -25,12 +25,14 @@ package me.lucko.luckperms.common.model; +import java.util.Locale; + public enum HolderType { USER, GROUP; @Override public String toString() { - return name().toLowerCase(); + return name().toLowerCase(Locale.ROOT); } } diff --git a/common/src/main/java/me/lucko/luckperms/common/model/PermissionHolder.java b/common/src/main/java/me/lucko/luckperms/common/model/PermissionHolder.java index 226771385..edd34ef30 100644 --- a/common/src/main/java/me/lucko/luckperms/common/model/PermissionHolder.java +++ b/common/src/main/java/me/lucko/luckperms/common/model/PermissionHolder.java @@ -63,6 +63,7 @@ import java.util.ArrayList; import java.util.Collection; import java.util.Comparator; import java.util.List; +import java.util.Locale; import java.util.Map; import java.util.OptionalInt; import java.util.SortedSet; @@ -363,7 +364,7 @@ public abstract class PermissionHolder { private static void processExportedPermissions(Map accumulator, List entries, boolean convertToLowercase, boolean resolveShorthand) { for (Node node : entries) { if (convertToLowercase) { - accumulator.putIfAbsent(node.getKey().toLowerCase(), node.getValue()); + accumulator.putIfAbsent(node.getKey().toLowerCase(Locale.ROOT), node.getValue()); } else { accumulator.putIfAbsent(node.getKey(), node.getValue()); } @@ -374,7 +375,7 @@ public abstract class PermissionHolder { Collection shorthand = node.resolveShorthand(); for (String s : shorthand) { if (convertToLowercase) { - accumulator.putIfAbsent(s.toLowerCase(), node.getValue()); + accumulator.putIfAbsent(s.toLowerCase(Locale.ROOT), node.getValue()); } else { accumulator.putIfAbsent(s, node.getValue()); } diff --git a/common/src/main/java/me/lucko/luckperms/common/model/PrimaryGroupHolder.java b/common/src/main/java/me/lucko/luckperms/common/model/PrimaryGroupHolder.java index 1a1dc7b1a..87ceef189 100644 --- a/common/src/main/java/me/lucko/luckperms/common/model/PrimaryGroupHolder.java +++ b/common/src/main/java/me/lucko/luckperms/common/model/PrimaryGroupHolder.java @@ -32,6 +32,7 @@ import net.luckperms.api.node.types.InheritanceNode; import net.luckperms.api.query.QueryOptions; import java.util.LinkedHashSet; +import java.util.Locale; import java.util.Objects; import java.util.Optional; import java.util.Set; @@ -90,7 +91,7 @@ public interface PrimaryGroupHolder { if (value == null || value.isEmpty()) { this.value = null; } else { - this.value = value.toLowerCase(); + this.value = value.toLowerCase(Locale.ROOT); } } } diff --git a/common/src/main/java/me/lucko/luckperms/common/model/WeightCache.java b/common/src/main/java/me/lucko/luckperms/common/model/WeightCache.java index c3231afef..48613caa5 100644 --- a/common/src/main/java/me/lucko/luckperms/common/model/WeightCache.java +++ b/common/src/main/java/me/lucko/luckperms/common/model/WeightCache.java @@ -34,6 +34,7 @@ import net.luckperms.api.node.types.WeightNode; import org.checkerframework.checker.nullness.qual.NonNull; +import java.util.Locale; import java.util.Map; import java.util.OptionalInt; @@ -62,7 +63,7 @@ public class WeightCache extends Cache { if (!seen) { Map configWeights = this.group.getPlugin().getConfiguration().get(ConfigKeys.GROUP_WEIGHTS); - Integer value = configWeights.get(this.group.getObjectName().toLowerCase()); + Integer value = configWeights.get(this.group.getObjectName().toLowerCase(Locale.ROOT)); if (value != null) { seen = true; weight = value; diff --git a/common/src/main/java/me/lucko/luckperms/common/model/manager/group/AbstractGroupManager.java b/common/src/main/java/me/lucko/luckperms/common/model/manager/group/AbstractGroupManager.java index b600e4cf6..623599f3d 100644 --- a/common/src/main/java/me/lucko/luckperms/common/model/manager/group/AbstractGroupManager.java +++ b/common/src/main/java/me/lucko/luckperms/common/model/manager/group/AbstractGroupManager.java @@ -28,6 +28,7 @@ package me.lucko.luckperms.common.model.manager.group; import me.lucko.luckperms.common.model.Group; import me.lucko.luckperms.common.model.manager.AbstractManager; +import java.util.Locale; import java.util.Optional; public abstract class AbstractGroupManager extends AbstractManager implements GroupManager { @@ -61,7 +62,7 @@ public abstract class AbstractGroupManager extends AbstractMana @Override protected String sanitizeIdentifier(String s) { - return s.toLowerCase(); + return s.toLowerCase(Locale.ROOT); } @Override diff --git a/common/src/main/java/me/lucko/luckperms/common/model/manager/track/AbstractTrackManager.java b/common/src/main/java/me/lucko/luckperms/common/model/manager/track/AbstractTrackManager.java index f6cff287f..22469e90e 100644 --- a/common/src/main/java/me/lucko/luckperms/common/model/manager/track/AbstractTrackManager.java +++ b/common/src/main/java/me/lucko/luckperms/common/model/manager/track/AbstractTrackManager.java @@ -28,10 +28,12 @@ package me.lucko.luckperms.common.model.manager.track; import me.lucko.luckperms.common.model.Track; import me.lucko.luckperms.common.model.manager.AbstractManager; +import java.util.Locale; + public abstract class AbstractTrackManager extends AbstractManager implements TrackManager { @Override protected String sanitizeIdentifier(String s) { - return s.toLowerCase(); + return s.toLowerCase(Locale.ROOT); } } diff --git a/common/src/main/java/me/lucko/luckperms/common/node/types/DisplayName.java b/common/src/main/java/me/lucko/luckperms/common/node/types/DisplayName.java index 221bd0efd..d09b026f6 100644 --- a/common/src/main/java/me/lucko/luckperms/common/node/types/DisplayName.java +++ b/common/src/main/java/me/lucko/luckperms/common/node/types/DisplayName.java @@ -35,6 +35,7 @@ import net.luckperms.api.node.types.DisplayNameNode; import org.checkerframework.checker.nullness.qual.NonNull; import org.checkerframework.checker.nullness.qual.Nullable; +import java.util.Locale; import java.util.Map; import java.util.Objects; @@ -72,7 +73,7 @@ public class DisplayName extends AbstractNode, Object> metadata) { super(key(groupName), value, expireAt, contexts, metadata); - this.groupName = groupName.toLowerCase(); + this.groupName = groupName.toLowerCase(Locale.ROOT); } @Override @@ -73,7 +74,7 @@ public class Inheritance extends AbstractNode implements Me private static final String NODE_MARKER = NODE_KEY + "."; public static String key(String key, String value) { - return NODE_MARKER + Delimiters.escapeCharacters(key).toLowerCase() + AbstractNode.NODE_SEPARATOR + Delimiters.escapeCharacters(value); + return NODE_MARKER + Delimiters.escapeCharacters(key).toLowerCase(Locale.ROOT) + AbstractNode.NODE_SEPARATOR + Delimiters.escapeCharacters(value); } public static Builder builder() { @@ -61,7 +62,7 @@ public class Meta extends AbstractNode implements Me public Meta(String metaKey, String metaValue, boolean value, long expireAt, ImmutableContextSet contexts, Map, Object> metadata) { super(key(metaKey, metaValue), value, expireAt, contexts, metadata); - this.metaKey = metaKey.toLowerCase(); + this.metaKey = metaKey.toLowerCase(Locale.ROOT); this.metaValue = metaValue; } @@ -81,7 +82,7 @@ public class Meta extends AbstractNode implements Me } public static @Nullable Builder parse(String key) { - if (!key.toLowerCase().startsWith(NODE_MARKER)) { + if (!key.toLowerCase(Locale.ROOT).startsWith(NODE_MARKER)) { return null; } diff --git a/common/src/main/java/me/lucko/luckperms/common/node/types/Prefix.java b/common/src/main/java/me/lucko/luckperms/common/node/types/Prefix.java index 1408466ff..d03905bd0 100644 --- a/common/src/main/java/me/lucko/luckperms/common/node/types/Prefix.java +++ b/common/src/main/java/me/lucko/luckperms/common/node/types/Prefix.java @@ -38,6 +38,7 @@ import org.checkerframework.checker.nullness.qual.NonNull; import org.checkerframework.checker.nullness.qual.Nullable; import java.util.Iterator; +import java.util.Locale; import java.util.Map; import java.util.Objects; @@ -87,7 +88,7 @@ public class Prefix extends AbstractNode impleme } public static @Nullable Builder parse(String key) { - if (!key.toLowerCase().startsWith(NODE_MARKER)) { + if (!key.toLowerCase(Locale.ROOT).startsWith(NODE_MARKER)) { return null; } diff --git a/common/src/main/java/me/lucko/luckperms/common/node/types/Suffix.java b/common/src/main/java/me/lucko/luckperms/common/node/types/Suffix.java index dd78fcd0e..b7774e8e9 100644 --- a/common/src/main/java/me/lucko/luckperms/common/node/types/Suffix.java +++ b/common/src/main/java/me/lucko/luckperms/common/node/types/Suffix.java @@ -38,6 +38,7 @@ import org.checkerframework.checker.nullness.qual.NonNull; import org.checkerframework.checker.nullness.qual.Nullable; import java.util.Iterator; +import java.util.Locale; import java.util.Map; import java.util.Objects; @@ -87,7 +88,7 @@ public class Suffix extends AbstractNode impleme } public static @Nullable Builder parse(String key) { - if (!key.toLowerCase().startsWith(NODE_MARKER)) { + if (!key.toLowerCase(Locale.ROOT).startsWith(NODE_MARKER)) { return null; } diff --git a/common/src/main/java/me/lucko/luckperms/common/node/types/Weight.java b/common/src/main/java/me/lucko/luckperms/common/node/types/Weight.java index 13773d56c..1b4bfb2d0 100644 --- a/common/src/main/java/me/lucko/luckperms/common/node/types/Weight.java +++ b/common/src/main/java/me/lucko/luckperms/common/node/types/Weight.java @@ -35,6 +35,7 @@ import net.luckperms.api.node.types.WeightNode; import org.checkerframework.checker.nullness.qual.NonNull; import org.checkerframework.checker.nullness.qual.Nullable; +import java.util.Locale; import java.util.Map; public class Weight extends AbstractNode implements WeightNode { @@ -71,7 +72,7 @@ public class Weight extends AbstractNode impleme } public static @Nullable Builder parse(String key) { - if (!key.toLowerCase().startsWith(NODE_MARKER)) { + if (!key.toLowerCase(Locale.ROOT).startsWith(NODE_MARKER)) { return null; } diff --git a/common/src/main/java/me/lucko/luckperms/common/node/utils/NodeJsonSerializer.java b/common/src/main/java/me/lucko/luckperms/common/node/utils/NodeJsonSerializer.java index cd98e6b2e..a75afada9 100644 --- a/common/src/main/java/me/lucko/luckperms/common/node/utils/NodeJsonSerializer.java +++ b/common/src/main/java/me/lucko/luckperms/common/node/utils/NodeJsonSerializer.java @@ -38,6 +38,7 @@ import net.luckperms.api.node.NodeBuilder; import java.time.Instant; import java.util.Collection; import java.util.HashSet; +import java.util.Locale; import java.util.Set; public class NodeJsonSerializer { @@ -51,7 +52,7 @@ public class NodeJsonSerializer { for (Node node : nodes) { JsonObject attributes = new JsonObject(); - attributes.addProperty("type", node.getType().name().toLowerCase()); + attributes.addProperty("type", node.getType().name().toLowerCase(Locale.ROOT)); attributes.addProperty("key", node.getKey()); attributes.addProperty("value", node.getValue()); diff --git a/common/src/main/java/me/lucko/luckperms/common/plugin/AbstractLuckPermsPlugin.java b/common/src/main/java/me/lucko/luckperms/common/plugin/AbstractLuckPermsPlugin.java index 2ff3dc68d..aa1eedca3 100644 --- a/common/src/main/java/me/lucko/luckperms/common/plugin/AbstractLuckPermsPlugin.java +++ b/common/src/main/java/me/lucko/luckperms/common/plugin/AbstractLuckPermsPlugin.java @@ -71,6 +71,7 @@ import java.time.Instant; import java.time.LocalDate; import java.time.Month; import java.util.EnumSet; +import java.util.Locale; import java.util.Optional; import java.util.Set; import java.util.UUID; @@ -336,7 +337,7 @@ public abstract class AbstractLuckPermsPlugin implements LuckPermsPlugin { @Override public Optional lookupUniqueId(String username) { // get a result from the DB cache - UUID uniqueId = getStorage().getPlayerUniqueId(username.toLowerCase()).join(); + UUID uniqueId = getStorage().getPlayerUniqueId(username.toLowerCase(Locale.ROOT)).join(); // fire the event uniqueId = getEventDispatcher().dispatchUniqueIdLookup(username, uniqueId); diff --git a/common/src/main/java/me/lucko/luckperms/common/storage/Storage.java b/common/src/main/java/me/lucko/luckperms/common/storage/Storage.java index 9cfacbb89..ee4d05c74 100644 --- a/common/src/main/java/me/lucko/luckperms/common/storage/Storage.java +++ b/common/src/main/java/me/lucko/luckperms/common/storage/Storage.java @@ -49,6 +49,7 @@ import net.luckperms.api.node.Node; import java.util.Collection; import java.util.Collections; import java.util.List; +import java.util.Locale; import java.util.Map; import java.util.Optional; import java.util.Set; @@ -171,7 +172,7 @@ public class Storage { public CompletableFuture createAndLoadGroup(String name, CreationCause cause) { return future(() -> { - Group group = this.implementation.createAndLoadGroup(name.toLowerCase()); + Group group = this.implementation.createAndLoadGroup(name.toLowerCase(Locale.ROOT)); if (group != null) { this.plugin.getEventDispatcher().dispatchGroupCreate(group, cause); } @@ -181,7 +182,7 @@ public class Storage { public CompletableFuture> loadGroup(String name) { return future(() -> { - Optional group = this.implementation.loadGroup(name.toLowerCase()); + Optional group = this.implementation.loadGroup(name.toLowerCase(Locale.ROOT)); if (group.isPresent()) { this.plugin.getEventDispatcher().dispatchGroupLoad(group.get()); } @@ -217,7 +218,7 @@ public class Storage { public CompletableFuture createAndLoadTrack(String name, CreationCause cause) { return future(() -> { - Track track = this.implementation.createAndLoadTrack(name.toLowerCase()); + Track track = this.implementation.createAndLoadTrack(name.toLowerCase(Locale.ROOT)); if (track != null) { this.plugin.getEventDispatcher().dispatchTrackCreate(track, cause); } @@ -227,7 +228,7 @@ public class Storage { public CompletableFuture> loadTrack(String name) { return future(() -> { - Optional track = this.implementation.loadTrack(name.toLowerCase()); + Optional track = this.implementation.loadTrack(name.toLowerCase(Locale.ROOT)); if (track.isPresent()) { this.plugin.getEventDispatcher().dispatchTrackLoad(track.get()); } diff --git a/common/src/main/java/me/lucko/luckperms/common/storage/implementation/file/FileUuidCache.java b/common/src/main/java/me/lucko/luckperms/common/storage/implementation/file/FileUuidCache.java index e05734753..c6d8497a9 100644 --- a/common/src/main/java/me/lucko/luckperms/common/storage/implementation/file/FileUuidCache.java +++ b/common/src/main/java/me/lucko/luckperms/common/storage/implementation/file/FileUuidCache.java @@ -46,6 +46,7 @@ import java.nio.file.Files; import java.nio.file.Path; import java.util.HashSet; import java.util.Iterator; +import java.util.Locale; import java.util.Map; import java.util.Set; import java.util.UUID; @@ -200,11 +201,11 @@ public class FileUuidCache { // existing might be null if (!value.equalsIgnoreCase(existing)) { if (existing != null) { - this.reverse.remove(existing.toLowerCase(), key); + this.reverse.remove(existing.toLowerCase(Locale.ROOT), key); } } - this.reverse.put(value.toLowerCase(), key); + this.reverse.put(value.toLowerCase(Locale.ROOT), key); return existing; } @@ -213,7 +214,7 @@ public class FileUuidCache { UUID key = (UUID) k; String username = super.remove(key); if (username != null) { - this.reverse.remove(username.toLowerCase(), key); + this.reverse.remove(username.toLowerCase(Locale.ROOT), key); } return username; } @@ -223,7 +224,7 @@ public class FileUuidCache { } public Set lookupUuid(String name) { - return this.reverse.get(name.toLowerCase()); + return this.reverse.get(name.toLowerCase(Locale.ROOT)); } } diff --git a/common/src/main/java/me/lucko/luckperms/common/storage/implementation/mongodb/MongoStorage.java b/common/src/main/java/me/lucko/luckperms/common/storage/implementation/mongodb/MongoStorage.java index 05ac6a757..79e9bb0eb 100644 --- a/common/src/main/java/me/lucko/luckperms/common/storage/implementation/mongodb/MongoStorage.java +++ b/common/src/main/java/me/lucko/luckperms/common/storage/implementation/mongodb/MongoStorage.java @@ -75,6 +75,7 @@ import java.util.Collections; import java.util.HashSet; import java.util.LinkedHashMap; import java.util.List; +import java.util.Locale; import java.util.Map; import java.util.Optional; import java.util.Set; @@ -521,7 +522,7 @@ public class MongoStorage implements StorageImplementation { @Override public PlayerSaveResult savePlayerData(UUID uniqueId, String username) { - username = username.toLowerCase(); + username = username.toLowerCase(Locale.ROOT); MongoCollection c = this.database.getCollection(this.prefix + "uuid"); // find any existing mapping @@ -560,7 +561,7 @@ public class MongoStorage implements StorageImplementation { @Override public UUID getPlayerUniqueId(String username) { MongoCollection c = this.database.getCollection(this.prefix + "uuid"); - Document doc = c.find(new Document("name", username.toLowerCase())).first(); + Document doc = c.find(new Document("name", username.toLowerCase(Locale.ROOT))).first(); if (doc != null) { return getDocumentId(doc); } diff --git a/common/src/main/java/me/lucko/luckperms/common/storage/implementation/split/SplitStorage.java b/common/src/main/java/me/lucko/luckperms/common/storage/implementation/split/SplitStorage.java index 06aa16294..81c16779d 100644 --- a/common/src/main/java/me/lucko/luckperms/common/storage/implementation/split/SplitStorage.java +++ b/common/src/main/java/me/lucko/luckperms/common/storage/implementation/split/SplitStorage.java @@ -46,6 +46,7 @@ import net.luckperms.api.node.Node; import java.util.LinkedHashMap; import java.util.List; +import java.util.Locale; import java.util.Map; import java.util.Optional; import java.util.Set; @@ -114,7 +115,7 @@ public class SplitStorage implements StorageImplementation { meta.put( Component.translatable("luckperms.command.info.storage.meta.split-types-key"), Message.formatStringList(this.types.entrySet().stream() - .map(e -> e.getKey().toString().toLowerCase() + "->" + e.getValue().getName().toLowerCase()) + .map(e -> e.getKey().toString().toLowerCase(Locale.ROOT) + "->" + e.getValue().getName().toLowerCase(Locale.ROOT)) .collect(Collectors.toList())) ); for (StorageImplementation backing : this.implementations.values()) { diff --git a/common/src/main/java/me/lucko/luckperms/common/storage/implementation/sql/SqlStorage.java b/common/src/main/java/me/lucko/luckperms/common/storage/implementation/sql/SqlStorage.java index e9bd93bbb..d1a4e60db 100644 --- a/common/src/main/java/me/lucko/luckperms/common/storage/implementation/sql/SqlStorage.java +++ b/common/src/main/java/me/lucko/luckperms/common/storage/implementation/sql/SqlStorage.java @@ -72,6 +72,7 @@ import java.util.Collection; import java.util.HashMap; import java.util.HashSet; import java.util.List; +import java.util.Locale; import java.util.Map; import java.util.Optional; import java.util.Set; @@ -173,7 +174,7 @@ public class SqlStorage implements StorageImplementation { private void applySchema() throws IOException, SQLException { List statements; - String schemaFileName = "me/lucko/luckperms/schema/" + this.connectionFactory.getImplementationName().toLowerCase() + ".sql"; + String schemaFileName = "me/lucko/luckperms/schema/" + this.connectionFactory.getImplementationName().toLowerCase(Locale.ROOT) + ".sql"; try (InputStream is = this.plugin.getBootstrap().getResourceStream(schemaFileName)) { if (is == null) { throw new IOException("Couldn't locate schema file for " + this.connectionFactory.getImplementationName()); @@ -375,7 +376,7 @@ public class SqlStorage implements StorageImplementation { updateUserPermissions(c, user.getUniqueId(), changes.getAdded(), changes.getRemoved()); insertPlayerData(c, user.getUniqueId(), new SqlPlayerData( user.getPrimaryGroup().getStoredValue().orElse(GroupManager.DEFAULT_GROUP_NAME), - user.getUsername().orElse("null").toLowerCase() + user.getUsername().orElse("null").toLowerCase(Locale.ROOT) )); } } @@ -605,7 +606,7 @@ public class SqlStorage implements StorageImplementation { @Override public PlayerSaveResult savePlayerData(UUID uniqueId, String username) throws SQLException { - username = username.toLowerCase(); + username = username.toLowerCase(Locale.ROOT); // find any existing mapping String oldUsername = getPlayerName(uniqueId); @@ -672,7 +673,7 @@ public class SqlStorage implements StorageImplementation { @Override public UUID getPlayerUniqueId(String username) throws SQLException { - username = username.toLowerCase(); + username = username.toLowerCase(Locale.ROOT); try (Connection c = this.connectionFactory.getConnection()) { try (PreparedStatement ps = c.prepareStatement(this.statementProcessor.apply(PLAYER_SELECT_UUID_BY_USERNAME))) { ps.setString(1, username); @@ -907,7 +908,7 @@ public class SqlStorage implements StorageImplementation { try (PreparedStatement ps = c.prepareStatement(this.statementProcessor.apply(GROUP_SELECT_ALL))) { try (ResultSet rs = ps.executeQuery()) { while (rs.next()) { - groups.add(rs.getString("name").toLowerCase()); + groups.add(rs.getString("name").toLowerCase(Locale.ROOT)); } } } @@ -992,7 +993,7 @@ public class SqlStorage implements StorageImplementation { try (PreparedStatement ps = c.prepareStatement(this.statementProcessor.apply(TRACK_SELECT_ALL))) { try (ResultSet rs = ps.executeQuery()) { while (rs.next()) { - tracks.add(rs.getString("name").toLowerCase()); + tracks.add(rs.getString("name").toLowerCase(Locale.ROOT)); } } } diff --git a/common/src/main/java/me/lucko/luckperms/common/treeview/PermissionRegistry.java b/common/src/main/java/me/lucko/luckperms/common/treeview/PermissionRegistry.java index e02c14448..9d2aba13e 100644 --- a/common/src/main/java/me/lucko/luckperms/common/treeview/PermissionRegistry.java +++ b/common/src/main/java/me/lucko/luckperms/common/treeview/PermissionRegistry.java @@ -32,6 +32,7 @@ import me.lucko.luckperms.common.plugin.scheduler.SchedulerTask; import me.lucko.luckperms.common.util.ImmutableCollectors; import java.util.List; +import java.util.Locale; import java.util.Map; import java.util.Queue; import java.util.concurrent.ConcurrentLinkedQueue; @@ -93,7 +94,7 @@ public class PermissionRegistry implements AutoCloseable { } private void doInsert(String permission) { - permission = permission.toLowerCase(); + permission = permission.toLowerCase(Locale.ROOT); // split the permission up into parts Iterable parts = DOT_SPLIT.split(permission); diff --git a/common/src/main/java/me/lucko/luckperms/common/treeview/TreeView.java b/common/src/main/java/me/lucko/luckperms/common/treeview/TreeView.java index a015e5920..ee2feaa69 100644 --- a/common/src/main/java/me/lucko/luckperms/common/treeview/TreeView.java +++ b/common/src/main/java/me/lucko/luckperms/common/treeview/TreeView.java @@ -46,6 +46,7 @@ import java.nio.charset.StandardCharsets; import java.text.SimpleDateFormat; import java.util.Date; import java.util.List; +import java.util.Locale; import java.util.Map; import java.util.Optional; import java.util.zip.GZIPOutputStream; @@ -160,7 +161,7 @@ public class TreeView { checks = new JObject(); for (Map.Entry node : this.view.getNodeEndings()) { String permission = prefix + node.getValue(); - checks.add(permission, checker.checkPermission(permission, PermissionCheckEvent.Origin.INTERNAL).result().name().toLowerCase()); + checks.add(permission, checker.checkPermission(permission, PermissionCheckEvent.Origin.INTERNAL).result().name().toLowerCase(Locale.ROOT)); } } else { checks = null; diff --git a/common/src/main/java/me/lucko/luckperms/common/util/DurationFormatter.java b/common/src/main/java/me/lucko/luckperms/common/util/DurationFormatter.java index 0e90e881e..c5d624cdf 100644 --- a/common/src/main/java/me/lucko/luckperms/common/util/DurationFormatter.java +++ b/common/src/main/java/me/lucko/luckperms/common/util/DurationFormatter.java @@ -34,6 +34,7 @@ import net.kyori.adventure.text.serializer.plain.PlainComponentSerializer; import java.time.Duration; import java.time.temporal.ChronoUnit; +import java.util.Locale; /** * Formats durations to a readable form @@ -115,7 +116,7 @@ public class DurationFormatter { private TranslatableComponent formatPart(long amount, ChronoUnit unit) { String format = this.concise ? "short" : amount == 1 ? "singular" : "plural"; - String translationKey = "luckperms.duration.unit." + unit.name().toLowerCase() + "." + format; + String translationKey = "luckperms.duration.unit." + unit.name().toLowerCase(Locale.ROOT) + "." + format; return Component.translatable(translationKey, Component.text(amount)); } diff --git a/common/src/main/java/me/lucko/luckperms/common/util/EnumNamer.java b/common/src/main/java/me/lucko/luckperms/common/util/EnumNamer.java index 586b62326..13465f6c2 100644 --- a/common/src/main/java/me/lucko/luckperms/common/util/EnumNamer.java +++ b/common/src/main/java/me/lucko/luckperms/common/util/EnumNamer.java @@ -26,6 +26,7 @@ package me.lucko.luckperms.common.util; import java.util.Collections; +import java.util.Locale; import java.util.Map; import java.util.function.Function; @@ -35,7 +36,7 @@ import java.util.function.Function; * @param the enum type */ public class EnumNamer> { - public static final Function, String> LOWER_CASE_NAME = value -> value.name().toLowerCase(); + public static final Function, String> LOWER_CASE_NAME = value -> value.name().toLowerCase(Locale.ROOT); private final String[] names; private final Function namingFunction; diff --git a/common/src/main/java/me/lucko/luckperms/common/verbose/event/MetaCheckEvent.java b/common/src/main/java/me/lucko/luckperms/common/verbose/event/MetaCheckEvent.java index 6c74b70ae..bcfa2114a 100644 --- a/common/src/main/java/me/lucko/luckperms/common/verbose/event/MetaCheckEvent.java +++ b/common/src/main/java/me/lucko/luckperms/common/verbose/event/MetaCheckEvent.java @@ -30,6 +30,8 @@ import me.lucko.luckperms.common.verbose.VerboseCheckTarget; import net.luckperms.api.query.QueryOptions; +import java.util.Locale; + public class MetaCheckEvent extends VerboseEvent { /** @@ -71,14 +73,14 @@ public class MetaCheckEvent extends VerboseEvent { object.add("type", "meta") .add("key", this.key) .add("result", this.result) - .add("origin", this.origin.name().toLowerCase()); + .add("origin", this.origin.name().toLowerCase(Locale.ROOT)); } @Override public boolean eval(String variable) { return variable.equals("meta") || getCheckTarget().describe().equalsIgnoreCase(variable) || - getKey().toLowerCase().startsWith(variable.toLowerCase()) || + getKey().toLowerCase(Locale.ROOT).startsWith(variable.toLowerCase(Locale.ROOT)) || getResult().equalsIgnoreCase(variable); } diff --git a/common/src/main/java/me/lucko/luckperms/common/verbose/event/PermissionCheckEvent.java b/common/src/main/java/me/lucko/luckperms/common/verbose/event/PermissionCheckEvent.java index 48b200ab9..a646aa079 100644 --- a/common/src/main/java/me/lucko/luckperms/common/verbose/event/PermissionCheckEvent.java +++ b/common/src/main/java/me/lucko/luckperms/common/verbose/event/PermissionCheckEvent.java @@ -31,6 +31,8 @@ import me.lucko.luckperms.common.verbose.VerboseCheckTarget; import net.luckperms.api.query.QueryOptions; +import java.util.Locale; + public class PermissionCheckEvent extends VerboseEvent { /** @@ -72,7 +74,7 @@ public class PermissionCheckEvent extends VerboseEvent { object.add("type", "permission"); object.add("permission", this.permission); - object.add("result", this.result.result().name().toLowerCase()); + object.add("result", this.result.result().name().toLowerCase(Locale.ROOT)); if (this.result.processorClass() != null || this.result.cause() != null) { JObject resultInfo = new JObject(); if (this.result.processorClass() != null) { @@ -84,14 +86,14 @@ public class PermissionCheckEvent extends VerboseEvent { object.add("resultInfo", resultInfo); } - object.add("origin", this.origin.name().toLowerCase()); + object.add("origin", this.origin.name().toLowerCase(Locale.ROOT)); } @Override public boolean eval(String variable) { return variable.equals("permission") || getCheckTarget().describe().equalsIgnoreCase(variable) || - getPermission().toLowerCase().startsWith(variable.toLowerCase()) || + getPermission().toLowerCase(Locale.ROOT).startsWith(variable.toLowerCase(Locale.ROOT)) || getResult().result().name().equalsIgnoreCase(variable); } diff --git a/common/src/main/java/me/lucko/luckperms/common/verbose/event/VerboseEvent.java b/common/src/main/java/me/lucko/luckperms/common/verbose/event/VerboseEvent.java index aff8d66a8..577d1fab0 100644 --- a/common/src/main/java/me/lucko/luckperms/common/verbose/event/VerboseEvent.java +++ b/common/src/main/java/me/lucko/luckperms/common/verbose/event/VerboseEvent.java @@ -37,6 +37,7 @@ import net.luckperms.api.context.Context; import net.luckperms.api.query.QueryMode; import net.luckperms.api.query.QueryOptions; +import java.util.Locale; import java.util.Objects; import java.util.UUID; @@ -113,7 +114,7 @@ public abstract class VerboseEvent implements VariableEvaluator { } }) ) - .add("queryMode", this.checkQueryOptions.mode().name().toLowerCase()) + .add("queryMode", this.checkQueryOptions.mode().name().toLowerCase(Locale.ROOT)) .consume(obj -> { if (this.checkQueryOptions.mode() == QueryMode.CONTEXTUAL) { obj.add("context", new JArray() diff --git a/common/src/test/java/me/lucko/luckperms/common/util/EnumNamerTest.java b/common/src/test/java/me/lucko/luckperms/common/util/EnumNamerTest.java index e3c517ce5..d2d36e327 100644 --- a/common/src/test/java/me/lucko/luckperms/common/util/EnumNamerTest.java +++ b/common/src/test/java/me/lucko/luckperms/common/util/EnumNamerTest.java @@ -29,6 +29,8 @@ import com.google.common.collect.ImmutableMap; import org.junit.jupiter.api.Test; +import java.util.Locale; + import static org.junit.jupiter.api.Assertions.assertEquals; public class EnumNamerTest { @@ -38,7 +40,7 @@ public class EnumNamerTest { EnumNamer namer = new EnumNamer<>( TestEnum.class, ImmutableMap.of(TestEnum.THING, "hi"), - v -> v.name().toLowerCase().replace('_', '-') + v -> v.name().toLowerCase(Locale.ROOT).replace('_', '-') ); assertEquals("test", namer.name(TestEnum.TEST)); diff --git a/nukkit/src/main/java/me/lucko/luckperms/nukkit/context/NukkitPlayerCalculator.java b/nukkit/src/main/java/me/lucko/luckperms/nukkit/context/NukkitPlayerCalculator.java index c55e65626..a31fab60b 100644 --- a/nukkit/src/main/java/me/lucko/luckperms/nukkit/context/NukkitPlayerCalculator.java +++ b/nukkit/src/main/java/me/lucko/luckperms/nukkit/context/NukkitPlayerCalculator.java @@ -47,6 +47,7 @@ import cn.nukkit.event.entity.EntityLevelChangeEvent; import cn.nukkit.event.player.PlayerGameModeChangeEvent; import cn.nukkit.level.Level; +import java.util.Locale; import java.util.Set; public class NukkitPlayerCalculator implements ContextCalculator, Listener { @@ -111,7 +112,7 @@ public class NukkitPlayerCalculator implements ContextCalculator, Listen case Player.CREATIVE: return "creative"; case Player.ADVENTURE: return "adventure"; case Player.SPECTATOR: return "spectator"; - default: return Server.getGamemodeString(mode, true).toLowerCase(); + default: return Server.getGamemodeString(mode, true).toLowerCase(Locale.ROOT); } } diff --git a/nukkit/src/main/java/me/lucko/luckperms/nukkit/inject/PermissionDefault.java b/nukkit/src/main/java/me/lucko/luckperms/nukkit/inject/PermissionDefault.java index da0a42d49..b1180d658 100644 --- a/nukkit/src/main/java/me/lucko/luckperms/nukkit/inject/PermissionDefault.java +++ b/nukkit/src/main/java/me/lucko/luckperms/nukkit/inject/PermissionDefault.java @@ -30,6 +30,7 @@ import org.checkerframework.checker.nullness.qual.Nullable; import cn.nukkit.permission.Permission; import java.util.HashMap; +import java.util.Locale; import java.util.Map; /** @@ -84,7 +85,7 @@ public enum PermissionDefault { * @return Specified value, or null if not found */ public static @Nullable PermissionDefault getByName(String name) { - return LOOKUP.get(name.toLowerCase().replaceAll("[^a-z!]", "")); + return LOOKUP.get(name.toLowerCase(Locale.ROOT).replaceAll("[^a-z!]", "")); } public static @Nullable PermissionDefault fromPermission(@Nullable Permission permission) { diff --git a/nukkit/src/main/java/me/lucko/luckperms/nukkit/inject/permissible/LuckPermsPermissionAttachment.java b/nukkit/src/main/java/me/lucko/luckperms/nukkit/inject/permissible/LuckPermsPermissionAttachment.java index 36e44ed42..811edef3f 100644 --- a/nukkit/src/main/java/me/lucko/luckperms/nukkit/inject/permissible/LuckPermsPermissionAttachment.java +++ b/nukkit/src/main/java/me/lucko/luckperms/nukkit/inject/permissible/LuckPermsPermissionAttachment.java @@ -47,6 +47,7 @@ import java.util.Collection; import java.util.Collections; import java.util.HashMap; import java.util.List; +import java.util.Locale; import java.util.Map; import java.util.Objects; import java.util.Set; @@ -238,7 +239,7 @@ public class LuckPermsPermissionAttachment extends PermissionAttachment { Objects.requireNonNull(name, "name is null"); Preconditions.checkArgument(!name.isEmpty(), "name is empty"); - String permission = name.toLowerCase(); + String permission = name.toLowerCase(Locale.ROOT); Boolean previous = this.perms.put(permission, value); if (previous != null && previous == value) { @@ -275,7 +276,7 @@ public class LuckPermsPermissionAttachment extends PermissionAttachment { Objects.requireNonNull(name, "name is null"); Preconditions.checkArgument(!name.isEmpty(), "name is empty"); - String permission = name.toLowerCase(); + String permission = name.toLowerCase(Locale.ROOT); Boolean previous = this.perms.remove(permission); if (previous == null) { diff --git a/nukkit/src/main/java/me/lucko/luckperms/nukkit/inject/server/LuckPermsDefaultsMap.java b/nukkit/src/main/java/me/lucko/luckperms/nukkit/inject/server/LuckPermsDefaultsMap.java index 5ca5af244..a632cb8b3 100644 --- a/nukkit/src/main/java/me/lucko/luckperms/nukkit/inject/server/LuckPermsDefaultsMap.java +++ b/nukkit/src/main/java/me/lucko/luckperms/nukkit/inject/server/LuckPermsDefaultsMap.java @@ -40,6 +40,7 @@ import cn.nukkit.plugin.PluginManager; import java.util.Collections; import java.util.HashMap; +import java.util.Locale; import java.util.Map; import java.util.concurrent.ConcurrentHashMap; @@ -159,7 +160,7 @@ public final class LuckPermsDefaultsMap { protected @NonNull Map supply() { Map builder = new HashMap<>(); for (Permission perm : LuckPermsDefaultsMap.this.get(this.op).values()) { - String name = perm.getName().toLowerCase(); + String name = perm.getName().toLowerCase(Locale.ROOT); builder.put(name, true); for (Map.Entry child : LuckPermsDefaultsMap.this.plugin.getPermissionMap().getChildPermissions(name, true).entrySet()) { builder.putIfAbsent(child.getKey(), child.getValue()); diff --git a/nukkit/src/main/java/me/lucko/luckperms/nukkit/inject/server/LuckPermsPermissionMap.java b/nukkit/src/main/java/me/lucko/luckperms/nukkit/inject/server/LuckPermsPermissionMap.java index 316158a3b..10ca83e72 100644 --- a/nukkit/src/main/java/me/lucko/luckperms/nukkit/inject/server/LuckPermsPermissionMap.java +++ b/nukkit/src/main/java/me/lucko/luckperms/nukkit/inject/server/LuckPermsPermissionMap.java @@ -41,6 +41,7 @@ import cn.nukkit.plugin.PluginManager; import java.lang.reflect.Field; import java.util.Collections; import java.util.HashMap; +import java.util.Locale; import java.util.Map; import java.util.Objects; import java.util.concurrent.ConcurrentHashMap; @@ -180,7 +181,7 @@ public final class LuckPermsPermissionMap extends ForwardingMap getCollection(String s) { - return Optional.ofNullable(this.handle.getLoadedCollections().get(s.toLowerCase())).map(LPSubjectCollection::sponge); + return Optional.ofNullable(this.handle.getLoadedCollections().get(s.toLowerCase(Locale.ROOT))).map(LPSubjectCollection::sponge); } @Override public CompletableFuture hasCollection(String s) { - return CompletableFuture.completedFuture(this.handle.getLoadedCollections().containsKey(s.toLowerCase())); + return CompletableFuture.completedFuture(this.handle.getLoadedCollections().containsKey(s.toLowerCase(Locale.ROOT))); } @Override @@ -113,7 +114,7 @@ public final class PermissionServiceProxy implements PermissionService, ProxiedS Objects.requireNonNull(subjectIdentifier, "subjectIdentifier"); // test the identifiers - String collection = collectionIdentifier.toLowerCase(); + String collection = collectionIdentifier.toLowerCase(Locale.ROOT); if (collection.equals("user") && !this.handle.getUserSubjects().getIdentifierValidityPredicate().test(subjectIdentifier)) { throw new IllegalArgumentException("Subject identifier '" + subjectIdentifier + "' does not pass the validity predicate for the user subject collection"); } else if (collection.equals("group") && !this.handle.getGroupSubjects().getIdentifierValidityPredicate().test(subjectIdentifier)) { diff --git a/sponge/sponge-service/src/main/java/me/lucko/luckperms/sponge/service/reference/SubjectReferenceFactory.java b/sponge/sponge-service/src/main/java/me/lucko/luckperms/sponge/service/reference/SubjectReferenceFactory.java index a57d32c29..87566a65c 100644 --- a/sponge/sponge-service/src/main/java/me/lucko/luckperms/sponge/service/reference/SubjectReferenceFactory.java +++ b/sponge/sponge-service/src/main/java/me/lucko/luckperms/sponge/service/reference/SubjectReferenceFactory.java @@ -38,6 +38,7 @@ import org.spongepowered.api.service.permission.Subject; import org.spongepowered.api.service.permission.SubjectReference; import java.util.List; +import java.util.Locale; import java.util.Objects; import java.util.concurrent.TimeUnit; @@ -116,8 +117,8 @@ public final class SubjectReferenceFactory { private final int hashCode; private SubjectReferenceAttributes(String collectionId, String id) { - this.collectionId = collectionId.toLowerCase(); - this.id = id.toLowerCase(); + this.collectionId = collectionId.toLowerCase(Locale.ROOT); + this.id = id.toLowerCase(Locale.ROOT); this.hashCode = calculateHashCode(); } diff --git a/sponge/src/main/java/me/lucko/luckperms/sponge/commands/PermissionSet.java b/sponge/src/main/java/me/lucko/luckperms/sponge/commands/PermissionSet.java index 2a559ac5d..9dc9e00a3 100644 --- a/sponge/src/main/java/me/lucko/luckperms/sponge/commands/PermissionSet.java +++ b/sponge/src/main/java/me/lucko/luckperms/sponge/commands/PermissionSet.java @@ -38,6 +38,8 @@ import me.lucko.luckperms.sponge.service.model.LPSubjectData; import net.luckperms.api.context.ImmutableContextSet; import net.luckperms.api.util.Tristate; +import java.util.Locale; + public class PermissionSet extends ChildCommand { public PermissionSet() { super(CommandSpec.SPONGE_PERMISSION_SET, "set", CommandPermission.SPONGE_PERMISSION_SET, Predicates.inRange(0, 1)); @@ -50,7 +52,7 @@ public class PermissionSet extends ChildCommand { ImmutableContextSet contextSet = args.getContextOrEmpty(2); if (subjectData.setPermission(contextSet, node, tristate).join()) { - SpongeCommandUtils.sendPrefixed(sender, "&aSet &b" + node + "&a to &b" + tristate.toString().toLowerCase() + "&a in context " + SpongeCommandUtils.contextToString(contextSet)); + SpongeCommandUtils.sendPrefixed(sender, "&aSet &b" + node + "&a to &b" + tristate.toString().toLowerCase(Locale.ROOT) + "&a in context " + SpongeCommandUtils.contextToString(contextSet)); } else { SpongeCommandUtils.sendPrefixed(sender, "Unable to set permission. Does the Subject already have it set?"); } diff --git a/sponge/src/main/java/me/lucko/luckperms/sponge/commands/SpongeCommandUtils.java b/sponge/src/main/java/me/lucko/luckperms/sponge/commands/SpongeCommandUtils.java index 501829e7b..e976b518d 100644 --- a/sponge/src/main/java/me/lucko/luckperms/sponge/commands/SpongeCommandUtils.java +++ b/sponge/src/main/java/me/lucko/luckperms/sponge/commands/SpongeCommandUtils.java @@ -36,6 +36,7 @@ import net.luckperms.api.context.ContextSet; import net.luckperms.api.util.Tristate; import java.util.Collection; +import java.util.Locale; import java.util.Map; public final class SpongeCommandUtils { @@ -46,7 +47,7 @@ public final class SpongeCommandUtils { } public static Tristate parseTristate(int index, ArgumentList args) throws ArgumentException { - String s = args.get(index).toLowerCase(); + String s = args.get(index).toLowerCase(Locale.ROOT); switch (s) { case "1": case "true": diff --git a/sponge/src/main/java/me/lucko/luckperms/sponge/commands/SpongeParentCommand.java b/sponge/src/main/java/me/lucko/luckperms/sponge/commands/SpongeParentCommand.java index fd9eff857..3eaf93df1 100644 --- a/sponge/src/main/java/me/lucko/luckperms/sponge/commands/SpongeParentCommand.java +++ b/sponge/src/main/java/me/lucko/luckperms/sponge/commands/SpongeParentCommand.java @@ -45,6 +45,7 @@ import me.lucko.luckperms.sponge.service.model.LPSubjectData; import java.util.Arrays; import java.util.List; +import java.util.Locale; import java.util.Map; import java.util.stream.Collectors; @@ -131,12 +132,12 @@ public class SpongeParentCommand extends Command { } boolean persistent = true; - if (args.get(2).toLowerCase().startsWith("-t")) { + if (args.get(2).toLowerCase(Locale.ROOT).startsWith("-t")) { persistent = false; args.remove(2); } - String type = args.get(2).toLowerCase(); + String type = args.get(2).toLowerCase(Locale.ROOT); if (!type.equals("permission") && !type.equals("parent") && !type.equals("option")) { sendDetailedUsage(sender, label); return; @@ -187,7 +188,7 @@ public class SpongeParentCommand extends Command { public void sendDetailedUsage(Sender sender, String label) { SpongeCommandUtils.sendPrefixed(sender, "&b" + getName() + " Sub Commands: &7(" + String.format("/%s sponge [-transient]", label) + " ...)"); for (String s : Arrays.asList("Permission", "Parent", "Option")) { - List> subs = this.children.get(s.toLowerCase()).stream() + List> subs = this.children.get(s.toLowerCase(Locale.ROOT)).stream() .filter(sub -> sub.isAuthorized(sender)) .collect(Collectors.toList()); diff --git a/sponge/src/main/java/me/lucko/luckperms/sponge/listeners/SpongePlatformListener.java b/sponge/src/main/java/me/lucko/luckperms/sponge/listeners/SpongePlatformListener.java index 6aacad42c..0ca6d58e5 100644 --- a/sponge/src/main/java/me/lucko/luckperms/sponge/listeners/SpongePlatformListener.java +++ b/sponge/src/main/java/me/lucko/luckperms/sponge/listeners/SpongePlatformListener.java @@ -32,6 +32,8 @@ import org.spongepowered.api.command.CommandSource; import org.spongepowered.api.event.Listener; import org.spongepowered.api.event.command.SendCommandEvent; +import java.util.Locale; + public class SpongePlatformListener { private final LPSpongePlugin plugin; @@ -44,7 +46,7 @@ public class SpongePlatformListener { CommandSource source = e.getCause().first(CommandSource.class).orElse(null); if (source == null) return; - final String name = e.getCommand().toLowerCase(); + final String name = e.getCommand().toLowerCase(Locale.ROOT); if ((name.equals("op") || name.equals("minecraft:op")) && source.hasPermission("minecraft.command.op") || (name.equals("deop") || name.equals("minecraft:deop")) && source.hasPermission("minecraft.command.deop")) { Message.OP_DISABLED_SPONGE.send(this.plugin.getSenderFactory().wrap(source)); } diff --git a/sponge/src/main/java/me/lucko/luckperms/sponge/model/manager/SpongeGroupManager.java b/sponge/src/main/java/me/lucko/luckperms/sponge/model/manager/SpongeGroupManager.java index 161ee9ef5..aababb710 100644 --- a/sponge/src/main/java/me/lucko/luckperms/sponge/model/manager/SpongeGroupManager.java +++ b/sponge/src/main/java/me/lucko/luckperms/sponge/model/manager/SpongeGroupManager.java @@ -55,6 +55,7 @@ import org.spongepowered.api.service.permission.PermissionService; import org.spongepowered.api.service.permission.SubjectCollection; import java.util.List; +import java.util.Locale; import java.util.Map; import java.util.Objects; import java.util.Optional; @@ -132,12 +133,12 @@ public class SpongeGroupManager extends AbstractGroupManager implem throw new IllegalArgumentException("Illegal subject identifier"); } - LPSubject present = this.subjectLoadingCache.getIfPresent(identifier.toLowerCase()); + LPSubject present = this.subjectLoadingCache.getIfPresent(identifier.toLowerCase(Locale.ROOT)); if (present != null) { return CompletableFuture.completedFuture(present); } - return CompletableFuture.supplyAsync(() -> this.subjectLoadingCache.get(identifier.toLowerCase()), this.plugin.getBootstrap().getScheduler().async()); + return CompletableFuture.supplyAsync(() -> this.subjectLoadingCache.get(identifier.toLowerCase(Locale.ROOT)), this.plugin.getBootstrap().getScheduler().async()); } @Override @@ -146,7 +147,7 @@ public class SpongeGroupManager extends AbstractGroupManager implem return Optional.empty(); } - return Optional.ofNullable(getIfLoaded(identifier.toLowerCase())).map(SpongeGroup::sponge); + return Optional.ofNullable(getIfLoaded(identifier.toLowerCase(Locale.ROOT))).map(SpongeGroup::sponge); } @Override @@ -155,7 +156,7 @@ public class SpongeGroupManager extends AbstractGroupManager implem return CompletableFuture.completedFuture(false); } - return CompletableFuture.completedFuture(isLoaded(identifier.toLowerCase())); + return CompletableFuture.completedFuture(isLoaded(identifier.toLowerCase(Locale.ROOT))); } @Override @@ -166,7 +167,7 @@ public class SpongeGroupManager extends AbstractGroupManager implem if (!DataConstraints.GROUP_NAME_TEST.test(id)) { continue; } - subjects.add(loadSubject(id.toLowerCase()).join()); + subjects.add(loadSubject(id.toLowerCase(Locale.ROOT)).join()); } return subjects.build(); diff --git a/sponge/src/main/java/me/lucko/luckperms/sponge/service/LuckPermsService.java b/sponge/src/main/java/me/lucko/luckperms/sponge/service/LuckPermsService.java index f0bc30992..9d9590ca2 100644 --- a/sponge/src/main/java/me/lucko/luckperms/sponge/service/LuckPermsService.java +++ b/sponge/src/main/java/me/lucko/luckperms/sponge/service/LuckPermsService.java @@ -54,6 +54,7 @@ import org.spongepowered.api.service.permission.Subject; import org.spongepowered.api.text.Text; import java.util.HashMap; +import java.util.Locale; import java.util.Map; import java.util.Objects; import java.util.Optional; @@ -120,12 +121,12 @@ public class LuckPermsService implements LPPermissionService { // load known collections for (String identifier : this.storage.getSavedCollections()) { - if (this.collections.containsKey(identifier.toLowerCase())) { + if (this.collections.containsKey(identifier.toLowerCase(Locale.ROOT))) { continue; } // load data - PersistedCollection collection = new PersistedCollection(this, identifier.toLowerCase()); + PersistedCollection collection = new PersistedCollection(this, identifier.toLowerCase(Locale.ROOT)); collection.loadAll(); // cache in this instance @@ -185,7 +186,7 @@ public class LuckPermsService implements LPPermissionService { @Override public LPSubjectCollection getCollection(String s) { Objects.requireNonNull(s); - return this.collections.get(s.toLowerCase()); + return this.collections.get(s.toLowerCase(Locale.ROOT)); } @Override diff --git a/sponge/src/main/java/me/lucko/luckperms/sponge/service/model/calculated/CalculatedSubjectData.java b/sponge/src/main/java/me/lucko/luckperms/sponge/service/model/calculated/CalculatedSubjectData.java index f98843789..8c1ab6dfb 100644 --- a/sponge/src/main/java/me/lucko/luckperms/sponge/service/model/calculated/CalculatedSubjectData.java +++ b/sponge/src/main/java/me/lucko/luckperms/sponge/service/model/calculated/CalculatedSubjectData.java @@ -48,6 +48,7 @@ import org.spongepowered.api.service.permission.SubjectData; import java.util.HashMap; import java.util.LinkedHashSet; import java.util.List; +import java.util.Locale; import java.util.Map; import java.util.Objects; import java.util.Set; @@ -160,10 +161,10 @@ public class CalculatedSubjectData implements LPSubjectData { boolean b; if (value == Tristate.UNDEFINED) { Map perms = this.permissions.get(contexts); - b = perms != null && perms.remove(permission.toLowerCase()) != null; + b = perms != null && perms.remove(permission.toLowerCase(Locale.ROOT)) != null; } else { Map perms = this.permissions.computeIfAbsent(contexts, c -> new ConcurrentHashMap<>()); - b = !Objects.equals(perms.put(permission.toLowerCase(), value.asBoolean()), value.asBoolean()); + b = !Objects.equals(perms.put(permission.toLowerCase(Locale.ROOT), value.asBoolean()), value.asBoolean()); } if (b) { this.service.invalidateAllCaches(); @@ -312,7 +313,7 @@ public class CalculatedSubjectData implements LPSubjectData { @Override public CompletableFuture setOption(ImmutableContextSet contexts, String key, String value) { Map options = this.options.computeIfAbsent(contexts, c -> new ConcurrentHashMap<>()); - boolean b = !stringEquals(options.put(key.toLowerCase(), value), value); + boolean b = !stringEquals(options.put(key.toLowerCase(Locale.ROOT), value), value); if (b) { this.service.invalidateAllCaches(); } @@ -322,7 +323,7 @@ public class CalculatedSubjectData implements LPSubjectData { @Override public CompletableFuture unsetOption(ImmutableContextSet contexts, String key) { Map options = this.options.get(contexts); - boolean b = options != null && options.remove(key.toLowerCase()) != null; + boolean b = options != null && options.remove(key.toLowerCase(Locale.ROOT)) != null; if (b) { this.service.invalidateAllCaches(); } diff --git a/sponge/src/main/java/me/lucko/luckperms/sponge/service/model/permissionholder/PermissionHolderSubjectData.java b/sponge/src/main/java/me/lucko/luckperms/sponge/service/model/permissionholder/PermissionHolderSubjectData.java index b510ef1d4..39f07e578 100644 --- a/sponge/src/main/java/me/lucko/luckperms/sponge/service/model/permissionholder/PermissionHolderSubjectData.java +++ b/sponge/src/main/java/me/lucko/luckperms/sponge/service/model/permissionholder/PermissionHolderSubjectData.java @@ -61,6 +61,7 @@ import org.spongepowered.api.service.permission.SubjectData; import java.util.Collection; import java.util.HashMap; +import java.util.Locale; import java.util.Map; import java.util.Objects; import java.util.concurrent.CompletableFuture; @@ -297,7 +298,7 @@ public class PermissionHolderSubjectData implements LPSubjectData { Node node; if (key.equalsIgnoreCase(Prefix.NODE_KEY) || key.equalsIgnoreCase(Suffix.NODE_KEY)) { // special handling. - ChatMetaType type = ChatMetaType.valueOf(key.toUpperCase()); + ChatMetaType type = ChatMetaType.valueOf(key.toUpperCase(Locale.ROOT)); // remove all prefixes/suffixes from the user this.holder.removeIf(this.type, contexts, type.nodeType()::matches, false); diff --git a/sponge/src/main/java/me/lucko/luckperms/sponge/service/model/persisted/PersistedCollection.java b/sponge/src/main/java/me/lucko/luckperms/sponge/service/model/persisted/PersistedCollection.java index c5e7a0df3..9aad7faf1 100644 --- a/sponge/src/main/java/me/lucko/luckperms/sponge/service/model/persisted/PersistedCollection.java +++ b/sponge/src/main/java/me/lucko/luckperms/sponge/service/model/persisted/PersistedCollection.java @@ -45,6 +45,7 @@ import net.luckperms.api.util.Tristate; import org.spongepowered.api.service.permission.SubjectCollection; +import java.util.Locale; import java.util.Map; import java.util.Objects; import java.util.Optional; @@ -88,7 +89,7 @@ public class PersistedCollection implements LPSubjectCollection { public void loadAll() { Map holders = this.service.getStorage().loadAllFromFile(this.identifier); for (Map.Entry e : holders.entrySet()) { - PersistedSubject subject = this.subjects.get(e.getKey().toLowerCase()); + PersistedSubject subject = this.subjects.get(e.getKey().toLowerCase(Locale.ROOT)); if (subject != null) { subject.loadData(e.getValue()); } @@ -121,7 +122,7 @@ public class PersistedCollection implements LPSubjectCollection { } public LPSubject obtainSubject(String identifier) { - return this.subjects.get(identifier.toLowerCase()); + return this.subjects.get(identifier.toLowerCase(Locale.ROOT)); } @Override @@ -138,14 +139,14 @@ public class PersistedCollection implements LPSubjectCollection { @Override public CompletableFuture hasRegistered(String identifier) { - return CompletableFuture.completedFuture(this.subjects.containsKey(identifier.toLowerCase())); + return CompletableFuture.completedFuture(this.subjects.containsKey(identifier.toLowerCase(Locale.ROOT))); } @Override public CompletableFuture> loadSubjects(Set identifiers) { ImmutableSet.Builder subjects = ImmutableSet.builder(); for (String id : identifiers) { - subjects.add(Objects.requireNonNull(this.subjects.get(id.toLowerCase()))); + subjects.add(Objects.requireNonNull(this.subjects.get(id.toLowerCase(Locale.ROOT)))); } return CompletableFuture.completedFuture(subjects.build()); }