geforkt von Mirrors/Paper
BUILDTOOLS-251: Make much of Bukkit locale independent
Dieser Commit ist enthalten in:
Ursprung
568e27fbd0
Commit
0ebb9c7afa
@ -398,10 +398,10 @@ public final class CraftServer implements Server {
|
|||||||
return found;
|
return found;
|
||||||
}
|
}
|
||||||
|
|
||||||
String lowerName = name.toLowerCase();
|
String lowerName = name.toLowerCase(java.util.Locale.ENGLISH);
|
||||||
int delta = Integer.MAX_VALUE;
|
int delta = Integer.MAX_VALUE;
|
||||||
for (Player player : getOnlinePlayers()) {
|
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());
|
int curDelta = Math.abs(player.getName().length() - lowerName.length());
|
||||||
if (curDelta < delta) {
|
if (curDelta < delta) {
|
||||||
found = player;
|
found = player;
|
||||||
@ -458,7 +458,7 @@ public final class CraftServer implements Server {
|
|||||||
matchedPlayers.add(iterPlayer);
|
matchedPlayers.add(iterPlayer);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (iterPlayerName.toLowerCase().contains(partialName.toLowerCase())) {
|
if (iterPlayerName.toLowerCase(java.util.Locale.ENGLISH).contains(partialName.toLowerCase(java.util.Locale.ENGLISH))) {
|
||||||
// Partial match
|
// Partial match
|
||||||
matchedPlayers.add(iterPlayer);
|
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)
|
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();
|
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;
|
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));
|
console.worlds.remove(console.worlds.indexOf(handle));
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -976,7 +976,7 @@ public final class CraftServer implements Server {
|
|||||||
public World getWorld(String name) {
|
public World getWorld(String name) {
|
||||||
Validate.notNull(name, "Name cannot be null");
|
Validate.notNull(name, "Name cannot be null");
|
||||||
|
|
||||||
return worlds.get(name.toLowerCase());
|
return worlds.get(name.toLowerCase(java.util.Locale.ENGLISH));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@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.");
|
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;
|
return;
|
||||||
}
|
}
|
||||||
worlds.put(world.getName().toLowerCase(), world);
|
worlds.put(world.getName().toLowerCase(java.util.Locale.ENGLISH), world);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -26,7 +26,7 @@ public class CraftAttributeMap implements Attributable {
|
|||||||
int first = bukkit.indexOf('_');
|
int first = bukkit.indexOf('_');
|
||||||
int second = bukkit.indexOf('_', first + 1);
|
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, '.');
|
sb.setCharAt(first, '.');
|
||||||
if (second != -1) {
|
if (second != -1) {
|
||||||
|
@ -322,7 +322,7 @@ public class CraftBlock implements Block {
|
|||||||
return null;
|
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) {
|
public static BiomeBase biomeToBiomeBase(Biome bio) {
|
||||||
@ -330,7 +330,7 @@ public class CraftBlock implements Block {
|
|||||||
return null;
|
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() {
|
public double getTemperature() {
|
||||||
|
@ -18,6 +18,6 @@ public class PlayerMetadataStore extends MetadataStoreBase<OfflinePlayer> implem
|
|||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
protected String disambiguate(OfflinePlayer player, String metadataKey) {
|
protected String disambiguate(OfflinePlayer player, String metadataKey) {
|
||||||
return player.getName().toLowerCase() + ":" + metadataKey;
|
return player.getName().toLowerCase(java.util.Locale.ENGLISH) + ":" + metadataKey;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -57,7 +57,7 @@ public final class CraftChatMessage {
|
|||||||
appendNewComponent(matcher.start(groupId));
|
appendNewComponent(matcher.start(groupId));
|
||||||
switch (groupId) {
|
switch (groupId) {
|
||||||
case 1:
|
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) {
|
if (format == EnumChatFormat.RESET) {
|
||||||
modifier = new ChatModifier();
|
modifier = new ChatModifier();
|
||||||
} else if (format.isFormat()) {
|
} else if (format.isFormat()) {
|
||||||
|
@ -21,7 +21,7 @@ public class SoundTest {
|
|||||||
@Test
|
@Test
|
||||||
public void testReverse() {
|
public void testReverse() {
|
||||||
for (MinecraftKey effect : SoundEffect.a.keySet()) {
|
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)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren