1
0
mirror of https://github.com/lucko/LuckPerms.git synced 2025-08-21 05:41:20 +02:00

Fix toLowerCase/toUpperCase locale sensitivity

This commit is contained in:
Luck
2021-08-25 20:09:20 +01:00
parent 062fca3f75
commit 9cd33d26f2
110 changed files with 310 additions and 184 deletions

View File

@@ -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<? extends ChatMetaNode<?, ?>> nodeType;
ChatMetaType(NodeType<? extends ChatMetaNode<?, ?>> nodeType) {
this.name = nodeType.name().toLowerCase();
this.name = nodeType.name().toLowerCase(Locale.ROOT);
this.nodeType = nodeType;
}

View File

@@ -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<T> implements NodeMetadataKey<T> {
@@ -34,7 +35,7 @@ final class SimpleNodeMetadataKey<T> implements NodeMetadataKey<T> {
private final Class<T> type;
SimpleNodeMetadataKey(String name, Class<T> type) {
this.name = name.toLowerCase();
this.name = name.toLowerCase(Locale.ROOT);
this.type = type;
}

View File

@@ -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<T> implements OptionKey<T> {
@@ -35,7 +36,7 @@ final class SimpleOptionKey<T> implements OptionKey<T> {
private final int hashCode;
SimpleOptionKey(String name, Class<T> type) {
this.name = name.toLowerCase();
this.name = name.toLowerCase(Locale.ROOT);
this.type = type;
this.hashCode = Objects.hash(this.name, this.type); // cache hashcode
}