Skip to content

Commit

Permalink
use bounding box check for find.players and npcs
Browse files Browse the repository at this point in the history
  • Loading branch information
mcmonkey4eva committed Jul 23, 2020
1 parent 09ccbd6 commit c493b24
Showing 1 changed file with 2 additions and 2 deletions.
Expand Up @@ -2101,7 +2101,7 @@ else if (attribute.startsWith("players", 2)) {
ArrayList<PlayerTag> found = new ArrayList<>();
attribute.fulfill(2);
for (Player player : Bukkit.getOnlinePlayers()) {
if (!player.isDead() && Utilities.checkLocation(object, player.getLocation(), radius)) {
if (!player.isDead() && Utilities.checkLocationWithBoundingBox(object, player, radius)) {
found.add(new PlayerTag(player));
}
}
Expand All @@ -2127,7 +2127,7 @@ else if (attribute.startsWith("npcs", 2)) {
ArrayList<NPCTag> found = new ArrayList<>();
attribute.fulfill(2);
for (NPC npc : CitizensAPI.getNPCRegistry()) {
if (npc.isSpawned() && Utilities.checkLocation(object.getBlockForTag(attribute).getLocation(), npc.getStoredLocation(), radius)) {
if (npc.isSpawned() && Utilities.checkLocationWithBoundingBox(object, npc.getEntity(), radius)) {
found.add(new NPCTag(npc));
}
}
Expand Down

0 comments on commit c493b24

Please sign in to comment.