Skip to content

Lucky Blocks

Jan Kluka edited this page Nov 1, 2026 · 5 revisions

Lucky Blocks

Lucky Blocks is a premium addon: collectible lucky blocks that drop as players mine and open into weighted rewards — every rarity, reward, message, title and sound is yours to configure, there is no database to maintain, drops cannot be inflated by enchant procs or lost to placement, it works the same on packet and normal mines plus ItemsAdder/Nexo/Oraxen, and the console tells you on every boot exactly how your numbers will play out.

In detail: while mining, players have a chance to find a lucky block — a unique item that goes into their inventory and takes a further number of mined blocks to open. Every lucky block a player is carrying advances off the same mining, so carrying several is worth it. When one reaches its requirement it is consumed and pays out the rewards configured for its rarity.

Requires X-Prison 2026.3.15.1+ (1.1.0+). Drop X-Prison-LuckyBlocks-<version>.jar into plugins/X-Prison/addons/ and restart.

Which lucky blocks?

There are three separate things in X-Prison with "lucky block" in the name. They are unrelated and can all run at the same time.

What it does
This addon Mining drops a collectible item of a rolled rarity. It opens after a further number of mined blocks and pays its rarity's rewards.
Core lucky-blocks: in blocks.yml — deprecated Breaking one particular block type has a chance to pay out instantly. No item, no carrying, no progress. Superseded by this addon and due for removal in a future release; it ships empty on a new install and still works where it is configured. It is the only one of the three that can key a reward off a block type or consume the block with give-block: false, so it is not something this addon can take over wholesale.
The Lucky Block enchant addon An enchant proc turns the block you broke into a sponge in the world. Breaking that sponge redeems a reward.

How it works

  1. A player mines. Every block they break themselves counts - see below.
  2. On each break there is a drop.chance (percent, per block) that a lucky block is found. If it hits, a rarity is picked from the weighted ladder and the item goes into the inventory.
  3. Each lucky block carries a requirement - how many further blocks must be mined before it opens. The requirement is stamped onto the item when it drops.
  4. All of a player's lucky blocks advance off the same mining. A player carrying five is working on five at once.
  5. When one reaches its requirement it is removed from the inventory and its rarity's reward pool is rolled.

Every lucky block is unique, so they never stack and each takes one inventory slot.

Lucky blocks cannot be placed as blocks. A placed block keeps none of the item's persistent data, so placing one would strip its identity and its progress and hand back a plain head when it was broken again. Attempts are cancelled and the player is told why (cannot-place in the messages file - empty the line to silence it). Wearing one in the helmet slot is allowed and still counts toward progress.

Files

Everything lives in plugins/X-Prison/addons/LuckyBlocks/. Files are only written when missing - to regenerate them with the current defaults, delete the folder and restart.

File Holds
luckyblocks.yml Drop chance and roll mode, sources, worlds, carrying limits, progress writing, the progress bar
luckyblocks-rarities.yml The rarity ladder: odds, requirements, items, titles, sounds, rewards
luckyblocks-messages.yml Every player-facing line, in MiniMessage

Rarities

Four ship configured: Rare, Epic, Legendary and Mythical, each on its own custom head. Declaration order is ladder order, and the list is taken exactly as you leave it - a rarity you delete stays deleted.

