Fix look close bug

This commit is contained in:
fullwall 2016-02-29 13:20:18 +08:00
parent fcf9fae805
commit 589c58ae36

View File

@ -60,11 +60,12 @@ public class LookClose extends Trait implements Toggleable, CommandConfigurable
return Double.compare(d1, d2);
}
});
Location cacheLocation = new Location(null, 0D, 0D, 0D);
for (Entity entity : nearby) {
if (entity.getType() != EntityType.PLAYER || entity.getLocation().getWorld() != npcLocation.getWorld())
if (entity.getType() != EntityType.PLAYER || entity.getLocation(cacheLocation).getWorld() != npcLocation.getWorld())
continue;
if (CitizensAPI.getNPCRegistry().getNPC(entity) != null
|| ((Player) npc.getEntity()).getGameMode() == GameMode.SPECTATOR)
|| ((Player) entity).getGameMode() == GameMode.SPECTATOR)
continue;
lookingAt = (Player) entity;
return;