Repository navigation
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.
| 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.
/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.
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 configValid 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.
- Player right-clicks a box item (or runs
/lofibox open <box>). - If the box has a
required-key, LofiBox checks the player's entire inventory for a matching key. - If no key is found, the player receives a
key-requiredmessage and the box is not consumed. - 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.
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).
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 |