Archiviert
13
0

Make much of ProtocolLib locale independent

Fixes #242
Dieser Commit ist enthalten in:
Dan Mulloy 2016-07-25 14:09:23 -04:00
Ursprung 97430a8e42
Commit 64942cbb5e
5 geänderte Dateien mit 13 neuen und 8 gelöschten Zeilen

Datei anzeigen

@ -4,6 +4,7 @@ import java.io.Serializable;
import java.util.Arrays;
import java.util.Collection;
import java.util.List;
import java.util.Locale;
import java.util.Map;
import java.util.UUID;
import java.util.concurrent.Callable;
@ -542,7 +543,7 @@ public class PacketType implements Serializable, Cloneable, Comparable<PacketTyp
}
public String getPacketName() {
return WordUtils.capitalize(name().toLowerCase());
return WordUtils.capitalize(name().toLowerCase(Locale.ENGLISH));
}
}

Datei anzeigen

@ -20,6 +20,7 @@ import java.io.File;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import java.util.Locale;
import org.bukkit.configuration.Configuration;
import org.bukkit.configuration.ConfigurationSection;
@ -464,7 +465,7 @@ public class ProtocolConfig {
PlayerInjectHooks hook = getDefaultMethod();
if (text != null)
hook = PlayerInjectHooks.valueOf(text.toUpperCase().replace(" ", "_"));
hook = PlayerInjectHooks.valueOf(text.toUpperCase(Locale.ENGLISH).replace(" ", "_"));
return hook;
}

Datei anzeigen

@ -1,6 +1,7 @@
package com.comphenix.protocol.wrappers;
import java.util.HashMap;
import java.util.Locale;
import java.util.Map;
import org.bukkit.GameMode;
@ -226,7 +227,7 @@ public abstract class EnumWrappers {
BY_NAME = new HashMap<String, Particle>();
for (Particle particle : values()) {
BY_NAME.put(particle.getName().toLowerCase(), particle);
BY_NAME.put(particle.getName().toLowerCase(Locale.ENGLISH), particle);
BY_ID.put(particle.getId(), particle);
}
}
@ -264,7 +265,7 @@ public abstract class EnumWrappers {
}
public static Particle getByName(String name) {
return BY_NAME.get(name.toLowerCase());
return BY_NAME.get(name.toLowerCase(Locale.ENGLISH));
}
public static Particle getById(int id) {
@ -302,7 +303,7 @@ public abstract class EnumWrappers {
}
public static SoundCategory getByKey(String key) {
return LOOKUP.get(key.toLowerCase());
return LOOKUP.get(key.toLowerCase(Locale.ENGLISH));
}
}

Datei anzeigen

@ -17,6 +17,7 @@
package com.comphenix.protocol.wrappers;
import java.lang.reflect.Constructor;
import java.util.Locale;
import com.comphenix.protocol.reflect.EquivalentConverter;
import com.comphenix.protocol.reflect.StructureModifier;
@ -70,7 +71,7 @@ public class MinecraftKey {
* @return The resulting key
*/
public static MinecraftKey fromEnum(Enum<?> value) {
return new MinecraftKey(value.name().toLowerCase().replace("_", "."));
return new MinecraftKey(value.name().toLowerCase(Locale.ENGLISH).replace("_", "."));
}
/**
@ -104,7 +105,7 @@ public class MinecraftKey {
* @return The enum format
*/
public String getEnumFormat() {
return key.toUpperCase().replace(".", "_");
return key.toUpperCase(Locale.ENGLISH).replace(".", "_");
}
private static Constructor<?> constructor = null;

Datei anzeigen

@ -4,6 +4,7 @@ import java.util.Collection;
import java.util.Deque;
import java.util.Iterator;
import java.util.List;
import java.util.Locale;
import java.util.Set;
import com.comphenix.protocol.PacketType.Protocol;
@ -53,7 +54,7 @@ class PacketTypeParser {
// And finally, parse packet names if we have a protocol
if (protocol != null) {
for (Iterator<String> it = arguments.iterator(); it.hasNext(); ) {
String name = it.next().toUpperCase();
String name = it.next().toUpperCase(Locale.ENGLISH);
Collection<PacketType> names = PacketType.fromName(name);
for (PacketType type : names) {