filter npcs in same world only for near command. fixes #69

This commit is contained in:
D3v1s0m 2023-07-02 15:35:36 +05:30
parent 43376c2732
commit b3475db944
No known key found for this signature in database
GPG Key ID: 3B6EC35367B8D82E

@ -25,6 +25,7 @@ public class NearCommand implements CommandHandler {
double radius = Math.pow(raw, 2);
String npcs = npcRegistry.getAllModifiable().stream()
.filter(entry -> entry.getNpc().getWorld().equals(player.getWorld()))
.filter(entry -> entry.getNpc().getBukkitLocation().distanceSquared(player.getLocation()) < radius)
.map(NpcEntryImpl::getId)
.collect(Collectors.joining(", "));