Class Cast Exception Fixed

This commit is contained in:
Driftay 2020-04-06 15:28:49 -04:00
parent 388f83694d
commit 8efe68111b

View File

@ -342,10 +342,11 @@ public class FactionsEntityListener implements Listener {
if (!(damagee instanceof Player)) return true;
FPlayer defender = FPlayers.getInstance().getByPlayer((Player) damagee);
if(damager instanceof Player) {
FPlayer attacker = FPlayers.getInstance().getByPlayer((Player) damager);
if (defender == null || defender.getPlayer() == null) return true;
if (attacker.getFaction() == defender.getFaction()) {
if (attacker.hasFriendlyFire() && defender.hasFriendlyFire()) return true;
if (attacker.hasFriendlyFire() && !defender.hasFriendlyFire()) {
@ -356,6 +357,7 @@ public class FactionsEntityListener implements Listener {
return false;
}
}
}
Location defenderLoc = defender.getPlayer().getLocation();