3
0
Mirror von https://github.com/PaperMC/Paper.git synchronisiert 2024-12-18 12:30:06 +01:00

BUILDTOOLS-251: Make much of Bukkit locale independent

Dieser Commit ist enthalten in:
md_5 2016-06-26 19:32:05 +10:00
Ursprung 568e27fbd0
Commit 0ebb9c7afa
6 geänderte Dateien mit 13 neuen und 13 gelöschten Zeilen

Datei anzeigen

@ -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

Datei anzeigen

@ -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) {

Datei anzeigen

@ -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() {

Datei anzeigen

@ -18,6 +18,6 @@ public class PlayerMetadataStore extends MetadataStoreBase<OfflinePlayer> implem
*/
@Override
protected String disambiguate(OfflinePlayer player, String metadataKey) {
return player.getName().toLowerCase() + ":" + metadataKey;
return player.getName().toLowerCase(java.util.Locale.ENGLISH) + ":" + metadataKey;
}
}

Datei anzeigen

@ -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()) {

Datei anzeigen

@ -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)));
}
}
}