sentinel bug fix

This commit is contained in:
Aria Sangarin 2020-02-15 00:10:37 +01:00
parent 03573a343a
commit 7acacb707a

View File

@ -50,16 +50,16 @@ public class PlayerListener implements Listener {
*/ */
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true) @EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
public void d(EntityDamageByEntityEvent event) { public void d(EntityDamageByEntityEvent event) {
if (event.getEntity().hasMetadata("NPC")) if (event.getEntity() instanceof Player && !event.getEntity().hasMetadata("NPC"))
return;
if (event.getEntity() instanceof Player)
PlayerData.get((Player) event.getEntity()).updateCombat(); PlayerData.get((Player) event.getEntity()).updateCombat();
if (event.getDamager() instanceof Player) if (event.getDamager() instanceof Player && !event.getDamager().hasMetadata("NPC"))
PlayerData.get((Player) event.getDamager()).updateCombat(); PlayerData.get((Player) event.getDamager()).updateCombat();
if (event.getDamager() instanceof Projectile && ((Projectile) event.getDamager()).getShooter() instanceof Player) if (event.getDamager() instanceof Projectile && ((Projectile) event.getDamager()).getShooter() instanceof Player) {
if(((Player) ((Projectile) event.getDamager()).getShooter()).hasMetadata("NPC")) return;
PlayerData.get((Player) ((Projectile) event.getDamager()).getShooter()).updateCombat(); PlayerData.get((Player) ((Projectile) event.getDamager()).getShooter()).updateCombat();
}
} }
@EventHandler @EventHandler