Possibly fixed projectile blocking in no-PvP zones.

This commit is contained in:
sk89q 2011-01-24 02:37:11 -08:00
parent 772d2cb580
commit 65a0e5c188

View File

@ -125,6 +125,7 @@ public void onEntityDamageByEntity(EntityDamageByEntityEvent event) {
public void onEntityDamageByProjectile(EntityDamageByProjectileEvent event) {
Entity defender = event.getEntity();
Entity attacker = event.getDamager();
if (defender instanceof Player) {
Player player = (Player)defender;
@ -133,6 +134,19 @@ public void onEntityDamageByProjectile(EntityDamageByProjectileEvent event) {
event.setCancelled(true);
return;
}
if (attacker != null && attacker instanceof Player) {
if (plugin.useRegions) {
Vector pt = toVector(defender.getLocation());
if (!plugin.regionManager.getApplicableRegions(pt)
.allowsFlag(AreaFlags.FLAG_PVP)) {
((Player)attacker).sendMessage(ChatColor.DARK_RED + "You are in a no-PvP area.");
event.setCancelled(true);
return;
}
}
}
}
}