diff --git a/main/src/main/java/net/citizensnpcs/util/NMS.java b/main/src/main/java/net/citizensnpcs/util/NMS.java index 01d79a6eb..ed37c547f 100644 --- a/main/src/main/java/net/citizensnpcs/util/NMS.java +++ b/main/src/main/java/net/citizensnpcs/util/NMS.java @@ -530,8 +530,9 @@ public class NMS { private static Collection getNearbyPlayers(Entity from, Location location, double radius) { List players = Lists.newArrayList(); for (Player player : CitizensAPI.getLocationLookup().getNearbyPlayers(location, radius)) { - if (location.getWorld() != player.getWorld() || from != null && Util.canSee(player, from) - || location.distance(player.getLocation()) > radius) + if (location.getWorld() != player.getWorld() || location.distance(player.getLocation()) > radius) + continue; + if (from != null && !Util.canSee(player, from)) continue; players.add(player); diff --git a/main/src/main/java/net/citizensnpcs/util/Util.java b/main/src/main/java/net/citizensnpcs/util/Util.java index 3656c26ee..7a4a148ef 100644 --- a/main/src/main/java/net/citizensnpcs/util/Util.java +++ b/main/src/main/java/net/citizensnpcs/util/Util.java @@ -106,9 +106,9 @@ public class Util { } public static boolean canSee(Player player, Entity from) { - if (from instanceof Player) { + if (from instanceof Player) return player.canSee((Player) from); - } + if (SUPPORTS_ENTITY_CANSEE) { try { return player.canSee(from);