How to Make a Key

Keys control access to crates. A key defines the physical item players hold, an optional crafting recipe, and how it shows up in the keys GUI. This page covers making one from scratch.

Quick start

  1. Open the /keys/ folder inside the EcoCrates plugin folder.

  2. Copy _example.yml and rename it to your key's ID, e.g. demo_crate.yml.

  3. Set the item and lore for the physical key.

  4. Point a crate at this key by setting key: <id> in that crate's config.

  5. Run /ecocrates reload, then /ecocrates give <player> <crate> physical to hand the key out.

  6. Hold the key and right-click your placed crate to confirm it opens.

Naming and IDs

The file name without .yml is the key's ID. This is what crates reference with their key option. The item and recipe ingredients use the Item Lookup System format, so you can use vanilla items, custom items, and modifiers.

The structure of a key

PartWhat it controls
ItemThe physical key item and its lore
CraftingAn optional recipe to craft the key
Keys GUIHow the key appears in the /ecocrates keys GUI
# === Item: the physical key ===
item: tripwire_hook unbreaking:1 hide_enchants name:"&aDemo Key" # The physical key item
lore: # Lore applied to the physical key
  - "&fUse this key to open"
  - "&fdemonstration crates"
use-custom-item: false # If true, use an existing custom item as the key; lore is NOT applied

# === Crafting: optional recipe ===
craftable: false # If this key can be crafted
recipe-permission: "" # Optional; permission needed to use the recipe
shapeless: false # Optional; if true, slot positions don't matter, defaults to false
recipe: # The 3x3 recipe ingredients, use "" for empty slots
  - "iron_ingot"
  - "iron_ingot"
  - "iron_ingot"
  - "iron_ingot"
  - "tripwire_hook"
  - "iron_ingot"
  - "iron_ingot"
  - "iron_ingot"
  - "iron_ingot"

# === Keys GUI: how it shows in /ecocrates keys ===
keygui:
  enabled: true # If this key appears in the GUI
  crate: demo_crate # The crate to open/preview on click; defaults to the key ID
  item: tripwire_hook unbreaking:1 hide_enchants name:"Demo Key" # The GUI display item
  lore:
    - "<g:#56ab2f>Demo Key</g:#a8e063>"
    - "&fYou have %keys% keys"
    - "&fGet more at &astore.example.net"
  row: 2 # Row in the GUI, 1-indexed
  column: 3 # Column in the GUI, 1-indexed
  page: 1 # Page in the GUI, 1-indexed
  right-click-previews: true # Right-click opens the crate preview
  left-click-opens: true # Left-click opens the crate with a virtual key
  shift-right-click-open-all: true # Shift right-click instantly opens all virtual keys held, skipping the roll animation
  shift-left-click-message: # Message sent on shift-left-click
    - "Buy a key here! &astore.example.net"
  custom-slots: [] # GUI slots for extra buttons

Item

The physical key players carry, with its lore.

item: tripwire_hook unbreaking:1 hide_enchants name:"&aDemo Key" # The physical key item
lore: # Lore applied to the physical key
  - "&fUse this key to open"
  - "&fdemonstration crates"
use-custom-item: false # If true, use an existing custom item as the key; lore is NOT applied

Crafting

Optionally lets players craft the key with a recipe. Ingredients use the same item format as the rest of the plugin.

craftable: false # If this key can be crafted
recipe-permission: "" # Optional; permission needed to use the recipe
shapeless: false # Optional; if true, slot positions don't matter, defaults to false
recipe: # The 3x3 recipe ingredients, use "" for empty slots
  - "iron_ingot"
  - "iron_ingot"
  - "iron_ingot"
  - "iron_ingot"
  - "tripwire_hook"
  - "iron_ingot"
  - "iron_ingot"
  - "iron_ingot"
  - "iron_ingot"

Keys GUI

How the key appears in the /ecocrates keys GUI, including its slot and click behaviour.

keygui:
  enabled: true # If this key appears in the GUI
  crate: demo_crate # The crate to open/preview on click; defaults to the key ID
  row: 2 # Row in the GUI, 1-indexed
  column: 3 # Column in the GUI, 1-indexed
  page: 1 # Page in the GUI, 1-indexed
  right-click-previews: true # Right-click opens the crate preview
  left-click-opens: true # Left-click opens the crate with a virtual key
  shift-right-click-open-all: true # Shift right-click instantly opens all virtual keys held, skipping the roll animation
  custom-slots: [] # GUI slots for extra buttons

Internal placeholders

PlaceholderValue
%keys%The player's amount of this key type.

Where to go next

  • Crates: wire this key to a crate in How to Make a Crate.

  • Commands: give and take keys with Commands and Permissions.

  • Defaults: browse the shipped example configs here.