fix npcs not re-appearing when switching worlds at similar coordinates
This commit is contained in:
parent
22058a607f
commit
84af1753e6
1 changed files with 4 additions and 2 deletions
|
@ -35,7 +35,10 @@ public class NpcProcessorTask extends BukkitRunnable {
|
|||
double closestDist = Double.MAX_VALUE;
|
||||
Player closest = null;
|
||||
for (Player player : Bukkit.getOnlinePlayers()) {
|
||||
if (!player.getWorld().equals(npc.getWorld())) continue;
|
||||
if (!player.getWorld().equals(npc.getWorld())) {
|
||||
if (npc.isShown(player)) npc.hide(player);
|
||||
continue;
|
||||
}
|
||||
double distance = player.getLocation().distanceSquared(npc.getBukkitLocation());
|
||||
|
||||
// visibility
|
||||
|
@ -50,7 +53,6 @@ public class NpcProcessorTask extends BukkitRunnable {
|
|||
NpcSpawnEvent event = new NpcSpawnEvent(player, entry);
|
||||
Bukkit.getPluginManager().callEvent(event);
|
||||
if (event.isCancelled()) continue;
|
||||
|
||||
npc.show(player);
|
||||
}
|
||||
if (distance < closestDist) {
|
||||
|
|
Loading…
Reference in a new issue