From 4b7f63b0247e41f1002caa567447094e8458fb03 Mon Sep 17 00:00:00 2001 From: ceze88 Date: Fri, 12 Apr 2024 18:34:49 +0200 Subject: [PATCH] Fix string conversion to upper case --- src/main/java/com/craftaro/skyblock/island/Island.java | 7 ++++--- .../skyblock/localization/type/impl/EnumLocalization.java | 3 ++- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/src/main/java/com/craftaro/skyblock/island/Island.java b/src/main/java/com/craftaro/skyblock/island/Island.java index 85318c8c..c59babda 100644 --- a/src/main/java/com/craftaro/skyblock/island/Island.java +++ b/src/main/java/com/craftaro/skyblock/island/Island.java @@ -46,6 +46,7 @@ import java.util.Date; import java.util.HashMap; import java.util.HashSet; import java.util.List; +import java.util.Locale; import java.util.Map; import java.util.Map.Entry; import java.util.Objects; @@ -203,13 +204,13 @@ public class Island { for (BasicPermission permission : allPermissions) { if (settingsDataConfig == null || settingsDataConfig.getFileConfiguration() - .getString("Settings." + roleList.getFriendlyName().toUpperCase() + "." + permission.getName()) == null) { + .getString("Settings." + roleList.name() + "." + permission.getName()) == null) { permissions.add( new IslandPermission(permission, this.plugin.getSettings() - .getBoolean("Settings." + roleList.getFriendlyName().toUpperCase() + "." + permission.getName(), true))); + .getBoolean("Settings." + roleList.name() + "." + permission.getName(), true))); } else { permissions.add(new IslandPermission(permission, settingsDataConfig.getFileConfiguration() - .getBoolean("Settings." + roleList.getFriendlyName().toUpperCase() + "." + permission.getName(), true))); + .getBoolean("Settings." + roleList.name() + "." + permission.getName(), true))); } } diff --git a/src/main/java/com/craftaro/skyblock/localization/type/impl/EnumLocalization.java b/src/main/java/com/craftaro/skyblock/localization/type/impl/EnumLocalization.java index a8c7d54b..cb4b4896 100644 --- a/src/main/java/com/craftaro/skyblock/localization/type/impl/EnumLocalization.java +++ b/src/main/java/com/craftaro/skyblock/localization/type/impl/EnumLocalization.java @@ -4,6 +4,7 @@ import com.craftaro.skyblock.localization.type.Localization; import org.bukkit.configuration.ConfigurationSection; import java.util.EnumMap; +import java.util.Locale; import java.util.Map; public class EnumLocalization> extends Localization { @@ -37,6 +38,6 @@ public class EnumLocalization> extends Localization { } protected T parseEnum(String input) { - return Enum.valueOf(getType(), input.toUpperCase()); + return Enum.valueOf(getType(), input.toUpperCase(Locale.US)); } }