# Trust & Protection

Trust levels, commands, resolution order and all protection rules for claims and the wilderness.

> **Tip:** Trust is never cached. Every check reads the trust list and LuckPerms membership live, a revocation applies instantly, even with an open chest.

## Trust levels

An ascending chain, each higher level includes the lower ones.

| Level | Command | Includes |
|---|---|---|
| `ACCESS` | `/claim accesstrust` | Doors, buttons, levers, pressure plates, bell, cake, walking on farmland |
| `CONTAINER` | `/claim containertrust` | + chests, barrels, furnaces, hoppers, composters, chested mounts |
| `BUILD` | `/claim trust` | + build/break, animals, frames/paintings, portals, buckets |
| `PERMISSION` | `/claim permissiontrust` | + grant trust up to `BUILD` to others |
| `MANAGE` | implicit only | + grant trust up to `PERMISSION`, `/claim restrictsubclaim` |

`MANAGE` never comes from a command, only from ownership, `mira.claim.adminclaims` in an ownerless claim, an active `/claim admin ignore` bypass or the team rank `MANAGE_TEAM_CLAIM_FLAGS`.

> **Tip:** `public` and `[group]` are not levels of their own but entries in the trust list with one of the levels above. `/claim accesstrust public` lets everyone open doors; `[vip]` applies to the LuckPerms group. On multiple matches the highest level wins.

## Commands

All act on the claim you stand in. Children of `mira.claim.claims` (default `true`).

| Command | Syntax | Permission | Default | Description |
|---|---|---|---|---|
| Build trust | `/claim trust <target>` | `mira.claim.claim.trust` | true | Grants `BUILD` |
| Access trust | `/claim accesstrust <target>` (`at`) | `mira.claim.claim.accesstrust` | true | Grants `ACCESS` |
| Container trust | `/claim containertrust <target>` (`ct`) | `mira.claim.claim.containertrust` | true | Grants `CONTAINER` |
| Permission trust | `/claim permissiontrust <target>` (`pt`) | `mira.claim.claim.permissiontrust` | true | Grants `PERMISSION` |
| Untrust | `/claim untrust <target\|all>` | `mira.claim.claim.untrust` | true | Removes an entry; `all` clears the list |
| List | `/claim trustlist` | `mira.claim.claim.trustlist` | true | Shows all entries |
| Inheritance | `/claim restrictsubclaim` (`rsc`) | `mira.claim.claim.restrictsubclaim` | true | Toggle parent inheritance (needs `MANAGE`) |

`<target>` is `<player|[group]|public>`. The executor needs at least `PERMISSION`. Self-trust and formatting codes in the name are rejected; players must be resolvable, groups must exist in LuckPerms. Granting `PERMISSION` and toggling `restrictsubclaim` require `MANAGE`.

> **Tip:** Instead of `/claim trust public` the flags GUI has two switches: `build_mode` gives everyone `BUILD`, `public_access` gives everyone `ACCESS`. Both on → `build_mode` wins.

## Claim flags

The flags GUI (`/claim gui`, manage claim, flags) and the web panel under claims give the owner (`MANAGE`) six switches per claim. A flag on the top-level claim also applies to all of its subdivisions; a subdivision can enable a flag for itself on top.

| Flag | Default | Effect |
|---|---|---|
| `explosions` | off | TNT, creepers, end crystals etc. may damage blocks, item frames, paintings, armor stands, animals and vehicles in this claim. If even one block of an explosion lies in a claim without this flag, the whole explosion is cancelled. |
| `mob_spawning` | off | Hostile mobs spawn naturally (darkness) inside the claim. Off = no natural monster spawns in the claim. Spawners, spawn eggs, raids, breeding and commands are unaffected. |
| `monster_damage` | off | Monsters and foreign projectiles may change blocks in the claim: endermen, silverfish, ravagers, the ender dragon, the wither beam, zombies at doors (`Mobs.ZombiesBreakDoors`), ghast/blaze fireballs and skeleton fire arrows igniting blocks. Global switches such as `Mobs.EndermenMoveBlocks` still apply first. |
| `pvp_override` | off | Allows PvP inside the claim although `PvP.ProtectPlayersInLandClaims` would protect it. Only effective in worlds with PvP rules enabled. |
| `public_access` | off | Everyone gets `ACCESS` (doors, buttons, levers, beds). |
| `build_mode` | off | Everyone gets `BUILD`; beats `public_access`. |

