# 📂 Crate Configuration File

## Example Crate

Each crate has its file inside the crates folder. Check the default structure of a crate:

```yml
enabled: true
identifier: example1
item:
  material: custom:example_crate
  amount: 1
display-name: '&eExample #1'
block-material: BROWN_WOOL
engine: VANILLA_BLOCK
open-cost:
  engine: NONE
  amount: 0.0
  currency: ''
  key-skips-cost: false
open-cooldown: 0
simultaneous-openings: true
preview-item: false
permission:
  required: false
  permission: phoenixcrates.crate.example1
idle-effects:
- CIRCLE;{REDSTONE;#ff0000;0.0;1.0;2.0;0.0;0.0;1}
opening-animation:
  pre-open: DEFAULT
  open: SPOTLIGHT_GUI
  display: NONE
hologram:
  type: BUILTIN
  offset: 0.0
  lines:
  - '&e&l%name%'
  - ''
  - '&aRight &7Click to open'
  - '&cLeft &7Click to preview'
menus:
  rewards: default_rewards_preview
  select-reward: default_select_reward
  rerolls: default_crate_reroll
  preview-actions: []
key-required: true
linked-keys-ids:
- example1
allow-open-command: true
broadcast:
  message: '&ePlayer &a%player% &ejust got &6"%reward%" &ereward from the crate &6%crate%&e!'
max-win-rewards: 0
rewards-mode: RANDOM
rewards:
  '0':
    enabled: true
    identifier: reward_1783907600221
    display-item:
      material: custom:example_crate
      amount: 4
    win-items:
      '0':
        material: custom:grass_block
        amount: 1
    win-commands: []
    broadcast: false
    weight: 100.0
    win-limits: -1
    global-win-limit: -1
    cooldowns:
      win-limit-cooldown: 0
      global-win-limit-cooldown: 0
      time-limited-cooldown: 0
      time-limited-expiry: 0
    guaranteed-win: -1
    required-keys: 1
    allow-win-message: false
    notification-type: CHAT
    share-players-online: false
    restricted-permissions: []
    required-permissions: []
    max-win:
      item-amount: 1
      command-amount: -1
    alternative-reward:
      enabled: false
      reward:
        item:
          material: DIAMOND_PICKAXE
          display-name: '&aAlternative Item'
          amount: 1
        virtual: false
        broadcast: false
        allow-win-message: true
        share-players-online: false
        commands: []
guaranteed-reward-type: DISABLED
reroll:
  enabled: false
  free-rolls: 0
  groups:
    '0':
      namespace: common
      rerolls: 3
  replay-animation: false
  skip-same-reward: false
extra-settings:
  animation:
    display-item-position:
      x: 0.0
      y: 2.0
      z: 0.0
    display-item-name-position:
      x: 0.0
      y: 0.3
      z: 0.0
    skip-on-esc: false
clicks:
  open: RIGHT
  preview: LEFT
event-actions:
  open: []
  win: []
  close: []
  denied: []
```

## Clicks

