Make getPerverts return only the people who can see the disguise

This commit is contained in:
libraryaddict 2013-12-02 01:34:27 +13:00
parent d8548400a6
commit 7505b0aca8

View File

@ -283,7 +283,7 @@ public abstract class Disguise {
} }
/** /**
* Get all EntityPlayers who have this entity in their Entity Tracker * Get all EntityPlayers who have this entity in their Entity Tracker And they are in the targetted disguise.
*/ */
protected ArrayList<Player> getPerverts() { protected ArrayList<Player> getPerverts() {
ArrayList<Player> players = new ArrayList<Player>(); ArrayList<Player> players = new ArrayList<Player>();
@ -297,7 +297,10 @@ public abstract class Disguise {
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) ReflectionManager.getBukkitEntity(p)); Player player = (Player) ReflectionManager.getBukkitEntity(p);
if (((TargettedDisguise) this).canSee(player)) {
players.add(player);
}
} }
} }
} catch (Exception ex) { } catch (Exception ex) {