Skip to content

Commit

Permalink
Add npc.vulnerable tag
Browse files Browse the repository at this point in the history
  • Loading branch information
mcmonkey4eva committed May 3, 2015
1 parent 4b15826 commit 585c4fd
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
13 changes: 12 additions & 1 deletion src/main/java/net/aufdemrand/denizen/objects/dNPC.java
Expand Up @@ -647,11 +647,22 @@ && getCitizen().getTrait(ConstantsTrait.class).getConstant(attribute.getContext(
// @returns Element(Boolean)
// @description
// returns whether the NPC is currently engaged.
// See <@link command Engage>
// See <@link command engage>
// -->
if (attribute.startsWith("engaged") || attribute.startsWith("is_engaged"))
return new Element(isEngaged()).getAttribute(attribute.fulfill(1));

// <--[tag]
// @attribute <n@npc.vulnerable>
// @returns Element(Boolean)
// @description
// returns whether the NPC is currently vulnerable.
// See <@link command vulnerable>
// -->
if (attribute.startsWith("vulnerable")) {
return new Element(getCitizen().data().get(NPC.DEFAULT_PROTECTED_METADATA, true)).getAttribute(attribute.fulfill(1);
}

// <--[tag]
// @attribute <n@npc.id>
// @returns Element(Number)
Expand Down
Expand Up @@ -58,7 +58,7 @@ else if (!scriptEntry.hasObject("flag_target")

// Allow a p@player or n@npc entity to specify the target to be flagged.
// Don't check if the player/npc is valid until after the argument
// is being process to make sure the objects don't accidentally get set
// is being processed to make sure the objects don't accidentally get set
// as the name of the flag..
else if (!scriptEntry.hasObject("flag_target")
&& arg.startsWith("n@") && !arg.hasPrefix()) {
Expand Down

0 comments on commit 585c4fd

Please sign in to comment.