Priority and Inheritance¶
As noted in the Quick Start, regions can overlap. When there are overlapping regions, a player must have permission to build in all overlapping regions. With priorities and inheritance, however, that rule does not have to be satisfied.
Priorities¶
Every region defaults to a priority of 0, but it can be adjusted to be positive or negative. Higher numbers imply higher priorities. The valid range of priorities is -2147483648 to 2147483647, inclusive, but you will probably use more reasonable numbers like -2, 10, 15, or 100.
In terms of membership and who can build: When a certain location has overlapping regions, only the regions of the highest priority are considered.
In terms of region flags, the highest priority region with the flag defined is used.
Priorities can be set with /rg setpriority:
/rg setpriority example 5
Inheritance¶
Following from the pub example above, what if you want to allow both builders and pub members to build in the pub? You could add the builders group to the pub region, or instead, you could have the pub inherit its members from the spawn region.
When a region is given a parent:
It inherits the parent’s members and owners
It inherits the parent’s flags if if the flag isn’t defined on the child region
This comes in handy for:
A main area and small plots inside this main area
Creating a template region by which child regions will inherit the flags
Every region can have at most one parent. Set parents with /rg setparent:
/rg setparent region_name parent_name
To remove a parent, don’t specify a parent name:
/rg setparent region_name
WorldGuard will detect circular inheritance and prevent it.
Note
Non-player associables, such as pistons, can also be members of regions. Member inheritance is not limited to players only. This means that pistons in parent regions, for example, can push blocks into their children.
Template Regions¶
As previously mentioned, because flags are inherited from their parents, a parent region can act as a base template for all of its child regions.
However, you may want the template region to not actually physically exist, since you’re not using it to protect an area. One way to do this is to create a “global region,” which is a region that has no actual physical size. Create global regions with the -g switch on the region creation command:
/rg define -g plot_template
Inheritance versus Priorities¶
A higher priority parent region will override its children, so inheritance only properly works when the children are of the same or higher priority compared to their parent regions.
Region Groups and Overlapping Regions¶
As you may be aware, flags can be made to apply to only certain groups:
/rg flag mall pvp -g nonmembers deny
When there is only one region, it’s clear which players are members and which are not. However, it’s less obvious when there are overlapping regions: does a player only need to be a member of one of the regions?
The answer is no. The player must be a member of the region on which the flag is set.
For example, let’s imagine two overlapping regions:
Spawn, with flag
pvp -g nonmembers denyand no membersMarket, with member “sk89q”
PvP would be denied for sk89q because sk89q is not a member of spawn.
In the Context of Inheritance¶
When a region has a parent set, both flags and the list of members are inherited, so a player can be a member of one of the child regions too.
For example, if there are two regions:
Market, with flag
pvp -g nonmembers denyand no membersShop1, with member “sk89q,” inheriting from the market
Is sk89q a member? Yes, so sk89q is allowed to PvP.
Note
As mentioned previously, parent regions should not have a higher priority than their children, otherwise this will not work correctly. PvP would be denied for sk89q because the parent region would override the child.