`clicks` takes `LEFT`, `RIGHT`, `BOTH` or `NONE`, as set from [Click Behaviour](../main-features/crates/README.md#click-behaviour).

## Event Actions

`event-actions` overrides the global lists from `config.yml` for this crate, event by event. A reward can also carry a `win-actions` list of its own, which takes over from both. See [Event Actions](../main-features/crates/README.md#event-actions).

## Idle Effects

The `idle-effects` lines pack a whole particle effect into one string, in the form `TYPE;{PARTICLE;COLOR;offsetX;offsetY;offsetZ;spread;velocity;amount}`. Each field is explained on the [Idle Animations](../main-features/animations/README.md#in-the-config-file) page.

## Item Storage

Every crate file starts with an `internal-storage` section holding the raw items the crate uses, each under a name that the rest of the file points at with `custom:<name>`. It is written by the plugin, so a crate item, a reward item or a display item edited from the editor ends up there instead of being repeated inline.

Editing an item by hand means editing its entry in that section. Removing an entry that something still points at leaves that part of the crate without an item.

## Add-on Sections

Installed add-ons append their own section to every crate file, and Mass Opening also adds its two menu names into the existing `menus` section. A file only grows once the add-on has run for the first time, and deleting a section makes it come back with its defaults.

```yml
mass-opening:
  enabled: false
  presets:
    first:
      enabled: true
      amount: 6
  open-all:
    enabled: true
    max-amount: 100
lootbox:
  enabled: false
menus:
  mass-reroll: default_crate_mass_reroll
  mass-selective: default_crate_mass_selective
```

## File Structure

Everything the plugin writes lives in plugins/PhoenixCrates.

```
plugins/PhoenixCrates/
├── addons/
├── crates/
├── keys/
├── menus/
├── translations/
├── internal/
├── logs/
├── config.yml
├── locations.yml
├── internal_storage.yml
├── messages.yml
└── rarities.yml
```

### Folders

| Folder           | Contents                                                                                          |
| ---------------- | ------------------------------------------------------------------------------------------------- |
| **crates**       | One file per crate. See [Example Crate](#example-crate).                  |
| **keys**         | One file per key.                                                                                 |
| **menus**        | The menu layouts. See [Customize Menus](customize-menus.md).                                      |
| **addons**       | Add-on jars. Drop a new add-on here and restart.                                                  |
| **translations** | The language files. See [Languages & Translations](languages.md).                                 |
| **internal**     | Plugin-managed working data. Never edit this by hand.                                             |
| **logs**         | Written by the logger. See [Log the Actions](../features/log-the-actions.md).                      |

### Files

| File                     | Contents                                                                                                   |
| ------------------------ | ---------------------------------------------------------------------------------------------------------- |
| **config.yml**           | The main settings, the database connection and the license. See [Main Configuration](main-configuration.md). |
| **locations.yml**        | Every crate placed in the world, with its coordinates and facing. See the note below.                        |
| **internal_storage.yml** | Items saved from the editor that are not tied to a single crate.                                             |
| **messages.yml**         | Legacy message file, kept for configurations made before translations were introduced.                       |
| **rarities.yml**         | The rarities, when the Rarity add-on is installed.                                                           |

Installed add-ons add one file each: `crate-claim.yml`, `mass-opening.yml`, `ip-limit.yml`, `reward-on-loop.yml`, `redis.yml`, and `logger.yml` for the logger.

> **Warning:**
locations.yml is what makes a placed crate exist. Deleting it leaves every crate configured but no longer placed anywhere in the world.

### What Lives in the Database

Player progress is **not** in these files. Virtual keys, open cooldowns, opened counts, win limits and rerolls are all stored in the database configured in `config.yml`, which is SQLite (a file inside the plugin folder) by default and MySQL if you set it up.

### Moving to Another Server

To carry your setup across:

* **Configuration** - copy `crates/`, `keys/`, `menus/`, `translations/`, `config.yml`, `internal_storage.yml`, `rarities.yml` and the add-on files.
* **Placed crates** - copy `locations.yml`, but only if the worlds come across too. A location pointing at a world that does not exist is skipped.
* **Player progress** - point the new server at the same MySQL database, or copy the SQLite file across.

> **Danger:**
If you copy `config.yml` to a second server, remember that a license only allows a limited number of concurrent sessions. See [Licensing](../plugin-information/licensing.md).

### What to Back Up

The whole plugins/PhoenixCrates folder, plus your database if you use MySQL. The editor writes changes to these files as you make them, so a backup taken while the server runs is a valid one.

### Reporting a Problem

Turning on `debug` in `config.yml` adds verbose console logging and creates a debug\_output folder with extra diagnostics. Both are useful to attach when you report an issue to us.

Source: https://www.phoenixplugins.com/docs/phoenix-crates/configurations/crate-configuration-file