From 22beae23e0c5184ef8a8fd8e76ea4c7280461222 Mon Sep 17 00:00:00 2001 From: "Kristian S. Stangeland" Date: Tue, 2 Apr 2013 14:28:34 +0200 Subject: [PATCH] Retrieve the correct Nbt base class --- .../comphenix/protocol/utility/MinecraftReflection.java | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/ProtocolLib/src/main/java/com/comphenix/protocol/utility/MinecraftReflection.java b/ProtocolLib/src/main/java/com/comphenix/protocol/utility/MinecraftReflection.java index bb3fed3c..9261f7bb 100644 --- a/ProtocolLib/src/main/java/com/comphenix/protocol/utility/MinecraftReflection.java +++ b/ProtocolLib/src/main/java/com/comphenix/protocol/utility/MinecraftReflection.java @@ -852,9 +852,15 @@ public class MinecraftReflection { returnTypeMatches(tagCompoundContract). build() ); + Class nbtBase = selected.getReturnType().getSuperclass(); + // That can't be correct + if (nbtBase == null || nbtBase.equals(Object.class)) { + throw new IllegalStateException("Unable to find NBT base class: " + nbtBase); + } + // Use the return type here too - return setMinecraftClass("NBTBase", selected.getReturnType()); + return setMinecraftClass("NBTBase", nbtBase); } }