private boolean isPlayer(Entity entity) { boolean result = false; if (General.getPlayer(entity.getEntityId()) != null) { result = true; } else { result = false; } return result; }
public void onEntityDamageByProjectile(EntityDamageByProjectileEvent event) { if (event.getCause() == EntityDamageEvent.DamageCause.ENTITY_ATTACK) { if ((isPlayer(event.getEntity())) && (isPlayer(event.getDamager()))) { PolygoniaPlayer ezp = General.getPlayer(event.getEntity().getEntityId()); Polygonia zone = ezp.getCurrentZone(); if (zone != null) { if (!zone.hasPVP()) { event.setCancelled(true); } } } } }