Class Cast Exception Fixed
This commit is contained in:
parent
388f83694d
commit
8efe68111b
@ -342,18 +342,20 @@ public class FactionsEntityListener implements Listener {
|
|||||||
if (!(damagee instanceof Player)) return true;
|
if (!(damagee instanceof Player)) return true;
|
||||||
|
|
||||||
FPlayer defender = FPlayers.getInstance().getByPlayer((Player) damagee);
|
FPlayer defender = FPlayers.getInstance().getByPlayer((Player) damagee);
|
||||||
FPlayer attacker = FPlayers.getInstance().getByPlayer((Player) damager);
|
|
||||||
|
|
||||||
if (defender == null || defender.getPlayer() == null) return true;
|
|
||||||
|
|
||||||
if (attacker.getFaction() == defender.getFaction()) {
|
if(damager instanceof Player) {
|
||||||
if (attacker.hasFriendlyFire() && defender.hasFriendlyFire()) return true;
|
FPlayer attacker = FPlayers.getInstance().getByPlayer((Player) damager);
|
||||||
if (attacker.hasFriendlyFire() && !defender.hasFriendlyFire()) {
|
if (defender == null || defender.getPlayer() == null) return true;
|
||||||
attacker.msg(TL.FRIENDLY_FIRE_OFF_ATTACKER, defender.getName());
|
if (attacker.getFaction() == defender.getFaction()) {
|
||||||
return false;
|
if (attacker.hasFriendlyFire() && defender.hasFriendlyFire()) return true;
|
||||||
} else if(!attacker.hasFriendlyFire() && defender.hasFriendlyFire()){
|
if (attacker.hasFriendlyFire() && !defender.hasFriendlyFire()) {
|
||||||
attacker.msg(TL.FRIENDLY_FIRE_YOU_MUST);
|
attacker.msg(TL.FRIENDLY_FIRE_OFF_ATTACKER, defender.getName());
|
||||||
return false;
|
return false;
|
||||||
|
} else if (!attacker.hasFriendlyFire() && defender.hasFriendlyFire()) {
|
||||||
|
attacker.msg(TL.FRIENDLY_FIRE_YOU_MUST);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user