From a2b0e1830a05128a241df5f19bb428ce2fb7ea13 Mon Sep 17 00:00:00 2001 From: Jeremy Schroeder Date: Tue, 15 Oct 2013 18:05:27 -0400 Subject: [PATCH] Fix logical issue with Kill Listener when specifying NPC names. --- .../denizen/listeners/core/KillListenerInstance.java | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/main/java/net/aufdemrand/denizen/listeners/core/KillListenerInstance.java b/src/main/java/net/aufdemrand/denizen/listeners/core/KillListenerInstance.java index c8733a6cbc..9854c9ce5b 100644 --- a/src/main/java/net/aufdemrand/denizen/listeners/core/KillListenerInstance.java +++ b/src/main/java/net/aufdemrand/denizen/listeners/core/KillListenerInstance.java @@ -215,13 +215,14 @@ else if (type == KillType.NPC) { // Check targets, if any match entity killed, count_it! for (String target : targets) { - // Check IDs + // Check against a physical NPC object (n@7, n@18, etc.) if (dNPC.valueOf(target) != null) { if (dNPC.valueOf(target).getId() == npc.getId()) count_it = true; } - // Check Names - else if (npc.getName().equalsIgnoreCase(target)) + // Cannot be 'else if' since dNPC.valueOf will return true for names now, as well as ids. + // Check against name of NPC (n@fullwall, aufdemrand, etc)... object notation is optional. + if (npc.getName().equalsIgnoreCase(target.toLowerCase().replace("n@", ""))) count_it = true; } // If NPC was matched or targets contains '*', increment