From a2cac82cba84f92e62c91207639c3c64b58f8738 Mon Sep 17 00:00:00 2001 From: TfT_02 Date: Fri, 28 Feb 2014 14:43:42 +0100 Subject: [PATCH] Check if player has data key here as well Fixes #272 --- .../java/com/gmail/nossr50/listeners/EntityListener.java | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/main/java/com/gmail/nossr50/listeners/EntityListener.java b/src/main/java/com/gmail/nossr50/listeners/EntityListener.java index 9058833ca..15fe46c6c 100644 --- a/src/main/java/com/gmail/nossr50/listeners/EntityListener.java +++ b/src/main/java/com/gmail/nossr50/listeners/EntityListener.java @@ -174,6 +174,10 @@ public class EntityListener implements Listener { Player defendingPlayer = (Player) defender; Player attackingPlayer = (Player) attacker; + if (!UserManager.hasPlayerDataKey(defendingPlayer) || !UserManager.hasPlayerDataKey(attackingPlayer)) { + return; + } + // We want to make sure we're not gaining XP or applying abilities when we hit ourselves if (defendingPlayer.equals(attackingPlayer)) { return; @@ -226,6 +230,11 @@ public class EntityListener implements Listener { if (livingEntity instanceof Player) { Player player = (Player) entity; + + if (!UserManager.hasPlayerDataKey(player)) { + return; + } + McMMOPlayer mcMMOPlayer = UserManager.getPlayer(player); /* Check for invincibility */