Check if player has data key here as well

Fixes #272
This commit is contained in:
TfT_02 2014-02-28 14:43:42 +01:00
parent 2e74333eb7
commit a2cac82cba

View File

@ -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 */