From 788bc7bc3b2dc05bf589a9c8e55b7616bc4305f3 Mon Sep 17 00:00:00 2001 From: libraryaddict Date: Thu, 6 Aug 2020 00:43:21 +1200 Subject: [PATCH] Set default locale to English because of dumb bugs --- .../utilities/reflection/ReflectionManager.java | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/src/main/java/me/libraryaddict/disguise/utilities/reflection/ReflectionManager.java b/src/main/java/me/libraryaddict/disguise/utilities/reflection/ReflectionManager.java index 6d8a9aea..a0a79ffb 100644 --- a/src/main/java/me/libraryaddict/disguise/utilities/reflection/ReflectionManager.java +++ b/src/main/java/me/libraryaddict/disguise/utilities/reflection/ReflectionManager.java @@ -36,10 +36,7 @@ import java.io.InputStreamReader; import java.lang.reflect.*; import java.nio.ByteBuffer; import java.nio.charset.StandardCharsets; -import java.util.ArrayList; -import java.util.Map; -import java.util.Optional; -import java.util.UUID; +import java.util.*; import java.util.concurrent.atomic.AtomicInteger; import java.util.jar.JarEntry; import java.util.jar.JarFile; @@ -66,6 +63,10 @@ public class ReflectionManager { private static NmsVersion version; 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 { Object entity = createEntityInstance(DisguiseType.COW, "Cow"); @@ -1678,6 +1679,7 @@ public class ReflectionManager { private static void createNMSValues(DisguiseType disguiseType) { String nmsEntityName = toReadable(disguiseType.name()); + Class nmsClass = ReflectionManager.getNmsClassIgnoreErrors("Entity" + nmsEntityName); if (nmsClass == null || Modifier.isAbstract(nmsClass.getModifiers())) { @@ -1934,7 +1936,7 @@ public class ReflectionManager { String[] split = string.split("_"); for (int i = 0; i < split.length; i++) { - split[i] = split[i].substring(0, 1) + split[i].substring(1).toLowerCase(); + split[i] = split[i].charAt(0) + split[i].substring(1).toLowerCase(); } return split;