I'd say no

But if the player can actually be off-line, be sure to add a comment
explaining why.
This commit is contained in:
bm01 2013-03-03 13:43:56 +01:00
parent 79a5732c4d
commit d3ec976f44

View File

@ -103,26 +103,19 @@ public class EntityListener implements Listener {
} }
} }
if (defender instanceof Player) { if (defender instanceof Player && attacker instanceof Player) {
Player defendingPlayer = (Player) defender; Player defendingPlayer = (Player) defender;
Player attackingPlayer = (Player) attacker;
// TODO: Is this even possible? // TODO: Why?
if (!defendingPlayer.isOnline()) { if (defendingPlayer == attackingPlayer) {
return; return;
} }
else if (PartyManager.inSameParty(defendingPlayer, attackingPlayer)) {
if (attacker instanceof Player) { if (!(Permissions.friendlyFire(attackingPlayer) && Permissions.friendlyFire(defendingPlayer))) {
Player attackingPlayer = (Player) attacker; event.setCancelled(true);
if (defendingPlayer == attackingPlayer) {
return; return;
} }
else if (PartyManager.inSameParty(defendingPlayer, attackingPlayer)) {
if (!(Permissions.friendlyFire(attackingPlayer) && Permissions.friendlyFire(defendingPlayer))) {
event.setCancelled(true);
return;
}
}
} }
} }
@ -163,8 +156,7 @@ public class EntityListener implements Listener {
if (livingEntity instanceof Player) { if (livingEntity instanceof Player) {
Player player = (Player) entity; Player player = (Player) entity;
// TODO: Is it even possible for the player to be off-line here? if (Misc.isNPCEntity(player)) {
if (!player.isOnline() || Misc.isNPCEntity(player)) {
return; return;
} }