mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2024-11-25 14:46:46 +01:00
Fix: player is no longer immune to projectiles shot by themselves (#4856)
This commit is contained in:
parent
965540dfaf
commit
08b08b1285
@ -362,20 +362,13 @@ public class EntityListener implements Listener {
|
|||||||
|
|
||||||
//Friendly fire checks
|
//Friendly fire checks
|
||||||
if (defender instanceof Player defendingPlayer) {
|
if (defender instanceof Player defendingPlayer) {
|
||||||
Player attackingPlayer;
|
|
||||||
|
|
||||||
//If the attacker is a Player or a projectile belonging to a player
|
//If the attacker is a Player or a projectile belonging to a player
|
||||||
if(attacker instanceof Projectile || attacker instanceof Player) {
|
|
||||||
if(attacker instanceof Projectile projectile) {
|
if(attacker instanceof Projectile projectile) {
|
||||||
if(((Projectile) attacker).getShooter() instanceof Player) {
|
if(projectile.getShooter() instanceof Player attackingPlayer && !attackingPlayer.equals(defendingPlayer)) {
|
||||||
attackingPlayer = (Player) projectile.getShooter();
|
|
||||||
|
|
||||||
//Check for party friendly fire and cancel the event
|
//Check for party friendly fire and cancel the event
|
||||||
if (checkParties(event, defendingPlayer, attackingPlayer))
|
if (checkParties(event, defendingPlayer, attackingPlayer)) {
|
||||||
{
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//Deflect checks
|
//Deflect checks
|
||||||
@ -390,14 +383,11 @@ public class EntityListener implements Listener {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else if (attacker instanceof Player attackingPlayer){
|
||||||
attackingPlayer = (Player) attacker;
|
|
||||||
//Check for party friendly fire and cancel the event
|
|
||||||
if (checkParties(event, defendingPlayer, attackingPlayer))
|
if (checkParties(event, defendingPlayer, attackingPlayer))
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
//Required setup for processCombatAttack
|
//Required setup for processCombatAttack
|
||||||
if(attacker instanceof Projectile) {
|
if(attacker instanceof Projectile) {
|
||||||
|
Loading…
Reference in New Issue
Block a user