Check both attacker and defender locations for PvP.

Fixes WORLDGUARD-3494.
This commit is contained in:
wizjany 2015-06-05 22:19:04 -04:00 committed by sk89q
parent 7f9b850288
commit 3cb6c4e46f

View File

@ -455,7 +455,8 @@ public void onDamageEntity(DamageEntityEvent event) {
Player defender = (Player) event.getEntity();
canDamage = query.testBuild(target, associable, combine(event, DefaultFlag.PVP))
&& query.queryState(playerAttacker.getLocation(), playerAttacker, combine(event, DefaultFlag.PVP)) != State.DENY;
&& query.queryState(playerAttacker.getLocation(), playerAttacker, combine(event, DefaultFlag.PVP)) != State.DENY
&& query.queryState(target, playerAttacker, combine(event, DefaultFlag.PVP)) != State.DENY;
// Fire the disallow PVP event
if (!canDamage && Events.fireAndTestCancel(new DisallowedPVPEvent(playerAttacker, defender, event.getOriginalEvent()))) {