Only run EntityListener#checkParties on EntityDamageByEntityEvent if Parties are enabled

This commit is contained in:
Dieu 2024-02-21 19:23:10 +01:00
parent f6facbc08b
commit 1c1781cee7

View File

@ -365,7 +365,7 @@ public class EntityListener implements Listener {
if(attacker instanceof Projectile projectile) { if(attacker instanceof Projectile projectile) {
if(projectile.getShooter() instanceof Player attackingPlayer && !attackingPlayer.equals(defendingPlayer)) { if(projectile.getShooter() instanceof Player attackingPlayer && !attackingPlayer.equals(defendingPlayer)) {
//Check for party friendly fire and cancel the event //Check for party friendly fire and cancel the event
if (checkParties(event, defendingPlayer, attackingPlayer)) { if (mcMMO.p.getPartyConfig().isPartyEnabled() && checkParties(event, defendingPlayer, attackingPlayer)) {
return; return;
} }
} }
@ -383,7 +383,7 @@ public class EntityListener implements Listener {
} }
} }
} else if (attacker instanceof Player attackingPlayer){ } else if (attacker instanceof Player attackingPlayer){
if (checkParties(event, defendingPlayer, attackingPlayer)) if (mcMMO.p.getPartyConfig().isPartyEnabled() && checkParties(event, defendingPlayer, attackingPlayer))
return; return;
} }
} }