From 74f3829282a1d885e0f7b0560af829266a4192c9 Mon Sep 17 00:00:00 2001 From: Daniel Saukel Date: Wed, 24 Jun 2020 00:31:51 +0200 Subject: [PATCH] Fix kickAllPlayers() NPE --- .../main/java/de/erethon/dungeonsxl/world/DInstanceWorld.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/core/src/main/java/de/erethon/dungeonsxl/world/DInstanceWorld.java b/core/src/main/java/de/erethon/dungeonsxl/world/DInstanceWorld.java index bb8b4e99..7ccc7f22 100644 --- a/core/src/main/java/de/erethon/dungeonsxl/world/DInstanceWorld.java +++ b/core/src/main/java/de/erethon/dungeonsxl/world/DInstanceWorld.java @@ -170,7 +170,9 @@ public abstract class DInstanceWorld implements InstanceWorld { public void kickAllPlayers() { getPlayers().forEach(p -> p.leave()); // Players who shouldn't be in the dungeon but still are for some reason - getWorld().getPlayers().forEach(p -> PlayerUtil.secureTeleport(p, Bukkit.getWorlds().get(0).getSpawnLocation())); + if (world != null) { + getWorld().getPlayers().forEach(p -> PlayerUtil.secureTeleport(p, Bukkit.getWorlds().get(0).getSpawnLocation())); + } } /**