Made WorldGuard check to see if both the attacker & defender are in a pvp area.

This commit is contained in:
Turtle9598 2011-12-14 20:15:42 -05:00
parent 6802a7d747
commit 01f9fd561d

View File

@ -289,9 +289,10 @@ private void onEntityDamageByEntity(EntityDamageByEntityEvent event) {
if (attacker != null && attacker instanceof Player) {
if (wcfg.useRegions) {
Vector pt = toVector(defender.getLocation());
Vector pt2 = toVector(attacker.getLocation());
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.");
event.setCancelled(true);
return;