From 2ae6f39a095866e1b360b81747ce6951b30c7627 Mon Sep 17 00:00:00 2001 From: Dr_Blamo Date: Wed, 1 Aug 2018 06:35:36 +0200 Subject: [PATCH] Fix Sentinel #249 issue (Can't hit NPCs) https://github.com/mcmonkey4eva/Sentinel/issues/249 => Can't hit NPCs --- .../worldguard/bukkit/listener/RegionProtectionListener.java | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/worldguard-legacy/src/main/java/com/sk89q/worldguard/bukkit/listener/RegionProtectionListener.java b/worldguard-legacy/src/main/java/com/sk89q/worldguard/bukkit/listener/RegionProtectionListener.java index 2b649058..7280d865 100644 --- a/worldguard-legacy/src/main/java/com/sk89q/worldguard/bukkit/listener/RegionProtectionListener.java +++ b/worldguard-legacy/src/main/java/com/sk89q/worldguard/bukkit/listener/RegionProtectionListener.java @@ -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;