Fix distance calcuation bug

This commit is contained in:
mcmonkey4eva 2015-04-06 16:44:34 -07:00
parent ad46c38ebe
commit 38ab44b55e

View File

@ -299,6 +299,7 @@ public class EventListen implements Listener {
for (NPC npc : getAllNPCs()) { for (NPC npc : getAllNPCs()) {
Entity npcEntity = npc.getEntity(); Entity npcEntity = npc.getEntity();
if (npcEntity instanceof Player && player.canSee((Player) npcEntity) if (npcEntity instanceof Player && player.canSee((Player) npcEntity)
&& player.getWorld().equals(npcEntity.getWorld())
&& player.getLocation().distanceSquared(npcEntity.getLocation()) < 100 * 100) { && player.getLocation().distanceSquared(npcEntity.getLocation()) < 100 * 100) {
nearbyNPCs.add(((CraftPlayer) npcEntity).getHandle()); nearbyNPCs.add(((CraftPlayer) npcEntity).getHandle());
} }