From ec38ac729297f298ffede0aeaeb2d20feff933d6 Mon Sep 17 00:00:00 2001 From: Dan Mulloy Date: Sun, 6 Mar 2016 18:32:39 -0500 Subject: [PATCH] Revert changes to EntityUtilities Citizens fixed the problem on their end --- .../protocol/injector/EntityUtilities.java | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/ProtocolLib/src/main/java/com/comphenix/protocol/injector/EntityUtilities.java b/ProtocolLib/src/main/java/com/comphenix/protocol/injector/EntityUtilities.java index 572b9422..c92e0cd5 100644 --- a/ProtocolLib/src/main/java/com/comphenix/protocol/injector/EntityUtilities.java +++ b/ProtocolLib/src/main/java/com/comphenix/protocol/injector/EntityUtilities.java @@ -216,9 +216,7 @@ class EntityUtilities { throw new FieldAccessException("Cannot access 'trackedEntities' field due to security limitations.", e); } - Object trackerEntry = WrappedIntHashMap.fromHandle(trackedEntities).get(entityID); - Class entryClass = MinecraftReflection.getMinecraftClass("EntityTrackerEntry"); - return entryClass.cast(trackerEntry); + return WrappedIntHashMap.fromHandle(trackedEntities).get(entityID); } /** @@ -235,28 +233,28 @@ class EntityUtilities { if (trackerEntry != null) { if (trackerField == null) { try { - trackerField = trackerEntry.getClass().getDeclaredField("tracker"); + Class entryClass = MinecraftReflection.getMinecraftClass("EntityTrackerEntry"); + trackerField = entryClass.getDeclaredField("tracker"); } catch (NoSuchFieldException e) { // Assume it's the first entity field then trackerField = FuzzyReflection.fromObject(trackerEntry, true) .getFieldByType("tracker", MinecraftReflection.getEntityClass()); } } - + tracker = FieldUtils.readField(trackerField, trackerEntry, true); } - + // If the tracker is NULL, we'll just assume this entity doesn't exist if (tracker != null) return (Entity) MinecraftReflection.getBukkitEntity(tracker); else return null; - } catch (Exception e) { throw new FieldAccessException("Cannot find entity from ID " + entityID + ".", e); } } - + private static List unwrapBukkit(List players) { List output = Lists.newArrayList();