Skip to content

Rewards and Actions

Lord_Lofi edited this page Nov 11, 2026 · 2 revisions

Rewards & Actions

Rewards are defined under the rewards: key of a box file. Each key is the reward's ID and must be unique within that box.


Reward Structure

rewards:

  my_reward_id:
    # Relative weight. Higher = more likely. Not a percentage.
    weight: 20

    # MiniMessage name shown in the spin GUI and win message.
    display-name: "<aqua>5x Diamonds"

    # Optional: only players with this permission can win this reward.
    # Players without it are re-rolled. Ops with lofibox.bypass skip this check.
    permission-required: ""

    # The item definition (same options as box items).
    item:
      material: DIAMOND
      name: "<aqua>Diamonds"
      lore:
        - "<gray>A shiny reward!"
      amount: 5
      custom-model-data: 0
      # head-database-id: "12345"
      # item-data: "base64string..."
      enchants:
        FORTUNE: 3

    # Actions that fire when this reward is won.
    actions:
      - "[message] <aqua>You received 5 Diamonds!"
      - "[sound] block.amethyst_block.chime"

Weight & Chance

Weights are relative — they do not need to add up to 100. The chance of winning a reward is:

chance = reward_weight / sum_of_all_weights × 100

Example:

Reward Weight Chance
Iron Ingots 50 50 / 76 = 65.8%
Golden Apple 20 20 / 76 = 26.3%
Diamond 5 5 / 76 = 6.6%
Netherite Ingot 1 1 / 76 = 1.3%

Players who do not qualify for a permission-gated reward are re-rolled from the eligible pool — their weight totals are recalculated dynamically.


Enchantments

Specify enchantments under enchants: with the enchantment's name and level. Accepted names:

  • Minecraft keys, in any case: sharpness, SHARPNESS, or minecraft:sharpness
  • Custom enchantments from datapacks: namespace:key
  • Old Bukkit names, for existing configs: DAMAGE_ALL, DURABILITY, LOOT_BONUS_BLOCKS, etc.

Unknown names are skipped.

enchants:
  SHARPNESS: 5
  UNBREAKING: 3
  MENDING: 1

For ENCHANTED_BOOK items, enchants are stored correctly as book enchantments automatically.


Action System

Actions fire in order after the win animation completes. Each line starts with a tag.

[message]

Sends a chat message to the winning player.

- "[message] <green>You won!"

[actionbar]

Sends an action bar message.

- "[actionbar] <gold>✦ Big win! ✦"

[title]

Shows a title. Separate title and subtitle with ;.

- "[title] <gold>EPIC WIN!;<gray>You received a Netherite Ingot"

[sound]

Plays a sound at the player's location. Uses the same names as box sounds (see Sound Names): sound keys, custom resource-pack sounds, or old-style names.

- "[sound] entity.ender_dragon.growl"

[command]

Runs a command as the winning player.

- "[command] warp spawn"

[console]

Runs a command as console. Use {player} for the player's name.

- "[console] lp user {player} parent set vip"
- "[console] eco give {player} 5000"

Action Placeholders

Placeholder Value
{player} Player's username
{uuid} Player's UUID
{reward} Reward display name
{box} Box display name

PlaceholderAPI placeholders (e.g. %vault_eco_balance%) are also parsed in action strings if PAPI is installed.


Permission-Gated Rewards

Set permission-required to a permission node. Players without it are re-rolled automatically — they will never see or win that reward.

vip_key:
  weight: 1
  display-name: "<gold>VIP Key"
  permission-required: "lofibox.vip"
  item:
    material: TRIPWIRE_HOOK
  actions:
    - "[console] lofibox give vip_crate {player} 1"

Admins with lofibox.bypass always qualify for every reward regardless of permission-required.

Clone this wiki locally