diff options
author | NopoTheGamer <40329022+NopoTheGamer@users.noreply.github.com> | 2024-04-27 06:23:28 +1000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-04-26 22:23:28 +0200 |
commit | b3ca5b1ffc698ede14d4e9d8ed2dc86711201de1 (patch) | |
tree | b30f23c9745bfc66c721e7bfdb440a336142871a | |
parent | d3106bf41e099d329d9db330ab09e167519fce25 (diff) | |
download | NotEnoughUpdates-b3ca5b1ffc698ede14d4e9d8ed2dc86711201de1.tar.gz NotEnoughUpdates-b3ca5b1ffc698ede14d4e9d8ed2dc86711201de1.tar.bz2 NotEnoughUpdates-b3ca5b1ffc698ede14d4e9d8ed2dc86711201de1.zip |
Fix Profile viewer issues with Turkish language (#1116)
40 files changed, 152 insertions, 119 deletions
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/NEUManager.java b/src/main/java/io/github/moulberry/notenoughupdates/NEUManager.java index cf95b081..e41ea9df 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/NEUManager.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/NEUManager.java @@ -495,8 +495,8 @@ public class NEUManager { int lastStringMatch = -1; ArrayList<DebugMatch> debugMatches = new ArrayList<>(); - toSearch = cleanForTitleMapSearch(toSearch).toLowerCase(); - query = cleanForTitleMapSearch(query).toLowerCase(); + toSearch = cleanForTitleMapSearch(toSearch).toLowerCase(Locale.ROOT); + query = cleanForTitleMapSearch(query).toLowerCase(Locale.ROOT); String[] splitToSearch = toSearch.split(" "); String[] queryArray = query.split(" "); @@ -683,7 +683,7 @@ public class NEUManager { results.addAll(new TreeSet<>(search(query, loreWordMap))); } else if (query.startsWith("id:")) { query = query.substring(3); - results.addAll(new TreeSet<>(subMapWithKeysThatAreSuffixes(query.toUpperCase(), itemMap).keySet())); + results.addAll(new TreeSet<>(subMapWithKeysThatAreSuffixes(query.toUpperCase(Locale.ROOT), itemMap).keySet())); } else { if (!query.trim().contains(" ")) { StringBuilder sb = new StringBuilder(); @@ -716,7 +716,7 @@ public class NEUManager { public Set<String> search(String query, TreeMap<String, HashMap<String, List<Integer>>> wordMap) { HashMap<String, List<Integer>> matches = null; - query = cleanForTitleMapSearch(query).toLowerCase(); + query = cleanForTitleMapSearch(query).toLowerCase(Locale.ROOT); for (String queryWord : query.split(" ")) { HashMap<String, List<Integer>> matchesToKeep = new HashMap<>(); for (HashMap<String, List<Integer>> wordMatches : subMapWithKeysThatAreSuffixes(queryWord, wordMap).values()) { @@ -871,7 +871,7 @@ public class NEUManager { } public static String cleanForTitleMapSearch(String str) { - return str.replaceAll("(\u00a7.)|[^#0-9a-zA-Z ]", "").toLowerCase().trim(); + return str.replaceAll("(\u00a7.)|[^#0-9a-zA-Z ]", "").toLowerCase(Locale.ROOT).trim(); } public void showRecipe(JsonObject item) { diff --git a/src/main/java/io/github/moulberry/notenoughupdates/NEUOverlay.java b/src/main/java/io/github/moulberry/notenoughupdates/NEUOverlay.java index 797260c4..c3be39b2 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/NEUOverlay.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/NEUOverlay.java @@ -97,6 +97,7 @@ import java.util.HashSet; import java.util.LinkedHashMap; import java.util.LinkedHashSet; import java.util.List; +import java.util.Locale; import java.util.Map; import java.util.Set; import java.util.TreeSet; @@ -568,14 +569,14 @@ public class NEUOverlay extends Gui { } else if (manager.getItemInformation().containsKey(display)) { render = manager.jsonToStack(manager.getItemInformation().get(display), true, true); } else { - Item item = Item.itemRegistry.getObject(new ResourceLocation(display.toLowerCase())); + Item item = Item.itemRegistry.getObject(new ResourceLocation(display.toLowerCase(Locale.ROOT))); if (item != null) { render = new ItemStack(item); } } if (render != null) { NBTTagCompound tag = render.getTagCompound() != null ? render.getTagCompound() : new NBTTagCompound(); - tag.setString("qc_id", quickCommandStrSplit[0].toLowerCase().trim()); + tag.setString("qc_id", quickCommandStrSplit[0].toLowerCase(Locale.ROOT).trim()); render.setTagCompound(tag); Minecraft.getMinecraft().getTextureManager().bindTexture(GuiTextures.quickcommand_background); @@ -1485,7 +1486,7 @@ public class NEUOverlay extends Gui { if (item != null) searchedItems.add(item); } } - switch (textField.getText().toLowerCase().trim()) { + switch (textField.getText().toLowerCase(Locale.ROOT).trim()) { case "nullzee": searchedItems.add(CustomItems.NULLZEE); break; @@ -1918,14 +1919,14 @@ public class NEUOverlay extends Gui { updateSearch(); } - if (textField.getText().toLowerCase().contains("bald")) { + if (textField.getText().toLowerCase(Locale.ROOT).contains("bald")) { Minecraft.getMinecraft().getTextureManager().bindTexture(SUPERGEHEIMNISVERMOGEN); GlStateManager.color(1, 1, 1, 1); Utils.drawTexturedRect((width - 64) / 2f, (height - 64) / 2f - 114, 64, 64, GL11.GL_LINEAR); GlStateManager.bindTexture(0); } - if (textField.getText().toLowerCase().contains("lunar")) { + if (textField.getText().toLowerCase(Locale.ROOT).contains("lunar")) { Minecraft.getMinecraft().getTextureManager().bindTexture(ATMOULBERRYWHYISMYLUNARCLIENTBUGGING); GlStateManager.color(1, 1, 1, 1); GlStateManager.translate(0, 0, 100); @@ -1933,7 +1934,7 @@ public class NEUOverlay extends Gui { GlStateManager.bindTexture(0); } - SunTzu.setEnabled(textField.getText().toLowerCase().startsWith("potato")); + SunTzu.setEnabled(textField.getText().toLowerCase(Locale.ROOT).startsWith("potato")); updateGuiGroupSize(); diff --git a/src/main/java/io/github/moulberry/notenoughupdates/NotEnoughUpdates.java b/src/main/java/io/github/moulberry/notenoughupdates/NotEnoughUpdates.java index 38270c77..848185a8 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/NotEnoughUpdates.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/NotEnoughUpdates.java @@ -87,6 +87,7 @@ import org.apache.logging.log4j.Logger; import java.awt.*; import java.io.File; import java.util.HashMap; +import java.util.Locale; import java.util.Set; import java.util.regex.Matcher; import java.util.regex.Pattern; @@ -470,7 +471,7 @@ public class NotEnoughUpdates { if (mc != null && mc.theWorld != null && mc.thePlayer != null) { if (mc.isSingleplayer() || mc.thePlayer.getClientBrand() == null || - !mc.thePlayer.getClientBrand().toLowerCase().contains("hypixel")) { + !mc.thePlayer.getClientBrand().toLowerCase(Locale.ROOT).contains("hypixel")) { hasSkyblockScoreboard = false; return; } diff --git a/src/main/java/io/github/moulberry/notenoughupdates/core/GuiElementColour.java b/src/main/java/io/github/moulberry/notenoughupdates/core/GuiElementColour.java index 405b18fc..c02e3e15 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/core/GuiElementColour.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/core/GuiElementColour.java @@ -34,6 +34,7 @@ import org.lwjgl.opengl.GL11; import java.awt.*; import java.awt.image.BufferedImage; +import java.util.Locale; import java.util.function.Consumer; import java.util.function.Supplier; @@ -274,7 +275,7 @@ public class GuiElementColour extends GuiElement { } hexField.setSize(48, 10); - if (!hexField.getFocus()) hexField.setText(Integer.toHexString(c.getRGB() & 0xFFFFFF).toUpperCase()); + if (!hexField.getFocus()) hexField.setText(Integer.toHexString(c.getRGB() & 0xFFFFFF).toUpperCase(Locale.ROOT)); StringBuilder sb = new StringBuilder(EnumChatFormatting.GRAY + "#"); for (int i = 0; i < 6 - hexField.getText().length(); i++) { @@ -421,7 +422,7 @@ public class GuiElementColour extends GuiElement { hexField.setText(old); } else { try { - String text = hexField.getText().toLowerCase(); + String text = hexField.getText().toLowerCase(Locale.ROOT); int rgb = Integer.parseInt(text, 16); int alpha = (ChromaColour.specialToSimpleRGB(colour.get()) >> 24) & 0xFF; diff --git a/src/main/java/io/github/moulberry/notenoughupdates/core/util/StringUtils.java b/src/main/java/io/github/moulberry/notenoughupdates/core/util/StringUtils.java index 20031ec3..ae8011c5 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/core/util/StringUtils.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/core/util/StringUtils.java @@ -95,7 +95,7 @@ public class StringUtils { public static String firstUpperLetter(String text) { if (text.isEmpty()) return text; - String firstLetter = ("" + text.charAt(0)).toUpperCase(); + String firstLetter = ("" + text.charAt(0)).toUpperCase(Locale.ROOT); return firstLetter + text.substring(1); } diff --git a/src/main/java/io/github/moulberry/notenoughupdates/dungeons/DungeonWin.java b/src/main/java/io/github/moulberry/notenoughupdates/dungeons/DungeonWin.java index 2cf09457..0aa44cd5 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/dungeons/DungeonWin.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/dungeons/DungeonWin.java @@ -37,6 +37,7 @@ import java.util.ArrayList; import java.util.ConcurrentModificationException; import java.util.HashSet; import java.util.List; +import java.util.Locale; import java.util.Random; import java.util.Set; import java.util.concurrent.Executors; @@ -191,7 +192,7 @@ public class DungeonWin { if (matcher.find()) { lastDungeonFinish = currentTime; String score = matcher.group(1); - switch (score.toUpperCase()) { + switch (score.toUpperCase(Locale.ROOT)) { case "S+": TEAM_SCORE = SPLUS; break; diff --git a/src/main/java/io/github/moulberry/notenoughupdates/infopanes/HTMLInfoPane.java b/src/main/java/io/github/moulberry/notenoughupdates/infopanes/HTMLInfoPane.java index de9c608f..770e313a 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/infopanes/HTMLInfoPane.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/infopanes/HTMLInfoPane.java @@ -60,6 +60,7 @@ import java.net.URLConnection; import java.nio.charset.CharsetEncoder; import java.nio.charset.StandardCharsets; import java.nio.file.Files; +import java.util.Locale; import java.util.concurrent.CompletableFuture; import java.util.concurrent.ExecutorService; import java.util.concurrent.Executors; @@ -128,7 +129,7 @@ public class HTMLInfoPane extends TextInfoPane { public void parseInternalImageLink(String imageNamespace, String rawImageLink) { rawImageLink = rawImageLink.replaceFirst("\\|x([0-9]+)px", "\\|$1x$1px"); - if (!rawImageLink.split("\\|")[0].toLowerCase().endsWith(".jpg")) { + if (!rawImageLink.split("\\|")[0].toLowerCase(Locale.ROOT).endsWith(".jpg")) { super.parseInternalImageLink(imageNamespace, rawImageLink); } } diff --git a/src/main/java/io/github/moulberry/notenoughupdates/listener/ItemTooltipEssenceShopListener.java b/src/main/java/io/github/moulberry/notenoughupdates/listener/ItemTooltipEssenceShopListener.java index 4b380c2f..86650991 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/listener/ItemTooltipEssenceShopListener.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/listener/ItemTooltipEssenceShopListener.java @@ -28,6 +28,7 @@ import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; import java.util.ArrayList; import java.util.List; +import java.util.Locale; import java.util.regex.Matcher; import java.util.regex.Pattern; @@ -59,7 +60,7 @@ public class ItemTooltipEssenceShopListener { int amount = Integer.parseInt(rawNumber); String type = matcher.group(2); - String essenceName = "ESSENCE_" + type.toUpperCase(); + String essenceName = "ESSENCE_" + type.toUpperCase(Locale.ROOT); JsonObject bazaarInfo = neu.manager.auctionManager.getBazaarInfo(essenceName); if (bazaarInfo != null && bazaarInfo.has("curr_sell")) { diff --git a/src/main/java/io/github/moulberry/notenoughupdates/listener/RenderListener.java b/src/main/java/io/github/moulberry/notenoughupdates/listener/RenderListener.java index bd923157..dcbc8654 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/listener/RenderListener.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/listener/RenderListener.java @@ -656,7 +656,7 @@ public class RenderListener { String displayName = item.getDisplayName(); Matcher matcher = ESSENCE_PATTERN.matcher(displayName); if (neu.config.dungeons.useEssenceCostFromBazaar && matcher.matches()) { - String type = matcher.group(1).toUpperCase(); + String type = matcher.group(1).toUpperCase(Locale.ROOT); JsonObject bazaarInfo = neu.manager.auctionManager.getBazaarInfo("ESSENCE_" + type); if (bazaarInfo != null && bazaarInfo.has("curr_sell")) { float bazaarPrice = bazaarInfo.get("curr_sell").getAsFloat(); diff --git a/src/main/java/io/github/moulberry/notenoughupdates/mbgui/MBAnchorPoint.java b/src/main/java/io/github/moulberry/notenoughupdates/mbgui/MBAnchorPoint.java index 7193b47f..d0aac435 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/mbgui/MBAnchorPoint.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/mbgui/MBAnchorPoint.java @@ -22,6 +22,7 @@ package io.github.moulberry.notenoughupdates.mbgui; import org.lwjgl.util.vector.Vector2f; import java.io.Serializable; +import java.util.Locale; public class MBAnchorPoint implements Serializable { public enum AnchorPoint { @@ -59,7 +60,7 @@ public class MBAnchorPoint implements Serializable { try { String[] split = str.split(":"); - AnchorPoint point = AnchorPoint.valueOf(split[0].toUpperCase()); + AnchorPoint point = AnchorPoint.valueOf(split[0].toUpperCase(Locale.ROOT)); Vector2f pos = new Vector2f(Float.parseFloat(split[1]), Float.parseFloat(split[2])); return new MBAnchorPoint(point, pos, Boolean.parseBoolean(split[3])); } catch (Exception e) { diff --git a/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/AntiCoopAdd.java b/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/AntiCoopAdd.java index 40425560..78c7dd2e 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/AntiCoopAdd.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/AntiCoopAdd.java @@ -33,6 +33,8 @@ import net.minecraft.util.ChatComponentText; import net.minecraft.util.EnumChatFormatting; import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; +import java.util.Locale; + @NEUAutoSubscribe public class AntiCoopAdd { @@ -72,7 +74,7 @@ public class AntiCoopAdd { public Boolean onPacketChatMessage(C01PacketChatMessage packet) { if (!NotEnoughUpdates.INSTANCE.config.misc.coopWarning) return false; - String message = packet.getMessage().toLowerCase(); + String message = packet.getMessage().toLowerCase(Locale.ROOT); if (message.startsWith("/hypixelcommand:coopadd")) { Utils.addChatMessage("§e[NEU] You just entered a malicious looking Co-op add command! If you truly want to add someone to your coop, type §e/coopadd <name>"); return true; diff --git a/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/BetterContainers.java b/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/BetterContainers.java index e7331378..6759d940 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/BetterContainers.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/BetterContainers.java @@ -47,6 +47,7 @@ import java.io.BufferedReader; import java.io.InputStreamReader; import java.nio.charset.StandardCharsets; import java.util.HashMap; +import java.util.Locale; @NEUAutoSubscribe public class BetterContainers { @@ -132,7 +133,7 @@ public class BetterContainers { GuiChest eventGui = (GuiChest) Minecraft.getMinecraft().currentScreen; ContainerChest cc = (ContainerChest) eventGui.inventorySlots; String containerName = cc.getLowerChestInventory().getDisplayName().getUnformattedText(); - return containerName.toLowerCase().trim().startsWith("navigate the maze"); + return containerName.toLowerCase(Locale.ROOT).trim().startsWith("navigate the maze"); } public static boolean isOverriding() { diff --git a/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/CrystalMetalDetectorSolver.java b/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/CrystalMetalDetectorSolver.java index 76f56fac..e355c437 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/CrystalMetalDetectorSolver.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/CrystalMetalDetectorSolver.java @@ -38,6 +38,7 @@ import java.util.Collection; import java.util.HashMap; import java.util.HashSet; import java.util.List; +import java.util.Locale; import java.util.stream.Collectors; public class CrystalMetalDetectorSolver { @@ -378,7 +379,7 @@ public class CrystalMetalDetectorSolver { NEUDebugLogger.log(NEUDebugFlag.METAL, "Locating center using Keeper: " + EnumChatFormatting.WHITE + keeperEntity); String keeperType = keeperName.substring(keeperName.indexOf(KEEPER_OF_STRING) + KEEPER_OF_STRING.length()); - minesCenter = keeperEntity.getPosition().add(keeperOffsets.get(keeperType.toLowerCase())); + minesCenter = keeperEntity.getPosition().add(keeperOffsets.get(keeperType.toLowerCase(Locale.ROOT))); NEUDebugLogger.log(NEUDebugFlag.METAL, "Mines center: " + EnumChatFormatting.WHITE + minesCenter.toString()); Utils.addChatMessage( diff --git a/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/DwarvenMinesWaypoints.java b/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/DwarvenMinesWaypoints.java index f05f1cd8..4d1494ed 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/DwarvenMinesWaypoints.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/DwarvenMinesWaypoints.java @@ -43,6 +43,7 @@ import org.lwjgl.util.vector.Vector3f; import java.util.HashMap; import java.util.HashSet; +import java.util.Locale; import java.util.Map; import java.util.regex.Matcher; import java.util.regex.Pattern; @@ -226,17 +227,17 @@ public class DwarvenMinesWaypoints { } } } - String skyblockLocation = SBInfo.getInstance().location.toLowerCase(); + String skyblockLocation = SBInfo.getInstance().location.toLowerCase(Locale.ROOT); if (locWaypoint >= 1) { for (Map.Entry<String, Vector3f> entry : waypointsMap.entrySet()) { if (locWaypoint >= 2) { RenderUtils.renderWayPoint(EnumChatFormatting.AQUA + entry.getKey(), entry.getValue(), event.partialTicks); } else { - String commissionLocation = entry.getKey().toLowerCase(); + String commissionLocation = entry.getKey().toLowerCase(Locale.ROOT); for (String commissionName : MiningOverlay.commissionProgress.keySet()) { if (NotEnoughUpdates.INSTANCE.config.mining.hideWaypointIfAtLocation) if (commissionLocation.replace("'", "").equals(skyblockLocation)) continue; - if (commissionName.toLowerCase().contains(commissionLocation)) { + if (commissionName.toLowerCase(Locale.ROOT).contains(commissionLocation)) { if (commissionName.contains("Titanium")) { RenderUtils.renderWayPoint( EnumChatFormatting.WHITE + entry.getKey(), diff --git a/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/EnchantingSolvers.java b/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/EnchantingSolvers.java index a5c96e4a..588628c6 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/EnchantingSolvers.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/EnchantingSolvers.java @@ -44,6 +44,7 @@ import java.util.ArrayList; import java.util.HashMap; import java.util.HashSet; import java.util.List; +import java.util.Locale; import java.util.Map; @NEUAutoSubscribe @@ -498,7 +499,7 @@ public class EnchantingSolvers { if (display.hasKey("Lore", 9)) { NBTTagList list = display.getTagList("Lore", 8); for (int i = 0; i < list.tagCount(); i++) { - if (list.getStringTagAt(i).toLowerCase().contains("powerup")) { + if (list.getStringTagAt(i).toLowerCase(Locale.ROOT).contains("powerup")) { powerupMatches.add(index); continue out; } diff --git a/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/PetInfoOverlay.java b/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/PetInfoOverlay.java index fb12906a..c823cf88 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/PetInfoOverlay.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/PetInfoOverlay.java @@ -63,6 +63,7 @@ import java.util.HashMap; import java.util.HashSet; import java.util.LinkedList; import java.util.List; +import java.util.Locale; import java.util.Map; import java.util.Objects; import java.util.Set; @@ -308,7 +309,7 @@ public class PetInfoOverlay extends TextOverlay { pet.petType = petType; JsonObject petTypes = Constants.PETS.get("pet_types").getAsJsonObject(); pet.petXpType = - petTypes.has(pet.petType) ? petTypes.get(pet.petType.toUpperCase()).getAsString().toLowerCase() : "unknown"; + petTypes.has(pet.petType) ? petTypes.get(pet.petType.toUpperCase(Locale.ROOT)).getAsString().toLowerCase(Locale.ROOT) : "unknown"; pet.skin = skin; return pet; @@ -328,7 +329,7 @@ public class PetInfoOverlay extends TextOverlay { "alchemy", "all" ); - if (!validXpTypes.contains(xpType.toLowerCase())) return 0; + if (!validXpTypes.contains(xpType.toLowerCase(Locale.ROOT))) return 0; float tamingPercent = 1.0f + (config.tamingLevel / 100f); xp = xp * tamingPercent; @@ -354,10 +355,10 @@ public class PetInfoOverlay extends TextOverlay { } JsonObject pets = Constants.PETS; if (pets != null && pets.has("custom_pet_leveling") && - pets.get("custom_pet_leveling").getAsJsonObject().has(pet.petType.toUpperCase()) && - pets.get("custom_pet_leveling").getAsJsonObject().get(pet.petType.toUpperCase()).getAsJsonObject().has( + pets.get("custom_pet_leveling").getAsJsonObject().has(pet.petType.toUpperCase(Locale.ROOT)) && + pets.get("custom_pet_leveling").getAsJsonObject().get(pet.petType.toUpperCase(Locale.ROOT)).getAsJsonObject().has( "xp_multiplier")) { - xp *= pets.get("custom_pet_leveling").getAsJsonObject().get(pet.petType.toUpperCase()).getAsJsonObject().get( + xp *= pets.get("custom_pet_leveling").getAsJsonObject().get(pet.petType.toUpperCase(Locale.ROOT)).getAsJsonObject().get( "xp_multiplier").getAsFloat(); } return xp; @@ -660,7 +661,7 @@ public class PetInfoOverlay extends TextOverlay { public static float getBoostMultiplier(String boostName) { if (boostName == null) return 1; - boostName = boostName.toLowerCase(); + boostName = boostName.toLowerCase(Locale.ROOT); if (boostName.equalsIgnoreCase("PET_ITEM_ALL_SKILLS_BOOST_COMMON")) { return 1.1f; } else if (boostName.equalsIgnoreCase("ALL_SKILLS_SUPER_BOOST")) { @@ -859,7 +860,7 @@ public class PetInfoOverlay extends TextOverlay { String rarityString = Utils.getRarityFromInt(rarity); String name = StringUtils.cleanColour(petStack.getDisplayName()); - name = name.substring(name.indexOf(']') + 1).trim().replace(' ', '_').toUpperCase(); + name = name.substring(name.indexOf(']') + 1).trim().replace(' ', '_').toUpperCase(Locale.ROOT); float petXp = petInfoObject.get("exp").getAsFloat(); @@ -998,7 +999,7 @@ public class PetInfoOverlay extends TextOverlay { String pet = Utils.cleanColour(petName) .replaceAll("[^\\w ]", "").trim() - .replace(" ", "_").toUpperCase(); + .replace(" ", "_").toUpperCase(Locale.ROOT); setCurrentPet(getClosestPetIndex(pet, rarity.petId, "", lastLevelHovered)); if (PetInfoOverlay.config.selectedPet == -1) { @@ -1010,9 +1011,9 @@ public class PetInfoOverlay extends TextOverlay { EnumChatFormatting.RED + " try revisiting all pages of /pets.")); } } - } else if ((chatMessage.toLowerCase().startsWith("you despawned your")) || (chatMessage.toLowerCase().contains( + } else if ((chatMessage.toLowerCase(Locale.ROOT).startsWith("you despawned your")) || (chatMessage.toLowerCase(Locale.ROOT).contains( "switching to profile")) - || (chatMessage.toLowerCase().contains("transferring you to a new island..."))) { + || (chatMessage.toLowerCase(Locale.ROOT).contains("transferring you to a new island..."))) { clearPet(); } } diff --git a/src/main/java/io/github/moulberry/notenoughupdates/miscgui/CalendarOverlay.java b/src/main/java/io/github/moulberry/notenoughupdates/miscgui/CalendarOverlay.java index 1a50dfe4..f2af715c 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/miscgui/CalendarOverlay.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/miscgui/CalendarOverlay.java @@ -69,6 +69,7 @@ import java.time.temporal.ChronoUnit; import java.util.ArrayList; import java.util.Arrays; import java.util.List; +import java.util.Locale; import java.util.Map; import java.util.Optional; import java.util.Set; @@ -971,7 +972,7 @@ public class CalendarOverlay { private static String getIdForDisplayName(String displayName) { return Utils.cleanColour(displayName) - .toLowerCase() + .toLowerCase(Locale.ROOT) .replaceAll("[0-9]+th", "") .replaceAll("[0-9]+nd", "") .replaceAll("[0-9]+rd", "") diff --git a/src/main/java/io/github/moulberry/notenoughupdates/miscgui/GuiCustomEnchant.java b/src/main/java/io/github/moulberry/notenoughupdates/miscgui/GuiCustomEnchant.java index 6d219999..3041ee43 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/miscgui/GuiCustomEnchant.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/miscgui/GuiCustomEnchant.java @@ -65,6 +65,7 @@ import java.util.ArrayList; import java.util.Comparator; import java.util.HashMap; import java.util.List; +import java.util.Locale; import java.util.Objects; import java.util.Random; import java.util.regex.Matcher; @@ -381,7 +382,7 @@ public class GuiCustomEnchant extends Gui { if (enchantments != null) { String enchId = Utils .cleanColour(book.getDisplayName()) - .toLowerCase() + .toLowerCase(Locale.ROOT) .replace(" ", "_") .replace("-", "_") .replaceAll("[^a-z_]", ""); @@ -396,7 +397,7 @@ public class GuiCustomEnchant extends Gui { } Matcher levelMatcher = ENCHANT_LEVEL_PATTERN.matcher(enchId); if (levelMatcher.matches()) { - enchLevel = Utils.parseRomanNumeral(levelMatcher.group(2).toUpperCase()); + enchLevel = Utils.parseRomanNumeral(levelMatcher.group(2).toUpperCase(Locale.ROOT)); enchId = levelMatcher.group(1); } Enchantment enchantment = new Enchantment(slotIndex, name, enchId, @@ -457,7 +458,7 @@ public class GuiCustomEnchant extends Gui { if (enchantments != null) { String enchId = Utils .cleanColour(book.getDisplayName()) - .toLowerCase() + .toLowerCase(Locale.ROOT) .replace(" ", "_") .replace("-", "_") .replaceAll("[^a-z_]", ""); @@ -466,7 +467,7 @@ public class GuiCustomEnchant extends Gui { String name = Utils.cleanColour(book.getDisplayName()); if (searchField.getText().trim().isEmpty() || - name.toLowerCase().contains(searchField.getText().trim().toLowerCase())) { + name.toLowerCase(Locale.ROOT).contains(searchField.getText().trim().toLowerCase(Locale.ROOT))) { if (name.equalsIgnoreCase("Bane of Arthropods")) { name = "Bane of Arth."; } else if (name.equalsIgnoreCase("Projectile Protection")) { @@ -512,7 +513,7 @@ public class GuiCustomEnchant extends Gui { Comparator<Enchantment> comparator = cfg.enchantingSolvers.enchantSorting == 0 ? Comparator.comparingInt(e -> mult * e.xpCost) : (c1, c2) -> mult * - c1.enchId.toLowerCase().compareTo(c2.enchId.toLowerCase()); + c1.enchId.toLowerCase(Locale.ROOT).compareTo(c2.enchId.toLowerCase(Locale.ROOT)); removable.sort(comparator); applicable.sort(comparator); } diff --git a/src/main/java/io/github/moulberry/notenoughupdates/miscgui/GuiEnchantColour.java b/src/main/java/io/github/moulberry/notenoughupdates/miscgui/GuiEnchantColour.java index 174650d9..86ea09f9 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/miscgui/GuiEnchantColour.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/miscgui/GuiEnchantColour.java @@ -22,10 +22,7 @@ package io.github.moulberry.notenoughupdates.miscgui; import com.google.common.base.Splitter; import com.google.common.collect.Lists; import com.google.gson.JsonArray; -import com.google.gson.JsonParseException; -import com.google.gson.JsonParser; import com.google.gson.JsonPrimitive; -import info.bliki.api.Template; import io.github.moulberry.notenoughupdates.NotEnoughUpdates; import io.github.moulberry.notenoughupdates.core.util.lerp.LerpingInteger; import io.github.moulberry.notenoughupdates.itemeditor.GuiElementTextField; @@ -48,11 +45,10 @@ import java.awt.datatransfer.DataFlavor; import java.awt.datatransfer.StringSelection; import java.awt.datatransfer.UnsupportedFlavorException; import java.io.IOException; -import java.nio.charset.StandardCharsets; import java.util.ArrayList; -import java.util.Base64; import java.util.HashMap; import java.util.List; +import java.util.Locale; import java.util.Objects; import java.util.regex.Matcher; import java.util.regex.Pattern; @@ -154,8 +150,8 @@ public class GuiEnchantColour extends GuiScreen { String modifier = getColourOpIndex(colourOps, 4); modifiers.put(yIndex, modifier); - if (colourCode.length() > 1) colourCode = String.valueOf(colourCode.toLowerCase().charAt(0)); - if (comparator.length() > 1) comparator = String.valueOf(comparator.toLowerCase().charAt(0)); + if (colourCode.length() > 1) colourCode = String.valueOf(colourCode.toLowerCase(Locale.ROOT).charAt(0)); + if (comparator.length() > 1) comparator = String.valueOf(comparator.toLowerCase(Locale.ROOT).charAt(0)); Utils.drawStringCentered(comparator, guiLeft + 96, guiTop + 33 + 25 * yIndex, false, 4210752); diff --git a/src/main/java/io/github/moulberry/notenoughupdates/miscgui/GuiNavigation.java b/src/main/java/io/github/moulberry/notenoughupdates/miscgui/GuiNavigation.java index ba3f95df..6e36179a 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/miscgui/GuiNavigation.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/miscgui/GuiNavigation.java @@ -32,6 +32,7 @@ import java.io.IOException; import java.util.ArrayList; import java.util.Comparator; import java.util.List; +import java.util.Locale; import java.util.stream.Collectors; public class GuiNavigation extends GuiScreen { @@ -114,14 +115,14 @@ public class GuiNavigation extends GuiScreen { } private void refreshResults() { - String text = textField.getText().toLowerCase(); + String text = textField.getText().toLowerCase(Locale.ROOT); List<String> results = NotEnoughUpdates.INSTANCE.navigation .getWaypoints() .values() .stream() .filter(it -> - it.get("internalname").getAsString().toLowerCase().contains(text) - || it.get("displayname").getAsString().toLowerCase().contains(text)) + it.get("internalname").getAsString().toLowerCase(Locale.ROOT).contains(text) + || it.get("displayname").getAsString().toLowerCase(Locale.ROOT).contains(text)) .map(it -> it.get("internalname").getAsString()) .sorted(Comparator.comparing(String::length) .thenComparing(String.CASE_INSENSITIVE_ORDER)) diff --git a/src/main/java/io/github/moulberry/notenoughupdates/miscgui/hex/GuiCustomHex.java b/src/main/java/io/github/moulberry/notenoughupdates/miscgui/hex/GuiCustomHex.java index 1da81605..f2b7b1c8 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/miscgui/hex/GuiCustomHex.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/miscgui/hex/GuiCustomHex.java @@ -72,6 +72,7 @@ import java.util.Arrays; import java.util.Comparator; import java.util.HashMap; import java.util.List; +import java.util.Locale; import java.util.Objects; import java.util.Random; import java.util.regex.Matcher; @@ -116,7 +117,7 @@ public class GuiCustomHex extends Gui { } } JsonObject bazaarInfo = NotEnoughUpdates.INSTANCE.manager.auctionManager.getBazaarInfo( - (isUlt ? "ULTIMATE_" : "") + enchId.toUpperCase() + ";" + level); + (isUlt ? "ULTIMATE_" : "") + enchId.toUpperCase(Locale.ROOT) + ";" + level); if (bazaarInfo != null && bazaarInfo.get("curr_buy") != null) { this.price = bazaarInfo.get("curr_buy").getAsInt(); } @@ -476,7 +477,7 @@ public class GuiCustomHex extends Gui { if (enchantments != null) { String enchId = Utils .cleanColour(book.getDisplayName()) - .toLowerCase() + .toLowerCase(Locale.ROOT) .replace(" ", "_") .replace("-", "_") .replaceAll("[^a-z_]", ""); @@ -493,7 +494,7 @@ public class GuiCustomHex extends Gui { } Matcher levelMatcher = ENCHANT_LEVEL_PATTERN.matcher(enchId); if (levelMatcher.matches()) { - enchLevel = Utils.parseRomanNumeral(levelMatcher.group(2).toUpperCase()); + enchLevel = Utils.parseRomanNumeral(levelMatcher.group(2).toUpperCase(Locale.ROOT)); enchId = levelMatcher.group(1); } Enchantment enchantment = new Enchantment(slotIndex, name, enchId, @@ -595,7 +596,7 @@ public class GuiCustomHex extends Gui { if (enchantments != null) { String enchId = Utils .cleanColour(book.getDisplayName()) - .toLowerCase() + .toLowerCase(Locale.ROOT) .replace(" ", "_") .replace("-", "_") .replaceAll("[^a-z_]", ""); @@ -604,7 +605,7 @@ public class GuiCustomHex extends Gui { String name = Utils.cleanColour(book.getDisplayName()); if (searchField.getText().trim().isEmpty() || - name.toLowerCase().contains(searchField.getText().trim().toLowerCase())) { + name.toLowerCase(Locale.ROOT).contains(searchField.getText().trim().toLowerCase(Locale.ROOT))) { if (name.equalsIgnoreCase("Bane of Arthropods")) { name = "Bane of Arth."; } else if (name.equalsIgnoreCase("Projectile Protection")) { @@ -650,7 +651,7 @@ public class GuiCustomHex extends Gui { Comparator<Enchantment> comparator = cfg.enchantingSolvers.enchantSorting == 0 ? Comparator.comparingInt(e -> mult * e.xpCost) : (c1, c2) -> mult * - c1.enchId.toLowerCase().compareTo(c2.enchId.toLowerCase()); + c1.enchId.toLowerCase(Locale.ROOT).compareTo(c2.enchId.toLowerCase(Locale.ROOT)); removable.sort(comparator); applicable.sort(comparator); } @@ -798,7 +799,7 @@ public class GuiCustomHex extends Gui { if (ea != null) { NBTTagCompound enchantments = ea.getCompoundTag("enchantments"); if (enchantments != null) { - String itemId = Utils.cleanColour(book.getDisplayName()).toUpperCase().replace(" ", "_").replace( + String itemId = Utils.cleanColour(book.getDisplayName()).toUpperCase(Locale.ROOT).replace(" ", "_").replace( "-", "_" ); @@ -806,7 +807,7 @@ public class GuiCustomHex extends Gui { if (itemId.equalsIgnoreCase("_")) continue; if (itemId.equalsIgnoreCase("Item_Maxed_Out")) continue; if (searchField.getText().trim().isEmpty() || - name.toLowerCase().contains(searchField.getText().trim().toLowerCase())) { + name.toLowerCase(Locale.ROOT).contains(searchField.getText().trim().toLowerCase(Locale.ROOT))) { name = fixName(name); /*if (playerEnchantIds.containsKey(itemId)) { HexItem item = new HexItem(slotIndex, name, itemId, @@ -966,7 +967,7 @@ public class GuiCustomHex extends Gui { Comparator<HexItem> comparator = cfg.enchantingSolvers.enchantSorting == 0 ? Comparator.comparingInt(e -> (int) (mult * e.price)) : (c1, c2) -> mult * - c1.itemId.toLowerCase().compareTo(c2.itemId.toLowerCase()); + c1.itemId.toLowerCase(Locale.ROOT).compareTo(c2.itemId.toLowerCase(Locale.ROOT)); removableItem.sort(comparator); applicableItem.sort(comparator); } @@ -1040,7 +1041,7 @@ public class GuiCustomHex extends Gui { if (ea != null) { NBTTagCompound enchantments = ea.getCompoundTag("enchantments"); if (enchantments != null) { - String itemId = Utils.cleanColour(book.getDisplayName()).toUpperCase().replace(" ", "_").replace( + String itemId = Utils.cleanColour(book.getDisplayName()).toUpperCase(Locale.ROOT).replace(" ", "_").replace( "-", "_" ); @@ -1048,7 +1049,7 @@ public class GuiCustomHex extends Gui { if (itemId.equalsIgnoreCase("_")) continue; if (itemId.equalsIgnoreCase("Item_Maxed_Out")) continue; if (searchField.getText().trim().isEmpty() || - name.toLowerCase().contains(searchField.getText().trim().toLowerCase())) { + name.toLowerCase(Locale.ROOT).contains(searchField.getText().trim().toLowerCase(Locale.ROOT))) { if (name.equalsIgnoreCase("Ultimate Enchantments")) { name = "Ult Enchants"; } @@ -1085,7 +1086,7 @@ public class GuiCustomHex extends Gui { Comparator<HexItem> comparator = cfg.enchantingSolvers.enchantSorting == 0 ? Comparator.comparingInt(e -> (int) (mult * e.price)) : (c1, c2) -> mult * - c1.itemId.toLowerCase().compareTo(c2.itemId.toLowerCase()); + c1.itemId.toLowerCase(Locale.ROOT).compareTo(c2.itemId.toLowerCase(Locale.ROOT)); removableItem.sort(comparator); applicableItem.sort(comparator); } @@ -1187,7 +1188,7 @@ public class GuiCustomHex extends Gui { if (ea != null) { NBTTagCompound enchantments = ea.getCompoundTag("enchantments"); if (enchantments != null) { - String itemId = Utils.cleanColour(book.getDisplayName()).toUpperCase().replace(" ", "_").replace( + String itemId = Utils.cleanColour(book.getDisplayName()).toUpperCase(Locale.ROOT).replace(" ", "_").replace( "-", "_" ); @@ -1195,7 +1196,7 @@ public class GuiCustomHex extends Gui { if (itemId.equalsIgnoreCase("_")) continue; if (itemId.equalsIgnoreCase("Item_Maxed_Out")) continue; if (searchField.getText().trim().isEmpty() || - name.toLowerCase().contains(searchField.getText().trim().toLowerCase())) { + name.toLowerCase(Locale.ROOT).contains(searchField.getText().trim().toLowerCase(Locale.ROOT))) { /*if (playerEnchantIds.containsKey(itemId)) { HexItem item = new HexItem(slotIndex, name, itemId, Utils.getRawTooltip(book), false, false @@ -1247,7 +1248,7 @@ public class GuiCustomHex extends Gui { Comparator<HexItem> comparator = cfg.enchantingSolvers.enchantSorting == 0 ? Comparator.comparingInt(e -> (int) (mult * e.price)) : (c1, c2) -> mult * - c1.itemId.toLowerCase().compareTo(c2.itemId.toLowerCase()); + c1.itemId.toLowerCase(Locale.ROOT).compareTo(c2.itemId.toLowerCase(Locale.ROOT)); removableItem.sort(comparator); applicableItem.sort(comparator); } diff --git a/src/main/java/io/github/moulberry/notenoughupdates/miscgui/hex/HexItem.java b/src/main/java/io/github/moulberry/notenoughupdates/miscgui/hex/HexItem.java index 8d28dd1d..ab871888 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/miscgui/hex/HexItem.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/miscgui/hex/HexItem.java @@ -26,6 +26,7 @@ import io.github.moulberry.notenoughupdates.util.Utils; import net.minecraft.util.StringUtils; import java.util.List; +import java.util.Locale; public class HexItem { public int slotIndex; @@ -255,8 +256,8 @@ public class HexItem { public String getReforge() { JsonObject reforgeStones = Constants.REFORGESTONES; - if (reforgeStones != null && reforgeStones.has(this.itemId.toUpperCase())) { - JsonObject reforgeInfo = reforgeStones.get(this.itemId.toUpperCase()).getAsJsonObject(); + if (reforgeStones != null && reforgeStones.has(this.itemId.toUpperCase(Locale.ROOT))) { + JsonObject reforgeInfo = reforgeStones.get(this.itemId.toUpperCase(Locale.ROOT)).getAsJsonObject(); if (reforgeInfo != null) { return Utils.getElementAsString(reforgeInfo.get("reforgeName"), ""); } diff --git a/src/main/java/io/github/moulberry/notenoughupdates/miscgui/minionhelper/MinionHelperManager.java b/src/main/java/io/github/moulberry/notenoughupdates/miscgui/minionhelper/MinionHelperManager.java index 03eb227c..16ad9d00 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/miscgui/minionhelper/MinionHelperManager.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/miscgui/minionhelper/MinionHelperManager.java @@ -40,6 +40,7 @@ import net.minecraftforge.common.MinecraftForge; import java.util.ArrayList; import java.util.HashMap; import java.util.List; +import java.util.Locale; import java.util.Map; @NEUAutoSubscribe @@ -123,7 +124,7 @@ public class MinionHelperManager { } public String formatInternalName(String minionName) { - return minionName.toUpperCase().replace(" ", "_"); + return minionName.toUpperCase(Locale.ROOT).replace(" ", "_"); } private List<Minion> getChildren(Minion minion) { diff --git a/src/main/java/io/github/moulberry/notenoughupdates/miscgui/minionhelper/loaders/repo/MinionHelperRepoMinionLoader.java b/src/main/java/io/github/moulberry/notenoughupdates/miscgui/minionhelper/loaders/repo/MinionHelperRepoMinionLoader.java index 6abc5c56..8d2aaaf4 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/miscgui/minionhelper/loaders/repo/MinionHelperRepoMinionLoader.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/miscgui/minionhelper/loaders/repo/MinionHelperRepoMinionLoader.java @@ -31,6 +31,7 @@ import io.github.moulberry.notenoughupdates.miscgui.minionhelper.requirements.Sl import io.github.moulberry.notenoughupdates.miscgui.minionhelper.sources.CraftingSource; import io.github.moulberry.notenoughupdates.util.Utils; +import java.util.Locale; import java.util.Map; import java.util.TreeMap; import java.util.regex.Pattern; @@ -97,7 +98,7 @@ public class MinionHelperRepoMinionLoader { } case "slayer_req": { String[] split = value.split("_"); - String slayerType = split[0].toLowerCase(); + String slayerType = split[0].toLowerCase(Locale.ROOT); int tier = Integer.parseInt(split[1]); minion.getRequirements().add(new SlayerRequirement(slayerType, tier)); break; diff --git a/src/main/java/io/github/moulberry/notenoughupdates/miscgui/minionhelper/render/MinionHelperOverlayHover.java b/src/main/java/io/github/moulberry/notenoughupdates/miscgui/minionhelper/render/MinionHelperOverlayHover.java index 18b26754..df3559ba 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/miscgui/minionhelper/render/MinionHelperOverlayHover.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/miscgui/minionhelper/render/MinionHelperOverlayHover.java @@ -45,6 +45,7 @@ import java.util.ArrayList; import java.util.HashMap; import java.util.LinkedHashMap; import java.util.List; +import java.util.Locale; import java.util.Map; public class MinionHelperOverlayHover { @@ -227,7 +228,7 @@ public class MinionHelperOverlayHover { int need = reputationRequirement.getReputation(); if (having < 0) having = 0; - String reputationName = StringUtils.firstUpperLetter(reputationType.toLowerCase()); + String reputationName = StringUtils.firstUpperLetter(reputationType.toLowerCase(Locale.ROOT)); String havingFormat = Utils.formatNumberWithDots(having); String needFormat = Utils.formatNumberWithDots(need); description = "Reputation: §c" + havingFormat + "§8/§c" + needFormat + " §7" + reputationName + " Reputation"; diff --git a/src/main/java/io/github/moulberry/notenoughupdates/miscgui/minionhelper/requirements/ReputationRequirement.java b/src/main/java/io/github/moulberry/notenoughupdates/miscgui/minionhelper/requirements/ReputationRequirement.java index 70d1e5fc..8aaad623 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/miscgui/minionhelper/requirements/ReputationRequirement.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/miscgui/minionhelper/requirements/ReputationRequirement.java @@ -22,6 +22,8 @@ package io.github.moulberry.notenoughupdates.miscgui.minionhelper.requirements; import io.github.moulberry.notenoughupdates.core.util.StringUtils; import io.github.moulberry.notenoughupdates.util.Utils; +import java.util.Locale; + public class ReputationRequirement extends MinionRequirement { private final String reputationType; @@ -32,7 +34,7 @@ public class ReputationRequirement extends MinionRequirement { this.reputationType = reputationType; this.reputation = reputation; - String reputationName = StringUtils.firstUpperLetter(reputationType.toLowerCase()); + String reputationName = StringUtils.firstUpperLetter(reputationType.toLowerCase(Locale.ROOT)); description = Utils.formatNumberWithDots(reputation) + " §7" + reputationName + " Reputation"; } diff --git a/src/main/java/io/github/moulberry/notenoughupdates/overlays/MiningOverlay.java b/src/main/java/io/github/moulberry/notenoughupdates/overlays/MiningOverlay.java index 90433a51..ad5100e3 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/overlays/MiningOverlay.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/overlays/MiningOverlay.java @@ -49,6 +49,7 @@ import java.util.HashMap; import java.util.HashSet; import java.util.LinkedHashMap; import java.util.List; +import java.util.Locale; import java.util.Map; import java.util.Set; import java.util.function.Supplier; @@ -836,7 +837,7 @@ public class MiningOverlay extends TextTabOverlay { icon = miningOverlayCommissionItems.get("Mithril"); } else if (beforeColon.endsWith(" Gemstone Collector")) { String gemName = "ROUGH_" - + beforeColon.replace(" Gemstone Collector", "").toUpperCase() + "_GEM"; + + beforeColon.replace(" Gemstone Collector", "").toUpperCase(Locale.ROOT) + "_GEM"; if (miningOverlayRoughGems.containsKey(gemName)) { icon = miningOverlayRoughGems.get(gemName); } else { @@ -847,7 +848,7 @@ public class MiningOverlay extends TextTabOverlay { } } else if (beforeColon.endsWith(" Crystal Hunter")) { String gemName = "PERFECT_" - + beforeColon.replace(" Crystal Hunter", "").toUpperCase() + "_GEM"; + + beforeColon.replace(" Crystal Hunter", "").toUpperCase(Locale.ROOT) + "_GEM"; if (miningOverlayPerfectGems.containsKey(gemName)) { icon = miningOverlayPerfectGems.get(gemName); } else { diff --git a/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/BasicPage.java b/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/BasicPage.java index 025b09b7..60099e2b 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/BasicPage.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/BasicPage.java @@ -65,6 +65,7 @@ import java.util.Arrays; import java.util.Collections; import java.util.LinkedHashMap; import java.util.List; +import java.util.Locale; import java.util.Map; import java.util.Optional; import java.util.UUID; @@ -695,7 +696,7 @@ public class BasicPage extends GuiProfileViewerPage { String totalXpS = StringUtils.formatNumber((long) level.totalXp); tooltipToDisplay.add(EnumChatFormatting.GRAY + "Total XP: " + EnumChatFormatting.DARK_PURPLE + totalXpS + EnumChatFormatting.DARK_GRAY + " (" + - StringUtils.formatToTenths(guiProfileViewer.getPercentage(entry.getKey().toLowerCase(), level)) + + StringUtils.formatToTenths(guiProfileViewer.getPercentage(entry.getKey().toLowerCase(Locale.ROOT), level)) + "% to " + level.maxLevel + ")"); if (entry.getKey().equals("farming")) { // double drops + pelts @@ -715,7 +716,7 @@ public class BasicPage extends GuiProfileViewerPage { tooltipToDisplay.add(" "); for (String medalName : medalNames) { String textWithoutFormattingCodes = - EnumChatFormatting.getTextWithoutFormattingCodes(medalName.toLowerCase()); + EnumChatFormatting.getTextWithoutFormattingCodes(medalName.toLowerCase(Locale.ROOT)); if (medals_inv.has(textWithoutFormattingCodes)) { int medalAmount = medals_inv.get(textWithoutFormattingCodes).getAsInt(); tooltipToDisplay.add(EnumChatFormatting.GRAY + WordUtils.capitalize(medalName) + ": " + @@ -727,7 +728,7 @@ public class BasicPage extends GuiProfileViewerPage { } } - String slayerNameLower = entry.getKey().toLowerCase(); + String slayerNameLower = entry.getKey().toLowerCase(Locale.ROOT); if (Weight.SLAYER_NAMES.contains(slayerNameLower)) { JsonObject slayerToTier = Constants.LEVELING.getAsJsonObject("slayer_to_highest_tier"); if (slayerToTier == null) { diff --git a/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/GuiProfileViewer.java b/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/GuiProfileViewer.java index ba42834c..08340f23 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/GuiProfileViewer.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/GuiProfileViewer.java @@ -63,6 +63,7 @@ import java.util.ArrayList; 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.Optional; @@ -719,13 +720,13 @@ public class GuiProfileViewer extends GuiScreen { boolean selected = Objects.equals(Minecraft.getMinecraft().thePlayer.getName(), playerName); if (selected == renderCurrent) { - renderRecentPlayer(Minecraft.getMinecraft().thePlayer.getName().toLowerCase(), 0, selected); + renderRecentPlayer(Minecraft.getMinecraft().thePlayer.getName().toLowerCase(Locale.ROOT), 0, selected); } List<String> previousProfileSearches = NotEnoughUpdates.INSTANCE.config.hidden.previousProfileSearches; for (int i = 0; i < previousProfileSearches.size(); i++) { - selected = Objects.equals(previousProfileSearches.get(i), playerName.toLowerCase()); + selected = Objects.equals(previousProfileSearches.get(i), playerName.toLowerCase(Locale.ROOT)); if (selected == renderCurrent) { renderRecentPlayer(previousProfileSearches.get(i), i + 1, selected); } @@ -827,7 +828,7 @@ public class GuiProfileViewer extends GuiScreen { if (mouseX > x && mouseX < x + 29) { if (mouseY > y && mouseY < y + 28) { - if (!playerName.equals(Minecraft.getMinecraft().thePlayer.getName().toLowerCase())) { + if (!playerName.equals(Minecraft.getMinecraft().thePlayer.getName().toLowerCase(Locale.ROOT))) { NotEnoughUpdates.profileViewer.loadPlayerByName(Minecraft.getMinecraft().thePlayer.getName(), profile -> { profile.resetCache(); NotEnoughUpdates.INSTANCE.openGui = new GuiProfileViewer(profile); @@ -988,7 +989,7 @@ public class GuiProfileViewer extends GuiScreen { renderGoldBar(x, y + 6, xSize); } else { if ((skillName.contains("Catacombs") || Weight.DUNGEON_CLASS_NAMES.stream().anyMatch(e -> skillName - .toLowerCase() + .toLowerCase(Locale.ROOT) .contains(e))) && levelObj.level >= 50) { renderGoldBar(x, y + 6, xSize); } else { @@ -1003,7 +1004,7 @@ public class GuiProfileViewer extends GuiScreen { if (skillName.contains("Catacombs")) { totalXpStr = EnumChatFormatting.GRAY + "Total XP: " + EnumChatFormatting.DARK_PURPLE + StringUtils.formatNumber(levelObj.totalXp) + EnumChatFormatting.DARK_GRAY + " (" + - StringUtils.formatToTenths(getPercentage(skillName.toLowerCase(), levelObj)) + "% to 50)"; + StringUtils.formatToTenths(getPercentage(skillName.toLowerCase(Locale.ROOT), levelObj)) + "% to 50)"; } // Adds overflow level to each level object that is maxed, avoids hotm level as there is no overflow xp for it if (levelObj.maxed) { diff --git a/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/PlayerStats.java b/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/PlayerStats.java index 2f9ca90b..2b8ebf12 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/PlayerStats.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/PlayerStats.java @@ -40,6 +40,7 @@ import java.io.ByteArrayInputStream; import java.io.IOException; import java.util.HashMap; import java.util.HashSet; +import java.util.Locale; import java.util.Map; import java.util.regex.Matcher; import java.util.regex.Pattern; @@ -182,7 +183,7 @@ public class PlayerStats { int petScore = 0; for (String value : highestRarityMap.values()) { - petScore += Utils.getElementAsFloat(Utils.getElement(bonuses, "pet_value." + value.toUpperCase()), 0); + petScore += Utils.getElementAsFloat(Utils.getElement(bonuses, "pet_value." + value.toUpperCase(Locale.ROOT)), 0); } return petScore; } @@ -522,7 +523,7 @@ public class PlayerStats { float statMin = min.get("statNums").getAsJsonObject().get(entry.getKey()).getAsFloat(); float val = statMin * minMix + statMax * maxMix; - stats.addStat(entry.getKey().toLowerCase(), (int) Math.floor(val)); + stats.addStat(entry.getKey().toLowerCase(Locale.ROOT), (int) Math.floor(val)); } } @@ -531,7 +532,7 @@ public class PlayerStats { HashMap<String, Float> petStatBootsMult = GuiProfileViewer.PET_STAT_BOOSTS_MULT.get(heldItem); if (petStatBoots != null) { for (Map.Entry<String, Float> entryBoost : petStatBoots.entrySet()) { - String key = entryBoost.getKey().toLowerCase(); + String key = entryBoost.getKey().toLowerCase(Locale.ROOT); try { stats.addStat(key, entryBoost.getValue()); } catch (Exception ignored) {} @@ -539,7 +540,7 @@ public class PlayerStats { } if (petStatBootsMult != null) { for (Map.Entry<String, Float> entryBoost : petStatBootsMult.entrySet()) { - String key = entryBoost.getKey().toLowerCase(); + String key = entryBoost.getKey().toLowerCase(Locale.ROOT); try { stats.scale(key, entryBoost.getValue()); } catch (Exception ignored) {} @@ -664,7 +665,7 @@ public class PlayerStats { return null; } String selectedPower = profileInfo.get(abs).getAsJsonObject().get("selected_power").getAsString(); - return selectedPower.substring(0, 1).toUpperCase() + selectedPower.substring(1); + return selectedPower.substring(0, 1).toUpperCase(Locale.ROOT) + selectedPower.substring(1); } public static @Nullable QuiverInfo getQuiverInfo(Map<String, JsonArray> inventoryInfo, JsonObject profileInfo) { diff --git a/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/ProfileViewer.java b/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/ProfileViewer.java index ca588d7c..0418108f 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/ProfileViewer.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/ProfileViewer.java @@ -34,6 +34,7 @@ import net.minecraft.util.EnumChatFormatting; import java.util.HashMap; import java.util.LinkedHashMap; import java.util.List; +import java.util.Locale; import java.util.concurrent.atomic.AtomicBoolean; import java.util.function.Consumer; @@ -513,7 +514,7 @@ public class ProfileViewer { } public void getPlayerUUID(String name, Consumer<String> uuidCallback) { - String nameLower = name.toLowerCase(); + String nameLower = name.toLowerCase(Locale.ROOT); if (nameToUuid.containsKey(nameLower)) { uuidCallback.accept(nameToUuid.get(nameLower)); return; @@ -536,7 +537,7 @@ public class ProfileViewer { } public void loadPlayerByName(String name, Consumer<SkyblockProfiles> callback) { - String nameLower = name.toLowerCase(); + String nameLower = name.toLowerCase(Locale.ROOT); if (nameToUuid.containsKey(nameLower) && nameToUuid.get(nameLower) == null) { callback.accept(null); diff --git a/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/ProfileViewerUtils.java b/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/ProfileViewerUtils.java index 038b9e14..f56f1fd1 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/ProfileViewerUtils.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/ProfileViewerUtils.java @@ -46,6 +46,7 @@ import java.util.HashMap; import java.util.HashSet; import java.util.LinkedHashMap; import java.util.List; +import java.util.Locale; import java.util.Map; import java.util.Objects; import java.util.Set; @@ -224,8 +225,8 @@ public class ProfileViewerUtils { public static void saveSearch(String username) { if (username == null) return; - String nameLower = username.toLowerCase(); - if (nameLower.equals(Minecraft.getMinecraft().thePlayer.getName().toLowerCase())) return; + String nameLower = username.toLowerCase(Locale.ROOT); + if (nameLower.equals(Minecraft.getMinecraft().thePlayer.getName().toLowerCase(Locale.ROOT))) return; List<String> previousProfileSearches = NotEnoughUpdates.INSTANCE.config.hidden.previousProfileSearches; previousProfileSearches.remove(nameLower); previousProfileSearches.add(0, nameLower); @@ -244,7 +245,7 @@ public class ProfileViewerUtils { public static ItemStack getPlayerData(String username) { if (username == null) return new ItemStack(Blocks.stone); - String nameLower = username.toLowerCase(); + String nameLower = username.toLowerCase(Locale.ROOT); if (!playerSkullCache.containsKey(nameLower)) { playerSkullCache.put(nameLower, fallBackSkull()); diff --git a/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/SkyblockProfiles.java b/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/SkyblockProfiles.java index 25111031..ebc35a39 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/SkyblockProfiles.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/SkyblockProfiles.java @@ -58,6 +58,7 @@ import java.util.Comparator; import java.util.HashMap; import java.util.LinkedHashMap; import java.util.List; +import java.util.Locale; import java.util.Map; import java.util.Objects; import java.util.concurrent.atomic.AtomicBoolean; @@ -925,7 +926,7 @@ public class SkyblockProfiles { } } else { skillExperience += Utils.getElementAsFloat( - Utils.getElement(profileJson, "player_data.experience.SKILL_" + skillName.toUpperCase()), + Utils.getElement(profileJson, "player_data.experience.SKILL_" + skillName.toUpperCase(Locale.ROOT)), 0 ); } diff --git a/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/level/task/EssenceTaskLevel.java b/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/level/task/EssenceTaskLevel.java index 7d42ce30..478b9db2 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/level/task/EssenceTaskLevel.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/level/task/EssenceTaskLevel.java @@ -31,6 +31,7 @@ import net.minecraft.util.EnumChatFormatting; import java.util.ArrayList; import java.util.HashMap; import java.util.List; +import java.util.Locale; import java.util.Map; public class EssenceTaskLevel extends GuiTaskLevel { @@ -78,7 +79,7 @@ public class EssenceTaskLevel extends GuiTaskLevel { for (Map.Entry<String, JsonElement> stringJsonElementEntry : essenceShopTask.entrySet()) { String key = stringJsonElementEntry.getKey(); if (!key.endsWith("_shop")) continue; - String name = key.split("_shop")[0].toUpperCase(); + String name = key.split("_shop")[0].toUpperCase(Locale.ROOT); if (!loreMap.containsKey(name)) { loreMap.put(name, new EssenceShop().setName(name).setCurrent(0)); } @@ -99,7 +100,7 @@ public class EssenceTaskLevel extends GuiTaskLevel { value.name = jsonObject .get("displayname") .getAsString(); - String name = key.toLowerCase() + "_shop"; + String name = key.toLowerCase(Locale.ROOT) + "_shop"; if (!essenceShopTask.has(name)) continue; value.max = essenceShopTask.get(name).getAsInt(); lore.add(levelPage.buildLore( diff --git a/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/rift/RiftPage.java b/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/rift/RiftPage.java index 721ba23b..924970f1 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/rift/RiftPage.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/rift/RiftPage.java @@ -55,6 +55,7 @@ import java.util.Base64; import java.util.Collections; import java.util.List; import java.util.ListIterator; +import java.util.Locale; public class RiftPage extends GuiProfileViewerPage { @@ -199,7 +200,7 @@ public class RiftPage extends GuiProfileViewerPage { List<String> displayNames = new ArrayList<>(); for (JsonElement jsonElement : timecharm) { - String timecharmType = jsonElement.getAsJsonObject().get("type").getAsString().toUpperCase(); + String timecharmType = jsonElement.getAsJsonObject().get("type").getAsString().toUpperCase(Locale.ROOT); ItemStack timecharmItem = NotEnoughUpdates.INSTANCE.manager.createItemResolutionQuery().withKnownInternalName( "RIFT_TROPHY_" + timecharmType).resolveToItemStack(); if (timecharmItem != null) { diff --git a/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/trophy/TrophyFish.java b/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/trophy/TrophyFish.java index 5a3027c3..5984d452 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/trophy/TrophyFish.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/trophy/TrophyFish.java @@ -19,6 +19,7 @@ package io.github.moulberry.notenoughupdates.profileviewer.trophy; +import java.util.Locale; import java.util.Map; public class TrophyFish { @@ -59,7 +60,7 @@ public class TrophyFish { } public String getInternalName() { - return name.toLowerCase().replace(" ", "_"); + return name.toLowerCase(Locale.ROOT).replace(" ", "_"); } public enum TrophyFishRarity { diff --git a/src/main/java/io/github/moulberry/notenoughupdates/util/ItemUtils.java b/src/main/java/io/github/moulberry/notenoughupdates/util/ItemUtils.java index cc974841..c013ba06 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/util/ItemUtils.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/util/ItemUtils.java @@ -48,6 +48,7 @@ import java.util.Arrays; import java.util.Base64; import java.util.Collections; import java.util.List; +import java.util.Locale; import java.util.Map; import java.util.function.BiFunction; @@ -234,7 +235,7 @@ public class ItemUtils { return stack; } String petname = currentPet.petType; - String tier = Utils.getRarityFromInt(currentPet.rarity.petId).toUpperCase(); + String tier = Utils.getRarityFromInt(currentPet.rarity.petId).toUpperCase(Locale.ROOT); String heldItem = currentPet.petItem; String skin = currentPet.skin; JsonObject heldItemJson = heldItem == null ? null : NotEnoughUpdates.INSTANCE.manager.getItemInformation().get( @@ -410,13 +411,13 @@ public class ItemUtils { NBTTagList newLore = new NBTTagList(); int maxLvl = 100; if (Constants.PETS != null && Constants.PETS.has("custom_pet_leveling") && - Constants.PETS.getAsJsonObject("custom_pet_leveling").has(pet.petType.toUpperCase()) && - Constants.PETS.getAsJsonObject("custom_pet_leveling").getAsJsonObject(pet.petType.toUpperCase()).has( + Constants.PETS.getAsJsonObject("custom_pet_leveling").has(pet.petType.toUpperCase(Locale.ROOT)) && + Constants.PETS.getAsJsonObject("custom_pet_leveling").getAsJsonObject(pet.petType.toUpperCase(Locale.ROOT)).has( "max_level")) { maxLvl = Constants.PETS .getAsJsonObject("custom_pet_leveling") - .getAsJsonObject(pet.petType.toUpperCase()) + .getAsJsonObject(pet.petType.toUpperCase(Locale.ROOT)) .get("max_level") .getAsInt(); } diff --git a/src/main/java/io/github/moulberry/notenoughupdates/util/SBInfo.java b/src/main/java/io/github/moulberry/notenoughupdates/util/SBInfo.java index 86799147..ebcae9c6 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/util/SBInfo.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/util/SBInfo.java @@ -351,7 +351,7 @@ public class SBInfo { // if (matcher.find()) { // try { // int level = Integer.parseInt(matcher.group(2).trim()); -// XPInformation.getInstance().updateLevel(matcher.group(1).toLowerCase().trim(), level); +// XPInformation.getInstance().updateLevel(matcher.group(1).toLowerCase(Locale.ROOT).trim(), level); // } catch (Exception ignored) { // } // } diff --git a/src/main/java/io/github/moulberry/notenoughupdates/util/Utils.java b/src/main/java/io/github/moulberry/notenoughupdates/util/Utils.java index 6b597ebe..fee8c594 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/util/Utils.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/util/Utils.java @@ -97,6 +97,7 @@ import java.util.Collections; import java.util.HashMap; import java.util.LinkedList; import java.util.List; +import java.util.Locale; import java.util.TimeZone; import java.util.UUID; import java.util.regex.Matcher; @@ -673,7 +674,7 @@ public class Utils { } public static String prettyCase(String str) { - return str.substring(0, 1).toUpperCase() + str.substring(1).toLowerCase(); + return str.substring(0, 1).toUpperCase(Locale.ROOT) + str.substring(1).toLowerCase(Locale.ROOT); } public static String getRarityFromInt(int rarity) { diff --git a/src/main/java/io/github/moulberry/notenoughupdates/util/XPInformation.java b/src/main/java/io/github/moulberry/notenoughupdates/util/XPInformation.java index 8336fbd0..ab8ece6c 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/util/XPInformation.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/util/XPInformation.java @@ -35,6 +35,7 @@ import org.jetbrains.annotations.Nullable; import java.util.HashMap; import java.util.HashSet; import java.util.List; +import java.util.Locale; import java.util.Set; import java.util.regex.Matcher; import java.util.regex.Pattern; @@ -78,8 +79,8 @@ public class XPInformation { } public @Nullable SkillInfo getSkillInfo(String skillName, boolean isHighlyInterested) { - var obj = skillInfoMap.get(skillName.toLowerCase()); - if (isHighlyInterested && failedSkills.contains(skillName.toLowerCase())) { + var obj = skillInfoMap.get(skillName.toLowerCase(Locale.ROOT)); + if (isHighlyInterested && failedSkills.contains(skillName.toLowerCase(Locale.ROOT))) { TablistAPI.getWidgetLines(TablistAPI.WidgetNames.SKILLS); } return obj; @@ -130,7 +131,7 @@ public class XPInformation { skillInfo.level++; } - skillInfoMap.put(skillS.toLowerCase(), skillInfo); + skillInfoMap.put(skillS.toLowerCase(Locale.ROOT), skillInfo); return; } else { matcher = SKILL_PATTERN_PERCENTAGE.matcher(component); @@ -139,11 +140,11 @@ public class XPInformation { String xpPercentageS = matcher.group(3).replace(",", ""); float xpPercentage = Float.parseFloat(xpPercentageS); - if (updateWithPercentage.containsKey(skillS.toLowerCase())) { - failedSkills.add(skillS.toLowerCase()); + if (updateWithPercentage.containsKey(skillS.toLowerCase(Locale.ROOT))) { + failedSkills.add(skillS.toLowerCase(Locale.ROOT)); } - updateWithPercentage.put(skillS.toLowerCase(), xpPercentage); - increment.put(skillS.toLowerCase(), Float.parseFloat(matcher.group(1).replace(",", ""))); + updateWithPercentage.put(skillS.toLowerCase(Locale.ROOT), xpPercentage); + increment.put(skillS.toLowerCase(Locale.ROOT), Float.parseFloat(matcher.group(1).replace(",", ""))); } else { matcher = SKILL_PATTERN_MULTIPLIER.matcher(component); @@ -183,7 +184,7 @@ public class XPInformation { skillInfo.level++; } - skillInfoMap.put(skillS.toLowerCase(), skillInfo); + skillInfoMap.put(skillS.toLowerCase(Locale.ROOT), skillInfo); return; } } @@ -213,7 +214,7 @@ public class XPInformation { var amountAsNumber = amount != null ? Double.parseDouble(amount.replace(",", "")) : null; var isMax = matcher.group("max") != null; // TODO: use this extra information for good (not evil) - updateLevel(type.toLowerCase(), level); + updateLevel(type.toLowerCase(Locale.ROOT), level); } } @@ -239,8 +240,8 @@ public class XPInformation { } } - SkillInfo oldSkillInfo = skillInfoMap.get(skill.toLowerCase()); - float inc = increment.getOrDefault(skill.toLowerCase(), 0F); + SkillInfo oldSkillInfo = skillInfoMap.get(skill.toLowerCase(Locale.ROOT)); + float inc = increment.getOrDefault(skill.toLowerCase(Locale.ROOT), 0F); if (oldSkillInfo != null && oldSkillInfo.totalXp + inc > newSkillInfo.totalXp && oldSkillInfo.totalXp - inc * 5 < newSkillInfo.totalXp) { SkillInfo incrementedSkillInfo = new SkillInfo(); incrementedSkillInfo.totalXp = oldSkillInfo.totalXp + inc; @@ -253,11 +254,11 @@ public class XPInformation { incrementedSkillInfo.level < levelingArray.size() && incrementedSkillInfo.level >= 0 ? levelingArray.get(incrementedSkillInfo.level).getAsFloat() : 0F; - skillInfoMap.put(skill.toLowerCase(), incrementedSkillInfo); + skillInfoMap.put(skill.toLowerCase(Locale.ROOT), incrementedSkillInfo); } else { - skillInfoMap.put(skill.toLowerCase(), newSkillInfo); + skillInfoMap.put(skill.toLowerCase(Locale.ROOT), newSkillInfo); } - failedSkills.remove(skill.toLowerCase()); + failedSkills.remove(skill.toLowerCase(Locale.ROOT)); } updateWithPercentage.clear(); } |