Skip to content

Key System

Lord_Lofi edited this page Apr 19, 2026 · 1 revision

Key System

LofiBox includes a seven-tier physical key system. Boxes can optionally require a specific key tier to open, giving server admins fine-grained control over access.


Key Tiers

Tier Display Name Custom Model Data
wooden Wooden Key (Tier I) 1001
stone Stone Key (Tier II) 1002
copper Copper Key (Tier III) 1003
iron Iron Key (Tier IV) 1004
golden Golden Key (Tier V) 1005
diamond Diamond Key (Tier VI) 1006
netherite Netherite Key (Tier VII) 1007

Keys are tripwire hook items with a hidden Unbreaking I enchantment (for the enchanted glow effect), tier-specific names, lore, and PDC tags. Custom model data values (1001–1007) can be used with a resource pack to give each tier a unique 3D model.


Giving Keys

/lofibox givekey <tier> <player> [amount]

Examples:

/lofibox givekey golden Steve
/lofibox givekey netherite Alex 5

Permission: lofibox.give

Tab completion includes all valid tier names.


Requiring a Key to Open a Box

Add required-key to any box YAML file:

# plugins/LofiBox/boxes/mythic.yml
name: "<gradient:#a78bfa:#6366f1>Mythic Crate</gradient>"

required-key: golden    # Players must have a Golden Key to open this box

item:
  material: CHEST
  name: "<gradient:#a78bfa:#6366f1>✦ Mythic Crate ✦</gradient>"
  lore:
    - ""
    - "<gray>Requires a <gold>Golden Key</gold> to open!"

# ... rest of box config

Valid values: wooden, stone, copper, iron, golden, diamond, netherite (case-insensitive).

Omit required-key entirely (or leave it blank) to allow the box to be opened without any key.


How It Works

  1. Player right-clicks a box item (or runs /lofibox open <box>).
  2. If the box has a required-key, LofiBox checks the player's entire inventory for a matching key.
  3. If no key is found, the player receives a key-required message and the box is not consumed.
  4. If a key is found, both the box and one key are consumed, then the spin begins.

Key consumption happens after box item deduction to ensure neither item is lost on edge cases.


Admin Bypass

Players with the lofibox.admin permission skip the key check entirely. The /lofibox open command also bypasses key requirements for admins (no item consumed at all).


Customizing Messages

Edit plugins/LofiBox/messages.yml:

key-required: "<prefix><red>This box requires a <white>{key}<red> to open."
key-consumed: "<prefix><gray>Your <white>{key}<gray> was consumed."

Placeholders:

Placeholder Description
{key} Display name of the required key tier
{box} Display name of the box

Clone this wiki locally