Also flag the player as in combat if they are the one getting hit

This commit is contained in:
Esophose 2022-03-23 12:51:28 -06:00
parent befe6ef3e2
commit 95121dcc7e
No known key found for this signature in database
GPG key ID: DE0E013CAE5C630A

View file

@ -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);
}
/**