DUXPLIMA Documentation

Rules

How a rule is written, who it targets, and how rules inside one region and across regions are weighed.

Contents: Writing a rule · Targets · Inside one region · Across regions · Where rules come from · Asking why

Writing a rule

A rule is three words: an action, a target and an effect.

/guard rule market break nonmember deny
/guard rule market use.door everyone allow
/guard rule arena damage.player everyone allow
/guard rule vault use.container perm:vault.open allow
/guard rule market break nonmember clear

clear removes the rule. A region keeps one rule per action and target, so setting break nonmember allow replaces break nonmember deny.

Targets

TargetWho it matches
everyoneEvery player
nonmemberA player with no role in this region
role:<name>Players with that role here: owner, manager, member, guest, or a role from roles.extra. A role name on its own (member) means the same
perm:<node>Players with that permission node, for example a LuckPerms group node perm:group.vip
cond:<condition>Players for whom the condition is true, in the same syntax as menu requirements, for example cond:%player_level% >= 30

A role rule names exactly that role: role:member does not match an owner. To let every role through, write the rule for the people without one: break nonmember deny.

Inside one region

For one action, guard starts at that action and walks up the tree (use.door, then use) until it reaches a level where some rule matches the player. That level decides, and the levels above it are not looked at.

At that level, the most specific target wins:

  1. role: and nonmember rules,
  2. then perm: and cond: rules,
  3. then everyone rules.

Between rules of the same kind, deny wins over allow.

Rules in the regionPlayerResult
use everyone deny, use.door everyone allowanyone opening a doorallowed: use.door has a matching rule, so use is never asked
use everyone deny, use.door everyone allowanyone opening a chestrefused by use
break everyone deny, break role:member allowa memberallowed: a role rule beats an everyone rule
break perm:group.vip allow, break everyone denya VIP with no roleallowed: a perm rule beats an everyone rule
break perm:group.vip allow, break nonmember denya VIP with no rolerefused: nonmember is more specific than a perm rule
break role:member allow, break nonmember denya guestallowed by neither rule, since a guest is not a member and is not a nonmember either; the region gives no answer

A region gives no answer when no level has a rule for the player. Then the next region is asked.

Across regions

Where regions overlap, they are asked in this order, and the first one with an answer decides:

  1. higher priority first;
  2. with equal priority, the inner region (the one inside the other) first;
  3. regions of equal priority where neither is inside the other are asked together, and a deny from any of them wins;
  4. the world defaults last.

If nobody answers, the action is allowed.

RegionsResult
town (priority 0, break nonmember deny) with plaza inside it (priority 0, no rules)a stranger may not break in the plaza: plaza has no answer, town refuses
the same, with plaza given break everyone allowanyone may break in the plaza: the inner region speaks first
arena (priority 10, damage.player everyone allow) over spawn (priority 0, damage everyone deny)players may fight in the arena
two touching plots of priority 0, one allowing and one denying use where they overlaprefused: in a tie, deny wins

Where rules come from

A region's rules are merged down its parent chain, starting at the top parent. At each level the level's template is laid down first and the level's own rules go over it; the next level down then goes over both. For the same action and target, the nearer level wins, and within a level the region's own rule wins over its template's. Behaviours and roles merge the same way.

So /guard rule spawn use.container role:member allow on a region linked to the spawn template adds to the template rather than fighting it, and a child region needs only the lines that differ from its parent.

Asking why

/guard why <action> is open to every player. It shows each region at their spot, in the order they were asked, what each answered and the rule that decided, and whether that rule is the region's own, a parent's, the template's or the world default. Staff can ask the same for someone else with /guard test <player> <action> [region], and inspect mode shows it for a clicked block.