Fix Sentinel #249 issue (Can't hit NPCs)

https://github.com/mcmonkey4eva/Sentinel/issues/249
=> Can't hit NPCs
This commit is contained in:
Dr_Blamo 2018-08-01 06:35:36 +02:00
parent 95b88ea64b
commit 2ae6f39a09

View File

@ -479,6 +479,11 @@ public void onDamageEntity(DamageEntityEvent event) {
} else if (pvp) { } else if (pvp) {
Player defender = (Player) event.getEntity(); Player defender = (Player) event.getEntity();
// if defender is an NPC
if (defender.hasMetadata("NPC")) {
return;
}
canDamage = query.testBuild(target, associable, combine(event, DefaultFlag.PVP)) 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; && query.queryState(target, playerAttacker, combine(event, DefaultFlag.PVP)) != State.DENY;