-
-
Notifications
You must be signed in to change notification settings - Fork 6
Region Inheritance
There is support for both obtaining and modifying a region's members and owners. Members and owners may be players or strings/texts representing permission groups. The syntax for working with region members/owners is:
[player|group] (members|owners) of %worldguardregions%
%worldguardregions%'[s] [player|group] (members|owners)
(member|owner) (players|groups) of %worldguardregions%
%worldguardregions%'[s] (member|owner) (players|groups)
It supports adding, setting, removing, resetting, and deleting.
If player
or group
is not specified, both sets of values will be returned.
There is also a condition for checking membership:
%offlineplayers/strings% (is|are) ([a] member|[the|an] owner) of %worldguardregions%
%offlineplayers/strings% (is not|isn't|are not|aren't) ([a] member|[the|an] owner) of %worldguardregions%
Consider this example command for promoting nonmembers to members, and members to owners:
command /promote <text> <player>:
trigger:
set {_region} to the region text-argument in the player's world
if player-argument is an owner of {_region}:
message "<red>%player-argument% is already an owner of %{_region}%"
else if player-argument is a member of {_region}:
add player to the owners of {_region}
message "<green>%player-argument% has been promoted to an owner of %{_region}%"
else:
add player to the members of {_region}
message "<green>%player-argument% has been promoted to a member of %{_region}%"
Every region has a priority, which affects how overlapping regions interact. For example, when considering whether a player can build at a location, only the regions with the highest priority are considered.
An expression is provided for obtaining and changing the priority of a region:
[region] priority of %worldguardregions%
%worldguardregions%'[s] [region] priority
Since it is a numeric value, it supports adding, setting, removing, deleting, and resetting.
Consider this example command to mess up your regions:
command /messupmyregions:
trigger:
loop all regions:
set the priority of loop-worldguardregion to a random integer from 0 to 999
Regions are also able to have a parent region. If a region has a parent, it inherits the parent's:
- members and owners
- flags
An expression is available for obtaining and changing the parent of a region:
parent region[s] of %worldguardregions%
%worldguardregions%'[s] parent region[s]
It supports setting, deleting, and resetting.
There is also an expression to obtain all parents of a region. For example, if a region's parent has a parent, that parent will also be returned:
all [[of] the] parent regions of %worldguardregions%
Caution
Regions cannot have a cyclic parent tree. For example, if you have two regions, ParentRegion and ChildRegion (where ParentRegion is the parent of ChildRegion), attempting to set ChildRegion as the parent of ParentRegion will result in a runtime error.
Consider this example command for setting the parent of a region:
command /setparent <text> <text>:
trigger:
set {_child} to the region text-argument-1 in player's world
set {_parent} to the region text-argument-2 in player's world
set the parent region of {_child} to {_parent}
Additionally, there is a condition to test whether a region is a parent of another:
%worldguardregions% (is|are) a parent region[s] of %worldguardregions%
%worldguardregions% (is not|isn't|are not|aren't) a parent region[s] of %worldguardregions%
Consider this example command that prints all of the regions that a region is a parent of:
command /printchildren <text>:
trigger:
set {_parent} to the region text-argument
message "Children of %{_parent}%:"
loop all regions:
if {_parent} is a parent region of loop-region:
message "- %loop-region%"
To read more about overlapping regions and how that affects flags, membership, and more, review the WorldGuard Wiki: https://worldguard.enginehub.org/en/latest/regions/priorities/