Fixed errors and errors with getPerverts for velocity packets

This commit is contained in:
libraryaddict 2013-11-19 22:53:56 +13:00
parent 95b6c40b7a
commit 2f7f5ef43c

View File

@ -2,6 +2,7 @@ package me.libraryaddict.disguise.disguisetypes;
import java.lang.reflect.Field; import java.lang.reflect.Field;
import java.lang.reflect.InvocationTargetException; import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.HashMap; import java.util.HashMap;
import java.util.HashSet; import java.util.HashSet;
@ -282,11 +283,11 @@ public abstract class Disguise {
Object entityTrackerEntry = trackedEntities.getClass().getMethod("get", int.class) Object entityTrackerEntry = trackedEntities.getClass().getMethod("get", int.class)
.invoke(trackedEntities, getEntity().getEntityId()); .invoke(trackedEntities, getEntity().getEntityId());
if (entityTrackerEntry != null) { if (entityTrackerEntry != null) {
Field field = ReflectionManager.getNmsClass("Entity").getField("getBukkitEntity"); Method method = ReflectionManager.getNmsClass("Entity").getMethod("getBukkitEntity");
HashSet trackedPlayers = (HashSet) entityTrackerEntry.getClass().getField("trackedPlayers") HashSet trackedPlayers = (HashSet) entityTrackerEntry.getClass().getField("trackedPlayers")
.get(entityTrackerEntry); .get(entityTrackerEntry);
for (Object p : trackedPlayers) { for (Object p : trackedPlayers) {
players.add((Player) field.get(p)); players.add((Player) method.invoke(p));
} }
} }
} catch (Exception ex) { } catch (Exception ex) {