Fix NPE when leaving dungeons; resolves #546

This commit is contained in:
Daniel Saukel 2019-03-19 22:33:20 +01:00
parent 0339ee5763
commit 820527ea28
2 changed files with 4 additions and 1 deletions

View File

@ -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);
}

View File

@ -36,7 +36,7 @@ public class WorldUnloadTask extends BukkitRunnable {
Set<DInstanceWorld> 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();
}
}