From 03bf00a43de5958fad81fe9fcbe6dea95d75a0c6 Mon Sep 17 00:00:00 2001 From: Arasple Date: Wed, 22 Jan 2020 11:05:28 +0800 Subject: [PATCH] improved ref --- .../izzel/taboolib/module/lite/SimpleReflection.java | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/main/scala/io/izzel/taboolib/module/lite/SimpleReflection.java b/src/main/scala/io/izzel/taboolib/module/lite/SimpleReflection.java index 6490000..4c9a714 100644 --- a/src/main/scala/io/izzel/taboolib/module/lite/SimpleReflection.java +++ b/src/main/scala/io/izzel/taboolib/module/lite/SimpleReflection.java @@ -70,7 +70,7 @@ public class SimpleReflection { } Field field = fields.get(fieldName); if (value == null) { - TLogger.getGlobalLogger().error("Field Not Found: " + nmsClass.getName()); + return; } try { field.set(instance, value); @@ -86,7 +86,7 @@ public class SimpleReflection { } Field field = fields.get(fieldName); if (field == null) { - TLogger.getGlobalLogger().error("Field Not Found: " + nmsClass.getName()); + return null; } try { return field.get(instance); @@ -103,7 +103,7 @@ public class SimpleReflection { } Field field = fields.get(fieldName); if (field == null) { - TLogger.getGlobalLogger().error("Field Not Found: " + nmsClass.getName()); + return null; } try { return (T) field.get(instance); @@ -113,7 +113,7 @@ public class SimpleReflection { return def; } - public static Class getListType(Field field) { + public static Class getListType(Field field) { Type genericType = field.getGenericType(); try { if (ParameterizedType.class.isAssignableFrom(genericType.getClass())) { @@ -127,7 +127,7 @@ public class SimpleReflection { return null; } - public static Class[] getMapType(Field field) { + public static Class[] getMapType(Field field) { Class[] mapType = new Class[2]; try { Type genericType = field.getGenericType(); @@ -139,6 +139,6 @@ public class SimpleReflection { } catch (Throwable t) { t.printStackTrace(); } - return mapType[1] == null ? null : mapType ; + return mapType[1] == null ? null : mapType; } }