diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java index a793b8f7cb..3c1f3f5315 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java @@ -398,10 +398,10 @@ public final class CraftServer implements Server { return found; } - String lowerName = name.toLowerCase(); + String lowerName = name.toLowerCase(java.util.Locale.ENGLISH); int delta = Integer.MAX_VALUE; for (Player player : getOnlinePlayers()) { - if (player.getName().toLowerCase().startsWith(lowerName)) { + if (player.getName().toLowerCase(java.util.Locale.ENGLISH).startsWith(lowerName)) { int curDelta = Math.abs(player.getName().length() - lowerName.length()); if (curDelta < delta) { found = player; @@ -458,7 +458,7 @@ public final class CraftServer implements Server { matchedPlayers.add(iterPlayer); break; } - if (iterPlayerName.toLowerCase().contains(partialName.toLowerCase())) { + if (iterPlayerName.toLowerCase(java.util.Locale.ENGLISH).contains(partialName.toLowerCase(java.util.Locale.ENGLISH))) { // Partial match matchedPlayers.add(iterPlayer); } @@ -872,7 +872,7 @@ public final class CraftServer implements Server { worlddata.checkName(name); // CraftBukkit - Migration did not rewrite the level.dat; This forces 1.8 to take the last loaded world as respawn (in this case the end) WorldServer internal = (WorldServer) new WorldServer(console, sdm, worlddata, dimension, console.methodProfiler, creator.environment(), generator).b(); - if (!(worlds.containsKey(name.toLowerCase()))) { + if (!(worlds.containsKey(name.toLowerCase(java.util.Locale.ENGLISH)))) { return null; } @@ -963,7 +963,7 @@ public final class CraftServer implements Server { } } - worlds.remove(world.getName().toLowerCase()); + worlds.remove(world.getName().toLowerCase(java.util.Locale.ENGLISH)); console.worlds.remove(console.worlds.indexOf(handle)); return true; } @@ -976,7 +976,7 @@ public final class CraftServer implements Server { public World getWorld(String name) { Validate.notNull(name, "Name cannot be null"); - return worlds.get(name.toLowerCase()); + return worlds.get(name.toLowerCase(java.util.Locale.ENGLISH)); } @Override @@ -995,7 +995,7 @@ public final class CraftServer implements Server { System.out.println("World " + world.getName() + " is a duplicate of another world and has been prevented from loading. Please delete the uid.dat file from " + world.getName() + "'s world directory if you want to be able to load the duplicate world."); return; } - worlds.put(world.getName().toLowerCase(), world); + worlds.put(world.getName().toLowerCase(java.util.Locale.ENGLISH), world); } @Override diff --git a/src/main/java/org/bukkit/craftbukkit/attribute/CraftAttributeMap.java b/src/main/java/org/bukkit/craftbukkit/attribute/CraftAttributeMap.java index 7c94acc5dd..e3adb5bda1 100644 --- a/src/main/java/org/bukkit/craftbukkit/attribute/CraftAttributeMap.java +++ b/src/main/java/org/bukkit/craftbukkit/attribute/CraftAttributeMap.java @@ -26,7 +26,7 @@ public class CraftAttributeMap implements Attributable { int first = bukkit.indexOf('_'); int second = bukkit.indexOf('_', first + 1); - StringBuilder sb = new StringBuilder(bukkit.toLowerCase()); + StringBuilder sb = new StringBuilder(bukkit.toLowerCase(java.util.Locale.ENGLISH)); sb.setCharAt(first, '.'); if (second != -1) { diff --git a/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java b/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java index 70099480cd..ed7e76ffa9 100644 --- a/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java +++ b/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java @@ -322,7 +322,7 @@ public class CraftBlock implements Block { return null; } - return Biome.valueOf(BiomeBase.REGISTRY_ID.b(base).a().toUpperCase()); + return Biome.valueOf(BiomeBase.REGISTRY_ID.b(base).a().toUpperCase(java.util.Locale.ENGLISH)); } public static BiomeBase biomeToBiomeBase(Biome bio) { @@ -330,7 +330,7 @@ public class CraftBlock implements Block { return null; } - return BiomeBase.REGISTRY_ID.get(new MinecraftKey(bio.name().toLowerCase())); + return BiomeBase.REGISTRY_ID.get(new MinecraftKey(bio.name().toLowerCase(java.util.Locale.ENGLISH))); } public double getTemperature() { diff --git a/src/main/java/org/bukkit/craftbukkit/metadata/PlayerMetadataStore.java b/src/main/java/org/bukkit/craftbukkit/metadata/PlayerMetadataStore.java index d4d7f38b13..f4010b3a56 100644 --- a/src/main/java/org/bukkit/craftbukkit/metadata/PlayerMetadataStore.java +++ b/src/main/java/org/bukkit/craftbukkit/metadata/PlayerMetadataStore.java @@ -18,6 +18,6 @@ public class PlayerMetadataStore extends MetadataStoreBase implem */ @Override protected String disambiguate(OfflinePlayer player, String metadataKey) { - return player.getName().toLowerCase() + ":" + metadataKey; + return player.getName().toLowerCase(java.util.Locale.ENGLISH) + ":" + metadataKey; } } diff --git a/src/main/java/org/bukkit/craftbukkit/util/CraftChatMessage.java b/src/main/java/org/bukkit/craftbukkit/util/CraftChatMessage.java index 38ef8216c4..560f95ccb6 100644 --- a/src/main/java/org/bukkit/craftbukkit/util/CraftChatMessage.java +++ b/src/main/java/org/bukkit/craftbukkit/util/CraftChatMessage.java @@ -57,7 +57,7 @@ public final class CraftChatMessage { appendNewComponent(matcher.start(groupId)); switch (groupId) { case 1: - EnumChatFormat format = formatMap.get(match.toLowerCase().charAt(1)); + EnumChatFormat format = formatMap.get(match.toLowerCase(java.util.Locale.ENGLISH).charAt(1)); if (format == EnumChatFormat.RESET) { modifier = new ChatModifier(); } else if (format.isFormat()) { diff --git a/src/test/java/org/bukkit/SoundTest.java b/src/test/java/org/bukkit/SoundTest.java index 2b00b4bf8b..8bb093daa9 100644 --- a/src/test/java/org/bukkit/SoundTest.java +++ b/src/test/java/org/bukkit/SoundTest.java @@ -21,7 +21,7 @@ public class SoundTest { @Test public void testReverse() { for (MinecraftKey effect : SoundEffect.a.keySet()) { - assertNotNull(effect + "", Sound.valueOf(effect.a().replace('.', '_').toUpperCase())); + assertNotNull(effect + "", Sound.valueOf(effect.a().replace('.', '_').toUpperCase(java.util.Locale.ENGLISH))); } } }