From 820527ea2812ff430655943701dd9e8536afd0d2 Mon Sep 17 00:00:00 2001 From: Daniel Saukel Date: Tue, 19 Mar 2019 22:33:20 +0100 Subject: [PATCH] Fix NPE when leaving dungeons; resolves #546 --- src/main/java/de/erethon/dungeonsxl/player/RespawnTask.java | 3 +++ src/main/java/de/erethon/dungeonsxl/world/WorldUnloadTask.java | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/src/main/java/de/erethon/dungeonsxl/player/RespawnTask.java b/src/main/java/de/erethon/dungeonsxl/player/RespawnTask.java index bf744fd0..caa8fdcf 100644 --- a/src/main/java/de/erethon/dungeonsxl/player/RespawnTask.java +++ b/src/main/java/de/erethon/dungeonsxl/player/RespawnTask.java @@ -41,6 +41,9 @@ public class RespawnTask extends BukkitRunnable { @Override public void run() { + if (!player.isOnline()) { + return; + } if (player.getWorld() != location.getWorld() || player.getLocation().distance(location) > 2) { PlayerUtil.secureTeleport(player, location); } diff --git a/src/main/java/de/erethon/dungeonsxl/world/WorldUnloadTask.java b/src/main/java/de/erethon/dungeonsxl/world/WorldUnloadTask.java index 0eee6bd1..c7c7cbfd 100644 --- a/src/main/java/de/erethon/dungeonsxl/world/WorldUnloadTask.java +++ b/src/main/java/de/erethon/dungeonsxl/world/WorldUnloadTask.java @@ -36,7 +36,7 @@ public class WorldUnloadTask extends BukkitRunnable { Set instances = plugin.getDWorldCache().getInstances(); for (DInstanceWorld instance : instances.toArray(new DInstanceWorld[instances.size()])) { if (instance.exists()) { - if (instance.getWorld().getPlayers().isEmpty()) { + if (instance.getPlayers().isEmpty()) { instance.delete(); } }