Rarity Share of drops Blocks to open At 20 blocks/sec Typically carried
Rare 62.5% 3,000 2.5 min ~3.8
Epic 25% 7,500 6 min ~3.8
Legendary 10% 10,000 8 min ~2.0
Mythical 2.5% 13,500 11 min ~0.7
rarities:
  rare:
    display-name: '<aqua>Rare'
    weight: 250              # share of drops = weight / total of all weights
    blocks-required: 3000    # further blocks needed before it opens
    item:
      material: PLAYER_HEAD
      head-texture: 'eyJ0ZXh0dXJlcyI6...'   # base64 skin; replaces the material when set
      custom_model_data: 0
      glow: false
      name: '<aqua><bold>Lucky Block'
      lore:
        - '<gray>Progress: <white>%progress%<dark_gray>/<white>%required%'
        - '%bar% <gray>%percent%<gray>%'
    effects:
      on-drop:
        title: { enabled: false, title: '', subtitle: '', fade-in: 1, stay: 2, fade-out: 1 }
        sound: { enabled: true, sound: ENTITY_ITEM_PICKUP, volume: 1.0, pitch: 1.2 }
      on-complete:
        title:
          enabled: true
          title: '<aqua><bold>LUCKY BLOCK'
          subtitle: '<gray>You opened a <aqua>Rare <gray>block'
          fade-in: 1
          stay: 3
          fade-out: 1        # times are in SECONDS
        sound: { enabled: true, sound: ENTITY_PLAYER_LEVELUP, volume: 1.0, pitch: 1.0 }
    rewards:
      chance: 100.0          # chance the pool pays anything at all
      pick-one: true         # true = one weighted winner; false = every entry rolls on its own
      pool:
        - chance: 65.0
          commands: ['money give %player% 1000000 -s']
          messages: ['<green>+ $1M']
        - chance: 35.0
          commands: ['tokens give %player% 2000 -s']
          messages: ['<aqua>+ 2k tokens']

weight is not a percentage. A rarity's share is its weight divided by the total of every weight - with the shipped values the total is 400, so weight: 250 is 62.5% of drops. A weight of 0 means it never drops from mining but can still be handed out with the give command.

The commands and amounts that ship are examples. They assume money and tokens commands exist. Point them at your own commands and your own numbers before going live.

Placeholders inside a rarity

Where Available
item.name, item.lore %rarity% %rarity_display% %progress% %required% %remaining% %percent% %bar%
effects titles %rarity% %rarity_display% %player%
rewards.pool commands, messages %player% %rarity% %rarity_display% %blocks%

Drop settings

drop:
  chance: 0.2              # percent, per block the player breaks themselves
  require-permission: false
  on-inventory-full: DROP  # DROP | SKIP

0.2 is one lucky block per 500 blocks mined. To pick your own: chance = 100 / (blocks you want between drops).

How many a player ends up carrying is the drop rate multiplied by how long one takes to open, so a generous chance and a long requirement compound rather than cancelling out. The console works this out for you on every boot and reload:

A player will carry about 10 lucky block(s) at once: one drops every 500 blocks mined
and takes about 5088 more to open.

and warns if that number runs away.

The shipped numbers are tuned around a player breaking roughly 20 blocks a second: one lucky block turns up about every 25 seconds, each takes between 2 and 11 minutes of mining to open, and the two together leave about ten on the go at once - a full row of progress bars filling.

That is a deliberately fast loop, and it means roughly 144 rewards an hour per active miner. Check your reward pools against that before going live. To keep ten in flight at a calmer pace, scale chance and every blocks-required down together - halving both keeps the ratio and halves the payout rate.

What counts as a mined block

Only a block the player broke themselves. Blocks broken for them by an area enchant - Explosive, Nuke, Layer, Drill, the Animated packs - never turn up a lucky block and never push a carried one closer to opening.

That is deliberate, and it is not tunable. A single swing can clear several hundred blocks, so counting them would tie both the drop rate and the opening rate to how strong a pickaxe is rather than to how much someone actually mines - and no drop chance is small enough to survive that. With manual breaks only, a player who mines twice as long gets twice as much, which is the whole point.

Enchants reach their blocks in one of two ways and both are excluded: they either fire synthetic break events, which the core marks as ignored, or they report their blocks in bulk on their own events, which this addon does not listen to.

This works the same on ordinary mines and on packet (virtual) mines - a player breaking a virtual block still produces a real break event, which is what the core relies on for its own block statistics - and it covers custom blocks from ItemsAdder, Nexo and Oraxen.

