# 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, `coreengineclaim.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 `coreengineclaim.claims` (default `true`).

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

## 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 only act within the same claim. 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.
- **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). Bed/respawn-anchor globally blocked (defaults). A wither never spawns in a claim.
- **Non-player mob grief** (sand cannons, enderman, silverfish, ravager, sculk, crop trampling) is always prevented in claims, regardless of trust.

**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). 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 |
|---|---|---|---|
| `coreengineclaim.adminclaims` | (permission) | false | 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
```
