Skip to content

Commit 3611a81

Browse files
committed
Fix String#toLower/UpperCase usages
1 parent 1d14197 commit 3611a81

3 files changed

Lines changed: 5 additions & 3 deletions

File tree

paper-api/src/main/java/com/destroystokyo/paper/NamespacedTag.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ public NamespacedTag(@NotNull Plugin plugin, @NotNull String key) {
7575
Preconditions.checkArgument(key != null, "Key cannot be null");
7676

7777
this.namespace = plugin.getName().toLowerCase(Locale.ROOT);
78-
this.key = key.toLowerCase().toLowerCase(Locale.ROOT);
78+
this.key = key.toLowerCase(Locale.ROOT);
7979

8080
// Check validity after normalization
8181
Preconditions.checkArgument(VALID_NAMESPACE.matcher(this.namespace).matches(), "Invalid namespace. Must be [a-z0-9._-]: %s", this.namespace);

paper-server/src/main/java/io/papermc/paper/configuration/PaperConfigurations.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@
5151
import java.nio.file.Path;
5252
import java.nio.file.StandardCopyOption;
5353
import java.util.List;
54+
import java.util.Locale;
5455
import java.util.function.Function;
5556
import java.util.function.Supplier;
5657

@@ -150,7 +151,7 @@ public class PaperConfigurations extends Configurations<GlobalConfiguration, Wor
150151
""";
151152

152153
@VisibleForTesting
153-
public static final Supplier<SpigotWorldConfig> SPIGOT_WORLD_DEFAULTS = Suppliers.memoize(() -> new SpigotWorldConfig(RandomStringUtils.randomAlphabetic(255), Key.key(RandomStringUtils.randomAlphabetic(255).toLowerCase())) {
154+
public static final Supplier<SpigotWorldConfig> SPIGOT_WORLD_DEFAULTS = Suppliers.memoize(() -> new SpigotWorldConfig(RandomStringUtils.randomAlphabetic(255), Key.key(RandomStringUtils.randomAlphabetic(255).toLowerCase(Locale.ROOT))) {
154155
@Override // override to ensure "verbose" is false
155156
public void init() {
156157
SpigotConfig.readConfig(SpigotWorldConfig.class, this);

test-plugin/src/main/java/io/papermc/testplugin/brigtests/example/IceCreamTypeArgument.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,14 +12,15 @@
1212
import net.kyori.adventure.text.format.NamedTextColor;
1313
import org.jetbrains.annotations.NotNull;
1414

15+
import java.util.Locale;
1516
import java.util.concurrent.CompletableFuture;
1617

1718
public class IceCreamTypeArgument implements CustomArgumentType.Converted<IceCreamType, String> {
1819

1920
@Override
2021
public @NotNull IceCreamType convert(String nativeType) throws CommandSyntaxException {
2122
try {
22-
return IceCreamType.valueOf(nativeType.toUpperCase());
23+
return IceCreamType.valueOf(nativeType.toUpperCase(Locale.ROOT));
2324
} catch (IllegalArgumentException ignored) {
2425
throw new ComponentCommandExceptionType(Component.text("Invalid species %s!".formatted(nativeType), NamedTextColor.RED)).create();
2526
}

0 commit comments

Comments
 (0)