Carrying limits

Off by default.

hold:
  max-total: 0             # 0 = unlimited
  max-per-rarity: 0        # 0 = unlimited
  bypass-permission: xprison.luckyblocks.hold.bypass
  on-hold-limit: SKIP      # DROP | SKIP

Raise the total for individual players with xprison.luckyblocks.hold.<number> - the highest number they have wins.

Progress and saving

There is no database. Progress lives on the item, so a lucky block that is traded, dropped or stored in a chest keeps the mining it has already earned.

Mining is counted the instant it happens. progress.write-interval-seconds (default 30) is only how often that count is written into the items, and progress is also written whenever a lucky block is about to leave an inventory - traded, dropped, lost on death - and when the player logs out. The only thing that interval risks is a server crash, which costs at most that many seconds of progress.

Commands

Command Permission Does
/luckyblocks everyone Lists what you are carrying and how close each one is
/luckyblocks give <player> <rarity> [amount] xprison.luckyblocks.admin Hands lucky blocks over
/luckyblocks take <player> <rarity> [amount] xprison.luckyblocks.admin Removes them
/luckyblocks clear <player> xprison.luckyblocks.admin Removes every lucky block
/luckyblocks reload xprison.luckyblocks.admin Re-reads all three files

The command name, its aliases and the admin permission are all set in luckyblocks.yml. Admin subcommands need the target to be online - lucky blocks live in the inventory, so there is nothing to change while a player is away.

Permission Grants
xprison.luckyblocks.admin The admin subcommands
xprison.luckyblocks.drop Finding lucky blocks, when drop.require-permission is on
xprison.luckyblocks.hold.<number> Raises the carrying limit
xprison.luckyblocks.hold.bypass Ignores the carrying limits entirely

Placeholders

Requires PlaceholderAPI. All of these describe the block closest to opening, except the counts.

Placeholder Gives
%xprisonluckyblocks_held% How many lucky blocks are being carried
%xprisonluckyblocks_held_<rarity>% How many of one rarity
%xprisonluckyblocks_progress% Blocks mined toward the nearest one
%xprisonluckyblocks_required% Its requirement
%xprisonluckyblocks_remaining% Blocks still to go
%xprisonluckyblocks_percent% Progress as a whole percentage
%xprisonluckyblocks_bar% The progress bar
%xprisonluckyblocks_nearest_rarity% Its rarity display name

Troubleshooting

The addon checks its configuration at startup and after every reload, and says so in the console rather than refusing to boot. Watch for:

  • "That is far faster than they can open them" - your drop chance outruns your requirements, so lucky blocks will pile up and fill inventories. Lower drop.chance or raise blocks-required.
  • "Every rarity has a weight of 0" - nothing can drop from mining.
  • "Rarity X has an empty reward pool" - opening one pays nothing.
  • "Rarity X has a head-texture that cannot be built" - the base64 value is wrong; the material is used instead.
  • "This version adds N setting(s) your luckyblocks.yml does not have" - an update added keys. The bundled defaults are used until you add them; nothing is broken.

Translations

Since 1.1.0 the addon follows each player's /xprison language (X-Prison 2026.3.15.1+). German, Spanish, French and Brazilian Portuguese are included for luckyblocks-messages.yml and luckyblocks-rarities.yml. A lucky block item is written in the language of the player who finds it. The message of a reward in a reward list is not translated - write it in your own language. Your edited lines always win. To change a translation, write the line in plugins/X-Prison/lang/addons/LuckyBlocks/<language>/<same file name> - see Translations.

XPrison Logo

General

Modules

Default Configs

Enchant Configs — Passive

Enchant Configs — Currency Rewards

Enchant Configs — Key & Item Rewards

Enchant Configs — Area of Effect

Enchant Configs — Multipliers

Enchant Configs — Templates

Enchant Configs — Addons

Addons

Support

For Developers

Others

Clone this wiki locally