From 9fe3f693f1d6d015f45898818b7958b3a57a9f4a Mon Sep 17 00:00:00 2001 From: Alkalus <3060479+draknyte1@users.noreply.github.com> Date: Fri, 26 Jul 2019 04:23:36 +0100 Subject: + Added config option to adjust ingame BGM delays. (Should be working) + Added a Pest Killer for quick removal of Butterflies and Bats. + Added Hydrogen Cyanide. % Replaced existing assets for the Bat King. % Replaced Bat King Logic, it's now an offensive mob. $ Fixed Bat King model scaling. --- .../core/util/reflect/ReflectionUtils.java | 38 +++++++++++++++------- 1 file changed, 26 insertions(+), 12 deletions(-) (limited to 'src/Java/gtPlusPlus/core/util/reflect') diff --git a/src/Java/gtPlusPlus/core/util/reflect/ReflectionUtils.java b/src/Java/gtPlusPlus/core/util/reflect/ReflectionUtils.java index 2371753fe6..efc86122e2 100644 --- a/src/Java/gtPlusPlus/core/util/reflect/ReflectionUtils.java +++ b/src/Java/gtPlusPlus/core/util/reflect/ReflectionUtils.java @@ -25,7 +25,7 @@ import gtPlusPlus.core.util.data.StringUtils; public class ReflectionUtils { - public static Map mCachedClasses = new LinkedHashMap(); + public static Map> mCachedClasses = new LinkedHashMap>(); public static Map mCachedMethods = new LinkedHashMap(); public static Map mCachedFields = new LinkedHashMap(); @@ -69,11 +69,11 @@ public class ReflectionUtils { } - private static boolean cacheClass(Class aClass) { + private static boolean cacheClass(Class aClass) { if (aClass == null) { return false; } - Class y = mCachedClasses.get(aClass.getCanonicalName()); + Class y = mCachedClasses.get(aClass.getCanonicalName()); if (y == null) { mCachedClasses.put(aClass.getCanonicalName(), aClass); return true; @@ -81,7 +81,7 @@ public class ReflectionUtils { return false; } - private static boolean cacheMethod(Class aClass, Method aMethod) { + private static boolean cacheMethod(Class aClass, Method aMethod) { if (aMethod == null) { return false; } @@ -94,7 +94,7 @@ public class ReflectionUtils { return false; } - private static boolean cacheField(Class aClass, Field aField) { + private static boolean cacheField(Class aClass, Field aField) { if (aField == null) { return false; } @@ -113,11 +113,11 @@ public class ReflectionUtils { * @param aClassCanonicalName - The canonical name of the underlying class. * @return - Valid, {@link Class} object, or {@link null}. */ - public static Class getClass(String aClassCanonicalName) { + public static Class getClass(String aClassCanonicalName) { if (aClassCanonicalName == null || aClassCanonicalName.length() <= 0) { return null; } - Class y = mCachedClasses.get(aClassCanonicalName); + Class y = mCachedClasses.get(aClassCanonicalName); if (y == null) { y = getClass_Internal(aClassCanonicalName); if (y != null) { @@ -149,7 +149,7 @@ public class ReflectionUtils { * @param aTypes - Varags Class Types for {@link Method}'s constructor. * @return - Valid, non-final, {@link Method} object, or {@link null}. */ - public static Method getMethod(Class aClass, String aMethodName, Class... aTypes) { + public static Method getMethod(Class aClass, String aMethodName, Class... aTypes) { if (aClass == null || aMethodName == null || aMethodName.length() <= 0) { return null; } @@ -178,7 +178,7 @@ public class ReflectionUtils { * @param aFieldName - Field name in {@link String} form. * @return - Valid, non-final, {@link Field} object, or {@link null}. */ - public static Field getField(final Class aClass, final String aFieldName) { + public static Field getField(final Class aClass, final String aFieldName) { if (aClass == null || aFieldName == null || aFieldName.length() <= 0) { return null; } @@ -662,7 +662,7 @@ public class ReflectionUtils { return m; } - private static Method getMethod_Internal(Class aClass, String aMethodName, Class... aTypes) { + private static Method getMethod_Internal(Class aClass, String aMethodName, Class... aTypes) { Method m = null; try { Logger.REFLECTION("Method: Internal Lookup: "+aMethodName); @@ -704,7 +704,7 @@ public class ReflectionUtils { } } - private static void dumpClassInfo(Class aClass) { + private static void dumpClassInfo(Class aClass) { Logger.INFO("We ran into an error processing reflection in "+aClass.getName()+", dumping all data for debugging."); // Get the methods Method[] methods = aClass.getDeclaredMethods(); @@ -720,7 +720,7 @@ public class ReflectionUtils { System.out.println(f.getName()); } Logger.INFO("Dumping all Constructors."); - for (Constructor c : consts) { + for (Constructor c : consts) { System.out.println(c.getName()+" | "+c.getParameterCount()+" | "+StringUtils.getDataStringFromArray(c.getParameterTypes())); } } @@ -800,4 +800,18 @@ public class ReflectionUtils { } + public static boolean doesFieldExist(String clazz, String string) { + return doesFieldExist(ReflectionUtils.getClass(clazz), string); + } + + public static boolean doesFieldExist(Class clazz, String string) { + if (clazz != null) { + if (ReflectionUtils.getField(clazz, string) != null) { + return true; + } + } + return false; + } + + } -- cgit