Archiviert
13
0

Revert changes to EntityUtilities

Citizens fixed the problem on their end
Dieser Commit ist enthalten in:
Dan Mulloy 2016-03-06 18:32:39 -05:00
Ursprung b8497a91a6
Commit ec38ac7292

Datei anzeigen

@ -216,9 +216,7 @@ class EntityUtilities {
throw new FieldAccessException("Cannot access 'trackedEntities' field due to security limitations.", e); throw new FieldAccessException("Cannot access 'trackedEntities' field due to security limitations.", e);
} }
Object trackerEntry = WrappedIntHashMap.fromHandle(trackedEntities).get(entityID); return WrappedIntHashMap.fromHandle(trackedEntities).get(entityID);
Class<?> entryClass = MinecraftReflection.getMinecraftClass("EntityTrackerEntry");
return entryClass.cast(trackerEntry);
} }
/** /**
@ -235,28 +233,28 @@ class EntityUtilities {
if (trackerEntry != null) { if (trackerEntry != null) {
if (trackerField == null) { if (trackerField == null) {
try { try {
trackerField = trackerEntry.getClass().getDeclaredField("tracker"); Class<?> entryClass = MinecraftReflection.getMinecraftClass("EntityTrackerEntry");
trackerField = entryClass.getDeclaredField("tracker");
} catch (NoSuchFieldException e) { } catch (NoSuchFieldException e) {
// Assume it's the first entity field then // Assume it's the first entity field then
trackerField = FuzzyReflection.fromObject(trackerEntry, true) trackerField = FuzzyReflection.fromObject(trackerEntry, true)
.getFieldByType("tracker", MinecraftReflection.getEntityClass()); .getFieldByType("tracker", MinecraftReflection.getEntityClass());
} }
} }
tracker = FieldUtils.readField(trackerField, trackerEntry, true); tracker = FieldUtils.readField(trackerField, trackerEntry, true);
} }
// If the tracker is NULL, we'll just assume this entity doesn't exist // If the tracker is NULL, we'll just assume this entity doesn't exist
if (tracker != null) if (tracker != null)
return (Entity) MinecraftReflection.getBukkitEntity(tracker); return (Entity) MinecraftReflection.getBukkitEntity(tracker);
else else
return null; return null;
} catch (Exception e) { } catch (Exception e) {
throw new FieldAccessException("Cannot find entity from ID " + entityID + ".", e); throw new FieldAccessException("Cannot find entity from ID " + entityID + ".", e);
} }
} }
private static List<Object> unwrapBukkit(List<Player> players) { private static List<Object> unwrapBukkit(List<Player> players) {
List<Object> output = Lists.newArrayList(); List<Object> output = Lists.newArrayList();