Fix NPE when player quits

This commit is contained in:
Daniel Saukel 2020-03-18 13:02:25 +01:00
parent 9a10bea264
commit 2eb3ab6332

View File

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