From 2eb3ab6332bc7d6bd1399f5717c2a033441f55f0 Mon Sep 17 00:00:00 2001 From: Daniel Saukel Date: Wed, 18 Mar 2020 13:02:25 +0100 Subject: [PATCH] Fix NPE when player quits --- .../java/de/erethon/dungeonsxl/player/DPlayerListener.java | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/core/src/main/java/de/erethon/dungeonsxl/player/DPlayerListener.java b/core/src/main/java/de/erethon/dungeonsxl/player/DPlayerListener.java index 1705266a..3f003474 100644 --- a/core/src/main/java/de/erethon/dungeonsxl/player/DPlayerListener.java +++ b/core/src/main/java/de/erethon/dungeonsxl/player/DPlayerListener.java @@ -21,7 +21,6 @@ import de.erethon.caliburn.item.ExItem; import de.erethon.caliburn.item.VanillaItem; import de.erethon.commons.chat.MessageUtil; import de.erethon.dungeonsxl.DungeonsXL; -import de.erethon.dungeonsxl.api.dungeon.Dungeon; import de.erethon.dungeonsxl.api.dungeon.Game; import de.erethon.dungeonsxl.api.dungeon.GameRule; import de.erethon.dungeonsxl.api.player.EditPlayer; @@ -414,7 +413,6 @@ public class DPlayerListener implements Listener { Player player = event.getPlayer(); GlobalPlayer dPlayer = dPlayers.get(player); PlayerGroup dGroup = dPlayer.getGroup(); - Dungeon dungeon = dGroup.getDungeon(); if (!(dPlayer instanceof InstancePlayer)) { if (dGroup != null) { @@ -422,7 +420,7 @@ public class DPlayerListener implements Listener { } } else if (dPlayer instanceof GamePlayer) { - int timeUntilKickOfflinePlayer = dungeon.getRules().getState(GameRule.TIME_UNTIL_KICK_OFFLINE_PLAYER); + int timeUntilKickOfflinePlayer = dGroup.getDungeon().getRules().getState(GameRule.TIME_UNTIL_KICK_OFFLINE_PLAYER); if (timeUntilKickOfflinePlayer == 0) { ((InstancePlayer) dPlayer).leave();