Skip to content

Commit

Permalink
Merge pull request #381 from Blamo27/fix/npc-issue
Browse files Browse the repository at this point in the history
Can't hit NPCs (Sentinel #249)
  • Loading branch information
me4502 committed Aug 4, 2018
2 parents d2c52f7 + 2ae6f39 commit 8eeab68
Showing 1 changed file with 5 additions and 0 deletions.
Expand Up @@ -479,6 +479,11 @@ public void onDamageEntity(DamageEntityEvent event) {
} else if (pvp) {
Player defender = (Player) event.getEntity();

// if defender is an NPC
if (defender.hasMetadata("NPC")) {
return;
}

canDamage = query.testBuild(target, associable, combine(event, DefaultFlag.PVP))
&& query.queryState(playerAttacker.getLocation(), playerAttacker, combine(event, DefaultFlag.PVP)) != State.DENY
&& query.queryState(target, playerAttacker, combine(event, DefaultFlag.PVP)) != State.DENY;
Expand Down

0 comments on commit 8eeab68

Please sign in to comment.