mirror of
https://github.com/TotalFreedomMC/PlayerParticles.git
synced 2024-12-28 02:14:15 +00:00
Also flag the player as in combat if they are the one getting hit
This commit is contained in:
parent
befe6ef3e2
commit
95121dcc7e
1 changed files with 6 additions and 7 deletions
|
@ -60,21 +60,20 @@ public class PPlayerCombatListener implements Listener {
|
|||
if (!attackedIsPlayer && !includeMobs)
|
||||
return;
|
||||
|
||||
Player attacker;
|
||||
Player attacker = null;
|
||||
if (event.getDamager() instanceof Projectile) {
|
||||
Projectile projectile = (Projectile) event.getDamager();
|
||||
if (!(projectile.getShooter() instanceof Player))
|
||||
return;
|
||||
|
||||
attacker = (Player) projectile.getShooter();
|
||||
if (projectile.getShooter() instanceof Player)
|
||||
attacker = (Player) projectile.getShooter();
|
||||
} else if (event.getDamager() instanceof Player) {
|
||||
attacker = (Player) event.getDamager();
|
||||
} else return;
|
||||
}
|
||||
|
||||
if (attackedIsPlayer)
|
||||
this.markInCombat((Player) event.getEntity());
|
||||
|
||||
this.markInCombat(attacker);
|
||||
if (attacker != null)
|
||||
this.markInCombat(attacker);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in a new issue