Skip to content

Commit

Permalink
Implement wg("__global__").
Browse files Browse the repository at this point in the history
  • Loading branch information
totemo committed Mar 26, 2021
1 parent a57102a commit cf81133
Showing 1 changed file with 13 additions and 7 deletions.
20 changes: 13 additions & 7 deletions src/nu/nerd/beastmaster/zones/ZonePredicate.java
Original file line number Diff line number Diff line change
Expand Up @@ -150,15 +150,21 @@ public boolean matches(Location loc, List<Object> args) {
// applicableRegions does NOT include the global region.
ApplicableRegionSet applicableRegions = regionManager.getApplicableRegions(weLoc.toVector().toBlockPoint());
String name = (String) args.get(0);
if (name.equals("*") && applicableRegions.size() != 0) {
// Any (non-global) region will do.
return true;
}

for (ProtectedRegion region : applicableRegions) {
if (name.equals(region.getId())) {
if (applicableRegions.size() == 0) {
if (name.equalsIgnoreCase("__global__")) {
return true;
}
} else { // There are non-global regions.
if (name.equals("*")) {
// Any (non-global) region will do.
return true;
}

for (ProtectedRegion region : applicableRegions) {
if (name.equals(region.getId())) {
return true;
}
}
}
}
return false;
Expand Down

0 comments on commit cf81133

Please sign in to comment.