From 56c3e982baa3bce1be4f02829a493ba06dd01f1b Mon Sep 17 00:00:00 2001 From: Daniel Saukel Date: Thu, 10 Sep 2015 14:49:51 +0200 Subject: [PATCH] Fix null check position in PlayerDeathListener --- .../listener/player/PlayerDeathListener.java | 28 +++++++++---------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/src/com/dre/dungeonsxl/listener/player/PlayerDeathListener.java b/src/com/dre/dungeonsxl/listener/player/PlayerDeathListener.java index d024936d..51f8ea51 100644 --- a/src/com/dre/dungeonsxl/listener/player/PlayerDeathListener.java +++ b/src/com/dre/dungeonsxl/listener/player/PlayerDeathListener.java @@ -26,8 +26,8 @@ public class PlayerDeathListener implements Listener { DConfig dConfig = GameWorld.get(player.getLocation().getWorld()).config; - if (dConfig.getKeepInventoryOnDeath()) { - if (dPlayer != null) { + if (dPlayer != null) { + if (dConfig.getKeepInventoryOnDeath()) { dPlayer.respawnInventory = event.getEntity().getInventory().getContents(); dPlayer.respawnArmor = event.getEntity().getInventory().getArmorContents(); // Delete all drops @@ -35,18 +35,18 @@ public class PlayerDeathListener implements Listener { istack.setType(Material.AIR); } } - } - - if (p.lives.containsKey(player)) { - lives = p.lives.get(player) - 1; - p.lives.put(player, lives); - } - - if (lives == 0 && dPlayer.isReady) { - Bukkit.broadcastMessage(p.language.get("Player_DeathKick").replaceAll("v1", player.getName()).replaceAll("&", "\u00a7")); - player.performCommand("dxl leave"); - } else if (!(lives == -1)) { - p.msg(player, p.language.get("Player_Death").replaceAll("v1", String.valueOf(lives))); + + if (p.lives.containsKey(player)) { + lives = p.lives.get(player) - 1; + p.lives.put(player, lives); + } + + if (lives == 0 && dPlayer.isReady) { + Bukkit.broadcastMessage(p.language.get("Player_DeathKick").replaceAll("v1", player.getName()).replaceAll("&", "\u00a7")); + player.performCommand("dxl leave"); + } else if (!(lives == -1)) { + p.msg(player, p.language.get("Player_Death").replaceAll("v1", String.valueOf(lives))); + } } }