From 0e7196e2a919000e0cc51f6feabb02adaa394584 Mon Sep 17 00:00:00 2001 From: Pyrbu Date: Sun, 19 May 2024 07:21:26 +0200 Subject: [PATCH] fix unloaded worlds causing near command to not work --- .../src/main/java/lol/pyr/znpcsplus/commands/NearCommand.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/plugin/src/main/java/lol/pyr/znpcsplus/commands/NearCommand.java b/plugin/src/main/java/lol/pyr/znpcsplus/commands/NearCommand.java index f8fad20..1d62104 100644 --- a/plugin/src/main/java/lol/pyr/znpcsplus/commands/NearCommand.java +++ b/plugin/src/main/java/lol/pyr/znpcsplus/commands/NearCommand.java @@ -13,6 +13,7 @@ import net.kyori.adventure.text.format.NamedTextColor; import org.bukkit.entity.Player; import java.util.List; +import java.util.Objects; import java.util.stream.Collectors; public class NearCommand implements CommandHandler { @@ -30,7 +31,7 @@ public class NearCommand implements CommandHandler { double radius = Math.pow(raw, 2); List 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) .collect(Collectors.toList());