> For the complete documentation index, see [llms.txt](https://edseries-plugins.gitbook.io/p/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://edseries-plugins.gitbook.io/p/edmortars/mortars/unlocking.md).

# Unlocking

A mortar starts locked. The owner clicks it (or runs `/mortar`) to open the unlock menu, and unlocks it once every requirement is met.

```yaml
unlock:
  requirements:
    tokens:
      type: currency        # currency, leveling or permission
      currency: tokens
      amount: 250k          # PinnaPrison number format (k, M, B...)
      take: true            # withdraw it on unlock
      display: '&e{amount} Tokens'
    rank:
      type: leveling
      leveling: rankup
      amount: 25
      take: false
      display: '&bRank {amount}'
    vip:
      type: permission
      permission: edmortars.vip
      display: '&dVIP rank'
  actions:                  # PinnaPrison action lines. Tokens: {player} {mortar}
    - 'sound ENTITY_PLAYER_LEVELUP 1 1'
    - 'titlewithsubtitle &6&lMORTAR UNLOCKED|&7It now fires by itself while you mine!'
```

* `display` tokens: `{amount}`, `{current}`, `{progress}`.
* Every requirement is checked first; only then the `take: true` ones are withdrawn, and the new balance is saved at once (a crash can't refund it).
* No requirements = the mortar is free to unlock.
* The unlock menu shows one item per requirement id (`edmortars-requirement` items, see [Menus](/p/edmortars/reference/menus.md)); the `{requirements}` token lists them all with the `requirement-met` / `requirement-unmet` lines of messages.yml.
* Admins: `/edmortars unlock <player> <type>` / `lock` (works offline, nothing is taken).
* Developers: `MortarUnlockEvent` can cancel an unlock (see [API](/p/edmortars/reference/api.md)).
