> 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/edcrates/features/guis.md).

# GUIs

The guis/ folder, GUI files, items, click actions, custom items and pagination.

Every file in `guis/` is a menu. Make as many as you like and open them with `/edcrates gui <file>`, an `open-gui <file>` click action, or a `custom-item` of type `open-gui`. The plugin's own menus are GUI files too (`gui.main`, `gui.preview`, `gui.confirm` in config.yml): `crates.yml`, `crate-preview.yml`, `lootbox-preview.yml`, `confirm.yml`.

```yaml
title: 'Crate Selector'
rows: 5
open-sound: 'BLOCK_CHEST_OPEN 0.6 1.2'   # '' disables
main-menu: ''                            # GUI opened when this one is closed with Escape
item-click-cooldown: 0                   # seconds between clicks on the same item
update-interval: 40                      # ticks; re-renders live items (0 = off)

items:
  filler:
    material: BLACK_STAINED_GLASS_PANE
    slot: '0-9,17,18,26,27,35,36-44'
    name: '&7'

  rusty:
    custom-item:
      type: crate
      crate: rusty
    slot: 11
    material: OAK_BOAT
    name: '&6&lRusty &r&e&lKey &r&7[Tier #1]'
    lore:
      - '&7You have &e&n{keys}&r&7 of these keys.'

  shop:
    slot: 40
    material: EMERALD
    name: '&aKey Shop'
    requirement: 'permission edcrates.shop'
    left-click-actions:
      - 'open-gui key-shop'
    any-click-actions:
      - 'sound UI_BUTTON_CLICK 1 1.2'
```

## Items

`material` (or `PLAYER_HEAD` + `texture`), `slot` (`'11'`, `'0-8,17'` or a list), `name`, `lore`, `amount`, `glow`, `custom-model-data`, `color`, `requirement`, `update-interval`, `click-sound`, and the click action lists. Texts take `{placeholders}` and PlaceholderAPI `%placeholders%`.

`requirement` hides the item when false: `'%edcrates_keys_raw_rusty% > 0'`, `'{keys_raw} >= 100'`, `'permission some.node'`, `'!permission some.node'`. Operators `>= <= != == > <`.

## Click actions

`left-click-actions`, `right-click-actions`, `shift-left-click-actions`, `shift-right-click-actions`, `drop-click-actions` (Q) and `any-click-actions` (runs on every click). Left is the fallback for buttons without their own list. One verb per line:

| Line                                                   | Effect                                                    |
| ------------------------------------------------------ | --------------------------------------------------------- |
| `open-gui <gui> [key=value ...]`                       | Open another GUI file; pairs become `{key}` placeholders. |
| `back`                                                 | Open this GUI's `main-menu`, or close.                    |
| `close` / `refresh`                                    | Close, or re-render the menu.                             |
| \`open-crate \[amount                                  | all]\`                                                    |
| `preview <crate>`                                      | The reward preview.                                       |
| `toggle-animations` / `toggle-confirm`                 | Player settings.                                          |
| `message <text>` / `broadcast` / `actionbar` / \`title | <sub>\`</sub>                                             |
| `sound <NAME> [volume] [pitch]`                        | Sound.                                                    |
| `console <command>` / `player <command>`               | Commands, with `{player}`.                                |

## Custom items

`custom-item: {type: <type>}` gives an item built-in behaviour. The item's material, name and lore are still yours.

| Type                                   | Keys                                                                                    | Behaviour                                                                                                                                                                                                                                                                                                                                                       |
| -------------------------------------- | --------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `crate`                                | `crate: <id>`, optional `left/right/drop/shift-left/shift-right/middle`, `no-keys-item` | The crate icon. Left opens one, right previews, Q opens everything (defaults in config.yml `gui.crate-click`). Verbs: `open-one`, `open-all`, `open-<n>`, `preview`, `none`. Placeholders `{keys}` `{keys_compact}` `{opened}` `{tier}` `{crate}` `{rewards}` `{rewards_per_open}` `{rotating}`. With no keys the configured barrier item flashes in its place. |
| `preview`                              | `crate: <id>`                                                                           | An icon that only previews (a lootbox showcase).                                                                                                                                                                                                                                                                                                                |
| `open-gui`                             | `gui: <id>`, optional `placeholders: {k: v}`                                            | Opens another GUI.                                                                                                                                                                                                                                                                                                                                              |
| `toggle-animations` / `toggle-confirm` | `enabled-lore`, `disabled-lore`, `enabled-state`, `disabled-state` (`{state}`)          | Player toggles, re-rendered in place.                                                                                                                                                                                                                                                                                                                           |
| `confirm-open`                         |                                                                                         | Opens `{crate_id}` × `{amount_raw}` (the confirm menu's button).                                                                                                                                                                                                                                                                                                |
| `crate-icon`                           |                                                                                         | The crate icon of `{crate_id}` as defined wherever a `crate` item points at it.                                                                                                                                                                                                                                                                                 |
| `close` / `back`                       |                                                                                         |                                                                                                                                                                                                                                                                                                                                                                 |

Other plugins can register more types (and pagination sources) through the [API](/p/edcrates/features/api.md).

## Pagination

```yaml
pagination:
  source: rewards        # built-in: the rewards of {crate_id}
  slots: '0-26'          # entries fill these in order and spill onto further pages
  show-chance: false
  chance-format: '&7Chance: &f{chance}%'
  footer: [' ', '&a&lREWARD ENABLED']
  allow-disable: true
  footer-disabled: [' ', '&c&lREWARD DISABLED', '&7Click to enable it again.']
  disable-sound: 'BLOCK_NOTE_BLOCK_BASS 0.7 0.8'
  enable-sound: 'BLOCK_NOTE_BLOCK_PLING 0.7 1.4'
  previous-page: { bottom-slot: 0, material: PAPER, name: '&ePrevious Page' }
  next-page:     { bottom-slot: 8, material: PAPER, name: '&eNext Page' }
```

Rewards with a `slot:` in the crate file stay pinned to it on every page; the rest flow through `slots`. `bottom-slot` is a column of the last row whatever the GUI size; `slot:` is absolute. Navigation only shows when there is a page to go to and never covers a reward. Per-reward lore placeholders: `{chance}`, `{chance_rounded}`, `{weight}`, `{rarity}`, `{page}`, `{pages}`.

A crate can point at a different preview file with `preview.gui: '<file>'` and override `show-chance`, `chance-format`, `footer`, `footer-disabled`, `allow-disable` in its own `preview:` block.

## Disabling rewards

Clicking a reward in the preview switches it off for that player: it never rolls for them and its pool's other rewards take its share, so the odds stay exact. Clicking again enables it. The last enabled reward of a pool cannot be disabled; `toggleable: false` on a reward forbids it.

## Bulk confirmation

`confirm.yml` is asked before opening at least `gui.confirm-bulk.threshold` keys. Players can switch it off with the `toggle-confirm` item. Placeholders: `{amount}`, `{amount_raw}`, `{crate}`.
