Skip to content

Creating Boxes

Lord_Lofi edited this page Apr 19, 2026 · 3 revisions

Creating Boxes

Each .yml file inside plugins/LofiBox/boxes/ defines one mystery box. The filename (without .yml) becomes the box's ID.

For example, plugins/LofiBox/boxes/mythic.yml creates a box with ID mythic.


Full Box Structure

# Display name shown in the spin GUI title and messages. Supports MiniMessage.
name: "<gradient:#a78bfa:#6366f1>Mythic Crate</gradient>"

# The physical item players carry and right-click to open.
item:
  material: CHEST
  name: "<gradient:#a78bfa:#6366f1>✦ Mythic Crate ✦</gradient>"
  lore:
    - ""
    - "<gray>Right-click to open!"
    - ""
    - "<dark_gray>mythic crate"
  custom-model-data: 0
  # Uncomment to use a HeadDatabase head as the box item:
  # head-database-id: "3337"

# Sounds (optional — falls back to config.yml defaults)
sounds:
  open: "block.chest.open"
  win: "entity.player.levelup"

# Optional: require a specific key tier to open this box.
# Valid values: wooden, stone, copper, iron, golden, diamond, netherite
# Players with lofibox.admin bypass this check.
# required-key: golden

# Optional: charge a Vault economy cost on open.
# Requires Vault + a compatible economy plugin (e.g. EssentialsX, CMI).
# Set to 0 or omit to disable. Players with lofibox.admin bypass this check.
# open-cost: 500.0

# Reward definitions — see the Rewards & Actions page for full reward syntax.
rewards:
  my_reward:
    weight: 10
    display-name: "<aqua>My Reward"
    item:
      material: DIAMOND
    actions:
      - "[message] <aqua>You won a diamond!"

Box Item Options

The item: section under the root of the box file defines what the box looks like as a holdable item.

Key Required Description
material Yes (if no HDB) Bukkit material name, e.g. CHEST, ENDER_CHEST
name No MiniMessage display name
lore No List of MiniMessage lore lines
custom-model-data No Integer for resource-pack model overrides
head-database-id No HeadDatabase ID — overrides material
item-data No Base64 serialized item — for complex custom plugin items

Optional Box-Level Fields

Key Description
required-key Key tier required to open (e.g. golden). See Key System.
open-cost Vault economy cost charged on open (e.g. 500.0). See Vault Cost.

Sound Names

Sounds follow the Bukkit Sound enum format. Dots are converted to underscores automatically, so both block.chest.open and BLOCK_CHEST_OPEN work.

Common values:

Sound Effect
block.chest.open Chest opening sound
entity.player.levelup Level-up jingle
ui.toast.challenge_complete Achievement sound
entity.ender_dragon.growl Dragon roar
block.amethyst_block.chime Crystal chime

Naming & Reloading

  • The box ID is derived from the filename — rename the file to change the ID.
  • Run /lofibox reload after adding or editing boxes.
  • Box IDs are case-sensitive.

Example: Three-Tier Crate Setup

plugins/LofiBox/boxes/
├── common.yml      # ID: common
├── rare.yml        # ID: rare
└── legendary.yml   # ID: legendary

Give a rare crate to a player:

/lofibox give rare Steve 1

Clone this wiki locally