Skip to content

Commit

Permalink
Allow location.in_region[] to use a list
Browse files Browse the repository at this point in the history
Special thanks to @PsychoBoy11 for this.
  • Loading branch information
mcmonkey4eva committed Aug 20, 2013
1 parent c49deb7 commit 71c97db
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions src/main/java/net/aufdemrand/denizen/objects/dLocation.java
Expand Up @@ -835,10 +835,10 @@ else if (dEntity.matches(attribute.getContext(1))) {
.getAttribute(attribute.fulfill(1));

// <--
// <l@location.in_region[<name>]> -> Element(Boolean)
// If a region name is specified, returns true if the
// location is in that region, else it returns true if
// the location is in any region. Otherwise, returns false.
// <l@location.in_region[<name>(|<name>|...)]> -> Element(Boolean)
// If a region name or list of names is specified, returns whether the
// location is in one of the listed regions, otherwise it returns whether
// the location is in any region.
// -->
if (attribute.startsWith("in_region")) {
if (Depends.worldGuard == null) {
Expand All @@ -848,11 +848,11 @@ else if (dEntity.matches(attribute.getContext(1))) {

// Check if the player is in the specified region
if (attribute.hasContext(1)) {

String region = attribute.getContext(1);

return new Element(String.valueOf(WorldGuardUtilities.inRegion(this, region)))
.getAttribute(attribute.fulfill(1));
dList region_list = dList.valueOf(attribute.getContext(1));
for(String region: region_list)
if(WorldGuardUtilities.inRegion(this, region))
return Element.TRUE.getAttribute(attribute.fulfill(1));
return Element.FALSE.getAttribute(attribute.fulfill(1));
}

// Check if the player is in any region
Expand Down

0 comments on commit 71c97db

Please sign in to comment.