Skip to content

Commit

Permalink
reverse-directional tag of location.is_within: cuboid.contains_location!
Browse files Browse the repository at this point in the history
  • Loading branch information
mcmonkey4eva committed Nov 13, 2017
1 parent 0579507 commit 55d5285
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions plugin/src/main/java/net/aufdemrand/denizen/objects/dCuboid.java
Expand Up @@ -925,6 +925,24 @@ public String run(Attribute attribute, dObject object) {
}
});

// <--[tag]
// @attribute <cu@cuboid.contains_location[<location>]>
// @returns Element(Boolean)
// @description
// Returns whether this cuboid contains a location.
// -->
registerTag("contains_location", new TagRunnable() {
@Override
public String run(Attribute attribute, dObject object) {
if (!attribute.hasContext(1)) {
dB.echoError("The tag cu@cuboid.contains_location[...] must have a value.");
return null;
}
dLocation loc = dLocation.valueOf(attribute.getContext(1));
return new Element(((dCuboid) object).isInsideCuboid(loc)).getAttribute(attribute.fulfill(1));
}
});

// <--[tag]
// @attribute <cu@cuboid.is_within[<cuboid>]>
// @returns Element(Boolean)
Expand Down

0 comments on commit 55d5285

Please sign in to comment.