Don't set default locale, instead use Locale.ENGLISH where possible

This commit is contained in:
libraryaddict
2020-09-14 15:01:05 +12:00
parent 4ff00ee828
commit c295011015
27 changed files with 86 additions and 77 deletions

View File

@@ -8,6 +8,7 @@ import java.net.URLDecoder;
import java.security.CodeSource;
import java.util.ArrayList;
import java.util.Enumeration;
import java.util.Locale;
import java.util.jar.JarEntry;
import java.util.jar.JarFile;
@@ -31,7 +32,7 @@ public class ClassGetter {
if (src != null) {
URL resource = src.getLocation();
if (resource.getPath().toLowerCase().endsWith(".jar")) {
if (resource.getPath().toLowerCase(Locale.ENGLISH).endsWith(".jar")) {
processJarfile(resource, pkgname, classes);
} else {
for (File f : new File(resource.getPath() + "/" + pkgname.replace(".", "/")).listFiles()) {

View File

@@ -106,10 +106,6 @@ public class ReflectionManager {
private static Object genericDamage;
public static void init() {
// Sometimes it doesn't like me if I don't set this :\
// Weird characters in toLowerCase() for example
Locale.setDefault(Locale.ENGLISH);
try {
boundingBoxConstructor =
getNmsConstructor("AxisAlignedBB", double.class, double.class, double.class, double.class,
@@ -1373,7 +1369,7 @@ public class ReflectionManager {
public static Object getEntityType(EntityType entityType) {
try {
Object val = entityTypesAMethod.invoke(null,
entityType.getName() == null ? entityType.name().toLowerCase() : entityType.getName());
entityType.getName() == null ? entityType.name().toLowerCase(Locale.ENGLISH) : entityType.getName());
if (NmsVersion.v1_14.isSupported()) {
return ((Optional<Object>) val).orElse(null);
@@ -1958,7 +1954,7 @@ public class ReflectionManager {
String[] split = string.split("_");
for (int i = 0; i < split.length; i++) {
split[i] = split[i].charAt(0) + split[i].substring(1).toLowerCase();
split[i] = split[i].charAt(0) + split[i].substring(1).toLowerCase(Locale.ENGLISH);
}
return split;