Fixes shooting onto pvp areas from nopvp areas

This commit is contained in:
NolanSyKinsley 2012-02-13 13:54:44 -08:00
parent d9e5fc2b60
commit 27ffdec323

View File

@ -366,9 +366,10 @@ private void onEntityDamageByProjectile(EntityDamageByEntityEvent event) {
if (attacker != null && attacker instanceof Player) { if (attacker != null && attacker instanceof Player) {
if (wcfg.useRegions) { if (wcfg.useRegions) {
Vector pt = toVector(defender.getLocation()); Vector pt = toVector(defender.getLocation());
Vector pt2 = toVector(attacker.getLocation());
RegionManager mgr = plugin.getGlobalRegionManager().get(player.getWorld()); RegionManager mgr = plugin.getGlobalRegionManager().get(player.getWorld());
if (!mgr.getApplicableRegions(pt).allows(DefaultFlag.PVP)) { if (!mgr.getApplicableRegions(pt).allows(DefaultFlag.PVP) || !mgr.getApplicableRegions(pt2).allows(DefaultFlag.PVP)) {
((Player) attacker).sendMessage(ChatColor.DARK_RED + "You are in a no-PvP area."); ((Player) attacker).sendMessage(ChatColor.DARK_RED + "You are in a no-PvP area.");
event.setCancelled(true); event.setCancelled(true);
return; return;