From 27eb9ef2ea97f65414266f0818e087bb314b8c5c Mon Sep 17 00:00:00 2001 From: Jeremy Schroeder Date: Fri, 26 Jul 2013 02:43:31 -0400 Subject: [PATCH] Add getSelectedNPC() to dPlayer. --- .../aufdemrand/denizen/objects/dPlayer.java | 8 +- src/main/resources/util.dscript | 84 ------------------- 2 files changed, 7 insertions(+), 85 deletions(-) diff --git a/src/main/java/net/aufdemrand/denizen/objects/dPlayer.java b/src/main/java/net/aufdemrand/denizen/objects/dPlayer.java index 5568b6797d..3d0ea31643 100644 --- a/src/main/java/net/aufdemrand/denizen/objects/dPlayer.java +++ b/src/main/java/net/aufdemrand/denizen/objects/dPlayer.java @@ -126,6 +126,12 @@ public dEntity getDenizenEntity() { return new dEntity(getPlayerEntity()); } + public dNPC getSelectedNPC() { + if (getPlayerEntity().hasMetadata("selected")) + return dNPC.valueOf(getPlayerEntity().getMetadata("selected").get(0).asString()); + else return null; + } + public String getName() { return player_name; } @@ -701,7 +707,7 @@ else if (attribute.getAttribute(2).startsWith("world")) if (attribute.startsWith("selected_npc")) { if (getPlayerEntity().hasMetadata("selected")) return dNPC.valueOf(getPlayerEntity().getMetadata("selected").get(0).asString()) - .getAttribute(attribute.fulfill(1)); + .getAttribute(attribute.fulfill(1)); else return "null"; } diff --git a/src/main/resources/util.dscript b/src/main/resources/util.dscript index decc2bdfba..08c665b511 100644 --- a/src/main/resources/util.dscript +++ b/src/main/resources/util.dscript @@ -64,87 +64,3 @@ _util_dtime_command: else flag global "Iterator %id%:!" -# ex command - -"ex command": - type: world - - events: - on ex command: - - if == null queue clear - - if ! queue clear - - define command_name - - flag npc: "list:|:" - - flag "list:<-:%command_name%" - - define raw_args "" - - if != null - run 'ex it' as: path: instantly def:%command_name% - else - run 'ex it' path: instantly def:%command_name% - - if > 12 { - - flag list:! - - narrate 'Too many arguments!' - } - - determine fulfilled - -"ex it": - type: task - - 1: - - "%1% " - - 2: - - "%1% " - - 3: - - "%1% " - - 4: - - "%1% - " - - 5: - - "%1% - " - - 6: - - "%1% - " - - 7: - - "%1% - - " - - 8: - - "%1% - - " - - 9: - - "%1% - - " - - 10: - - "%1% - - - " - - 11: - - "%1% - - - " - - 12: - - "%1% - - - " - - on queue completes: - - flag list:! - -