> **Note:** Because `mob_spawning` is off by default, monsters do not spawn naturally inside claims. If you run a dark-room mob farm inside a claim, enable the flag in the flags GUI.

## Resolution order

First match decides:

1. **Owner** → `MANAGE`
2. **`adminclaims` in an ownerless claim** → `MANAGE` (not in player claims)
3. **Active `ignoreclaims` bypass** → `MANAGE`
4. Explicit player entry
5. LuckPerms group trust (highest level)
6. `public` entry
7. GUI switches `build_mode`/`public_access`
8. Team-claim resolution (if the subdivision belongs to a team)
9. Inheritance from the parent (subdivisions only, without `restrictsubclaim`)
10. Fallback: `NONE`

Because steps 1 to 3 run before any list check, `public` or group trust can never grant more than the owner has.

**Team claim (step 8):** member with `MANAGE_TEAM_CLAIM_FLAGS` → `MANAGE`; with `BUILD_IN_TEAM_SUBDIVISIONS` → `BUILD`; allied team with `BUILD_IN_ALLY_SUBDIVISIONS` → `BUILD`; otherwise on to step 9. Details on Team Claims & Plots.

## Which action needs which level

| Action | Level | Note |
|---|---|---|
| Build/break blocks, place bed, door | `BUILD` | |
| Write on a sign | `BUILD` | Shop signs use the shop permission instead of trust |
| Chest, barrel, furnace, hopper, beacon, lectern, crafter | `CONTAINER` | Anvil is intentionally not protected |
| Open a chested mount | `CONTAINER` | via mob position |
| Button, lever, pressure plate | `ACCESS` | only with `PreventButtonsSwitches: true` (default) |
| Redstone components, note block | `BUILD` | |
| Bell | `BUILD`/`ACCESS` | `BUILD` with `RaidTriggersRequireBuildTrust: true` (default) |
| Door, trapdoor, fence gate | `ACCESS` | use `public_access` for public doors |
| Paintings/frames, armour stands | `BUILD` | |
| Attack/leash/lure animals | `BUILD` | only with `PreventTheft: true`; horses/donkeys/llamas exemptable via config |
| Buckets (water/lava/milk) | `BUILD` | |
| Eat cake, walk on farmland | `ACCESS` | changes block state |
| Fill an end-portal frame, fill a decorated pot | `BUILD` | |

> **Tip:** With `Claims.EnderPearlsRequireAccessTrust: true` (default) an ender-pearl teleport into a claim without `ACCESS` is cancelled and the pearl returned.

## Protection rules

```yaml
Claims:
  PreventButtonsSwitches: true
  PreventTheft: true
  PreventNonPlayerCreatedPortals: true
  PistonMovement: CLAIMS_ONLY   # EVERYWHERE / EVERYWHERE_SIMPLE / CLAIMS_ONLY / IGNORED
Mobs:
  EndermenMoveBlocks: false
  CreaturesTrampleCrops: false
  ZombiesBreakDoors: false
Fire:
  Spreads: false      # applies server-wide, not just wilderness
  Destroys: false
Explosions:
  BedExplosionsAllowed: false
  RespawnAnchorExplosionsAllowed: false
```

