From 8b090e1fd20eb4c301996b5e1dfeb78353e595e4 Mon Sep 17 00:00:00 2001 From: ‭huajijam Date: Mon, 18 Mar 2019 20:52:30 +0800 Subject: fix a bug --- src/Java/gtPlusPlus/xmod/witchery/WitchUtils.java | 21 +++++++++------------ 1 file changed, 9 insertions(+), 12 deletions(-) (limited to 'src/Java/gtPlusPlus/xmod/witchery/WitchUtils.java') diff --git a/src/Java/gtPlusPlus/xmod/witchery/WitchUtils.java b/src/Java/gtPlusPlus/xmod/witchery/WitchUtils.java index b28ccdaa9b..9e5efb452c 100644 --- a/src/Java/gtPlusPlus/xmod/witchery/WitchUtils.java +++ b/src/Java/gtPlusPlus/xmod/witchery/WitchUtils.java @@ -67,20 +67,17 @@ public class WitchUtils { } } - public static Field getField(String aClassName, String aFieldName) { - Class c; - try { - c = Class.forName(aClassName); - if (c != null) { - Field f = ReflectionUtils.getField(c, aFieldName); - if (f != null) { - return f; - } - } - } catch (ClassNotFoundException | NoSuchFieldException e) { + public static Field getField(String aClassName, String aFieldName) { + Class c; + c = ReflectionUtils.getClass(aClassName); + if (c != null) { + Field f = ReflectionUtils.getField(c, aFieldName); + if (f != null) { + return f; + } } return null; - } + } public static boolean isEqual(final GameProfile a, final GameProfile b) { return a != null && b != null && a.getId() != null && b.getId() != null && a.getId().equals(b.getId()); -- cgit