aboutsummaryrefslogtreecommitdiff
path: root/src/Java/gtPlusPlus/core/util/reflect
diff options
context:
space:
mode:
authorAlkalus <3060479+draknyte1@users.noreply.github.com>2019-07-26 04:23:36 +0100
committerAlkalus <3060479+draknyte1@users.noreply.github.com>2019-07-26 04:23:36 +0100
commit9fe3f693f1d6d015f45898818b7958b3a57a9f4a (patch)
tree1e35a386d5ab58244e6a6e8249f947b321de5828 /src/Java/gtPlusPlus/core/util/reflect
parent5a3076e52ea188c69851e0c8711937485123dc18 (diff)
downloadGT5-Unofficial-9fe3f693f1d6d015f45898818b7958b3a57a9f4a.tar.gz
GT5-Unofficial-9fe3f693f1d6d015f45898818b7958b3a57a9f4a.tar.bz2
GT5-Unofficial-9fe3f693f1d6d015f45898818b7958b3a57a9f4a.zip
+ 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.
Diffstat (limited to 'src/Java/gtPlusPlus/core/util/reflect')
-rw-r--r--src/Java/gtPlusPlus/core/util/reflect/ReflectionUtils.java38
1 files changed, 26 insertions, 12 deletions
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<String, Class> mCachedClasses = new LinkedHashMap<String, Class>();
+ public static Map<String, Class<?>> mCachedClasses = new LinkedHashMap<String, Class<?>>();
public static Map<String, CachedMethod> mCachedMethods = new LinkedHashMap<String, CachedMethod>();
public static Map<String, CachedField> mCachedFields = new LinkedHashMap<String, CachedField>();
@@ -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;
+ }
+
+
}