mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2025-06-27 11:14:44 +02:00
Enforce locale usage for enums to ensure correct casing (Fixes #4086)
This commit is contained in:
@ -12,6 +12,7 @@ import org.bukkit.configuration.ConfigurationSection;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
import java.util.Set;
|
||||
|
||||
public class Config extends AutoUpdateConfigLoader {
|
||||
@ -277,7 +278,7 @@ public class Config extends AutoUpdateConfigLoader {
|
||||
/* Mob Healthbar */
|
||||
public MobHealthbarType getMobHealthbarDefault() {
|
||||
try {
|
||||
return MobHealthbarType.valueOf(config.getString("Mob_Healthbar.Display_Type", "HEARTS").toUpperCase().trim());
|
||||
return MobHealthbarType.valueOf(config.getString("Mob_Healthbar.Display_Type", "HEARTS").toUpperCase(Locale.ENGLISH).trim());
|
||||
}
|
||||
catch (IllegalArgumentException ex) {
|
||||
return MobHealthbarType.HEARTS;
|
||||
|
@ -5,6 +5,7 @@ import com.gmail.nossr50.util.StringUtils;
|
||||
import org.bukkit.Material;
|
||||
|
||||
import java.util.HashSet;
|
||||
import java.util.Locale;
|
||||
|
||||
public class ItemWeightConfig extends ConfigLoader {
|
||||
private static ItemWeightConfig instance;
|
||||
@ -29,7 +30,7 @@ public class ItemWeightConfig extends ConfigLoader {
|
||||
HashSet<Material> miscItems = new HashSet<Material>();
|
||||
|
||||
for (String item : config.getStringList("Party_Shareables.Misc_Items")) {
|
||||
Material material = Material.getMaterial(item.toUpperCase());
|
||||
Material material = Material.getMaterial(item.toUpperCase(Locale.ENGLISH));
|
||||
|
||||
if (material != null) {
|
||||
miscItems.add(material);
|
||||
|
@ -14,6 +14,7 @@ import org.bukkit.inventory.ItemStack;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
import java.util.Set;
|
||||
|
||||
public class SalvageConfig extends ConfigLoader {
|
||||
@ -78,7 +79,7 @@ public class SalvageConfig extends ConfigLoader {
|
||||
}
|
||||
else {
|
||||
try {
|
||||
salvageMaterialType = MaterialType.valueOf(salvageMaterialTypeString.replace(" ", "_").toUpperCase());
|
||||
salvageMaterialType = MaterialType.valueOf(salvageMaterialTypeString.replace(" ", "_").toUpperCase(Locale.ENGLISH));
|
||||
}
|
||||
catch (IllegalArgumentException ex) {
|
||||
reason.add(key + " has an invalid MaterialType of " + salvageMaterialTypeString);
|
||||
@ -112,7 +113,7 @@ public class SalvageConfig extends ConfigLoader {
|
||||
}
|
||||
else {
|
||||
try {
|
||||
salvageItemType = ItemType.valueOf(salvageItemTypeString.replace(" ", "_").toUpperCase());
|
||||
salvageItemType = ItemType.valueOf(salvageItemTypeString.replace(" ", "_").toUpperCase(Locale.ENGLISH));
|
||||
}
|
||||
catch (IllegalArgumentException ex) {
|
||||
reason.add(key + " has an invalid ItemType of " + salvageItemTypeString);
|
||||
|
Reference in New Issue
Block a user