}
if (match.getCurrentState().inProgress() &&
event instanceof EntityDamageByEntityEvent)
{
EntityDamageByEntityEvent ed = (EntityDamageByEntityEvent) event;
Player damaged = entityToPlayer(ed.getEntity());
// enderpearls are a special case!
if (ed.getDamager().getType() == EntityType.ENDER_PEARL) return;
Player damager = entityToPlayer(ed.getDamager());
if (null != damager && ed.getDamager() instanceof Arrow)
{
AutoRefPlayer apl = match.getPlayer(damager);
if (apl != null) apl.incrementShotsHit();
Arrow arrow = (Arrow) ed.getDamager();
if (arrow.getShooter().getType() == EntityType.PLAYER)
{
AutoRefPlayer shooter = match.getPlayer((Player) arrow.getShooter());
Location shotFrom = shotArrows.get(arrow);
if (shooter != null && shotFrom != null)
shooter.setFurthestShot(arrow.getLocation().distance(shotFrom));
}
}
// spectators cannot cause damage to any entity
if (match.getCurrentState().inProgress() &&
null != damager && match.isSpectator(damager))
{ event.setCancelled(true); return; }
if (null != damager && ed.getEntityType() == EntityType.PIG_ZOMBIE)
{
AutoRefPlayer apl = match.getPlayer(damager);
Long lastAggro = lastPigmenAggro.get(apl);
long currentTime = ManagementFactory.getRuntimeMXBean().getUptime();