fix unloaded worlds causing near command to not work
This commit is contained in:
parent
cefede568b
commit
0e7196e2a9
1 changed files with 2 additions and 1 deletions
|
@ -13,6 +13,7 @@ import net.kyori.adventure.text.format.NamedTextColor;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Objects;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
public class NearCommand implements CommandHandler {
|
public class NearCommand implements CommandHandler {
|
||||||
|
@ -30,7 +31,7 @@ public class NearCommand implements CommandHandler {
|
||||||
double radius = Math.pow(raw, 2);
|
double radius = Math.pow(raw, 2);
|
||||||
|
|
||||||
List<NpcEntryImpl> entries = npcRegistry.getAllModifiable().stream()
|
List<NpcEntryImpl> entries = npcRegistry.getAllModifiable().stream()
|
||||||
.filter(entry -> entry.getNpc().getWorld().equals(player.getWorld()))
|
.filter(entry -> Objects.equals(entry.getNpc().getWorld(), player.getWorld()))
|
||||||
.filter(entry -> entry.getNpc().getBukkitLocation().distanceSquared(player.getLocation()) < radius)
|
.filter(entry -> entry.getNpc().getBukkitLocation().distanceSquared(player.getLocation()) < radius)
|
||||||
.collect(Collectors.toList());
|
.collect(Collectors.toList());
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue