From 7550b99aaae040fdd731b28cc6cd60e25d9b28d5 Mon Sep 17 00:00:00 2001 From: Glitchfinder Date: Mon, 13 May 2013 18:39:16 -0700 Subject: [PATCH] Patching more NPEs involving invbalid players, plus mob health bars. --- .../java/com/gmail/nossr50/listeners/PlayerListener.java | 4 ++++ src/main/java/com/gmail/nossr50/util/MobHealthbarUtils.java | 5 ++++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/src/main/java/com/gmail/nossr50/listeners/PlayerListener.java b/src/main/java/com/gmail/nossr50/listeners/PlayerListener.java index 3574b4768..008e2926e 100644 --- a/src/main/java/com/gmail/nossr50/listeners/PlayerListener.java +++ b/src/main/java/com/gmail/nossr50/listeners/PlayerListener.java @@ -427,6 +427,10 @@ public class PlayerListener implements Listener { ItemStack heldItem = player.getItemInHand(); McMMOPlayer mcMMOPlayer = UserManager.getPlayer(player); + if (mcMMOPlayer == null) { + return; + } + switch (event.getAction()) { case RIGHT_CLICK_BLOCK: Block block = event.getClickedBlock(); diff --git a/src/main/java/com/gmail/nossr50/util/MobHealthbarUtils.java b/src/main/java/com/gmail/nossr50/util/MobHealthbarUtils.java index 6bf871710..fba006f80 100644 --- a/src/main/java/com/gmail/nossr50/util/MobHealthbarUtils.java +++ b/src/main/java/com/gmail/nossr50/util/MobHealthbarUtils.java @@ -46,7 +46,10 @@ public final class MobHealthbarUtils { PlayerProfile profile = UserManager.getPlayer(player).getProfile(); - if (profile.getMobHealthbarType() == MobHealthbarType.DISABLED) { + if (profile == null) { + return; + } + else if (profile.getMobHealthbarType() == MobHealthbarType.DISABLED) { return; }