- **Container/redstone:** opening and every click are checked (a revocation closes an open chest instantly). Double chest: one half inside the claim protects it. Hoppers and dispensers do not act across claim borders (exception: unrestricted subdivisions, see below). Virtual GUIs (player as holder) are never protected.
- **Fluids:** water/lava only flows into a claim if the source block is in the same claim.
- **Water, hoppers, pistons, dispensers** work across the border between a claim and its unrestricted subdivisions; restricted subdivisions (`/claim restrictsubclaim`) and team plots stay sealed off.
- **Portals:** a player portal needs `BUILD` at every portal block; entering also checks the destination.
- **Explosions:** if one block is inside the claim, the whole explosion is cancelled (also protects adjacent wilderness), unless the claim has the `explosions` flag. Explosion damage to animals, item frames, paintings, armor stands and vehicles inside the claim is prevented as well. Bed/respawn-anchor globally blocked (defaults). A wither never spawns in a claim.
- **Animals, frames, vehicles:** arrows, tridents, splash and lingering potions, TNT, tamed wolves, the fishing rod and leads (both hands) are traced back to the responsible player and need `BUILD` trust; damage nobody is responsible for (creeper, skeleton arrow, wild wolf) is cancelled inside the claim. Boats and minecarts need `BUILD`, chest and hopper minecarts `CONTAINER`.
- **Fire:** fire lit from outside against a claim wall does not eat through claimed blocks even with `Fire.Destroys: true`. Dispensers with flint and steel or fire charges only ignite inside their own claim. Ghast and blaze fireballs need the `monster_damage` flag.
- **Sand, gravel, anvils, concrete powder:** fall normally inside your own claim. Falling blocks shot into a claim from outside (wilderness or a neighbouring claim) vanish (sand cannon).
- **Non-player mob grief** (enderman, silverfish, ravager, sculk, crop trampling) is prevented in claims regardless of trust; only the `monster_damage` claim flag deliberately allows monster damage to blocks.

**Piston modes:**

| Mode | Rule |
|---|---|
| `EVERYWHERE` | Every moved block: source and target claim identical |
| `EVERYWHERE_SIMPLE` | Bounding box of all blocks in exactly one claim |
| `CLAIMS_ONLY` (default) | Piston + all moved + all target blocks in the same claim |
| `IGNORED` | No check (warning in the log) |

## Wilderness rules

```yaml
Claims:
  WorldModes:
    "*": Survival   # Survival / Creative / SurvivalRequiringClaims / PvP / Disabled
Wilderness:
  DisableRedstone: true   # redstone only in claims
  DisablePistons: true    # pistons only in claims
  LimitSkyTrees: true     # no trees on sky platforms
```

- **`SurvivalRequiringClaims`:** outside claims no build/break/bucket for players (unless the ignore bypass is active).
- **Fire rules** (`Fire.Spreads`/`Destroys`) apply server-wide.

> **Tip:** RestoreNature (`/claim admin restore`/`restoreaggressive`/`restorefill`) replaces unnatural blocks in the whole chunk with biome-appropriate material (AGGRESSIVE also wood/leaves, FILL only fills air holes). In Restore Nature Aggressive mode the operator confirms once in the confirmation GUI; the restoration then runs immediately. Runs in the background and leaves claim areas untouched.

With **Nexo** installed, the same trust rules apply to its custom blocks and furniture (break `BUILD`, interact `CONTAINER`/`ACCESS`).

## Admin

| Command / permission | Syntax | Default | Description |
|---|---|---|---|
| `mira.claim.adminclaims` | (permission) | op | Auto `MANAGE` in ownerless claims, not in player claims |
| Claim bypass | `/claim admin ignore` (`ic`) | false | Full bypass for the session; must be switched on, cleared on logout |

## Full example config

```yaml
Claims:
  PreventTheft: true
  PreventButtonsSwitches: true
  EnderPearlsRequireAccessTrust: true
  RaidTriggersRequireBuildTrust: true
  ProtectHorses: true
  ProtectDonkeys: true
  ProtectLlamas: true
  PistonMovement: CLAIMS_ONLY
  PreventNonPlayerCreatedPortals: true
  RavagersBreakBlocks: false
Mobs:
  EndermenMoveBlocks: false
  SilverfishBreakBlocks: false
  CreaturesTrampleCrops: false
  RabbitsEatCrops: true
  ZombiesBreakDoors: false
Fire:
  Spreads: false
  Destroys: false
Explosions:
  BlockSurfaceExplosions: true
  BedExplosionsAllowed: false
  RespawnAnchorExplosionsAllowed: false
Wilderness:
  LimitSkyTrees: true
  DisableRedstone: true
  DisablePistons: true
  SeaLevelOverride: -1
```
