From e6c87129bdac80d61fe20558df85ad9abfb310f3 Mon Sep 17 00:00:00 2001 From: Dan Mulloy Date: Sun, 9 Aug 2015 12:53:27 -0400 Subject: [PATCH] Add version to stack traces, fix EnumWrappers in pre-1.8 --- ProtocolLib/pom.xml | 7 ++++++- .../comphenix/protocol/wrappers/EnumWrappers.java | 12 +++++++++--- modules/v1_7_R4/pom.xml | 7 ++++++- 3 files changed, 21 insertions(+), 5 deletions(-) diff --git a/ProtocolLib/pom.xml b/ProtocolLib/pom.xml index 4e25f6b7..37416e45 100644 --- a/ProtocolLib/pom.xml +++ b/ProtocolLib/pom.xml @@ -84,7 +84,12 @@ 2.5 - false + + com.comphenix.protocol.Application + ProtocolLib + ${project.version}${project.build.number} + dmulloy2 + ProtocolLib diff --git a/ProtocolLib/src/main/java/com/comphenix/protocol/wrappers/EnumWrappers.java b/ProtocolLib/src/main/java/com/comphenix/protocol/wrappers/EnumWrappers.java index f891c41c..2c8d7ed0 100644 --- a/ProtocolLib/src/main/java/com/comphenix/protocol/wrappers/EnumWrappers.java +++ b/ProtocolLib/src/main/java/com/comphenix/protocol/wrappers/EnumWrappers.java @@ -330,8 +330,10 @@ public abstract class EnumWrappers { } private static void associate(Class nativeClass, Class wrapperClass, EquivalentConverter converter) { - FROM_NATIVE.put(nativeClass, converter); - FROM_WRAPPER.put(wrapperClass, converter); + if (nativeClass != null) { + FROM_NATIVE.put(nativeClass, converter); + FROM_WRAPPER.put(wrapperClass, converter); + } } /** @@ -341,7 +343,11 @@ public abstract class EnumWrappers { * @return The type of the enum field. */ private static Class getEnum(Class clazz, int index) { - return FuzzyReflection.fromClass(clazz, true).getFieldListByType(Enum.class).get(index).getType(); + try { + return FuzzyReflection.fromClass(clazz, true).getFieldListByType(Enum.class).get(index).getType(); + } catch (Throwable ex) { + return null; // Unsupported in this version + } } public static Map, EquivalentConverter> getFromNativeMap() { diff --git a/modules/v1_7_R4/pom.xml b/modules/v1_7_R4/pom.xml index f74deade..596d58a4 100644 --- a/modules/v1_7_R4/pom.xml +++ b/modules/v1_7_R4/pom.xml @@ -84,7 +84,12 @@ 2.5 - false + + com.comphenix.protocol.Application + ProtocolLib + ${project.version}${project.build.number} + dmulloy2 + ProtocolLib ../../target/