Prison Crates
PrisonCrates adds crates to your prison server. Players hold keys as a balance rather than as items, so they can open one key or a million in one go, and rewards can pay out PinnaPrison currencies, boosters, enchant levels, items, keys or commands. You can also place animated crates in the world and hand out lootboxes that open on the spot.
The short version
Upload the jar to plugins/ next to PinnaPrison and start the server once so it creates its files. It ships with six crates: test, rusty, iron, golden, mythical and the treasure lootbox. In game, run:
/prisoncrates give <you> test 100
/crates
/prisoncrates item test/prisoncrates giveputs 100 Test Crate keys on your balance. Use your own name for<you>./cratesopens the crate selector. Left-click the Test Crate to open one key with the roulette reel, right-click it to see every reward and its chance, or hover over it and press Q to open every key at once. You get a chat summary of what you won./prisoncrates item testgives you the placeable Test Crate. Right-click a block to place it: it spins, bobs and shows a hologram with your own key count. Left-click it to open a key.
The Test Crate demonstrates every option, so plugins/PrisonCrates/crates/test.yml is the file to copy when you make your own. It also has an icon in the live selector, so take that icon out (see Adding a crate for where the icons live) if you don't want players to see it.
What you need
| Requirement | Details |
|---|---|
| Paper 26.1.1 | The server software the set-up is built for, running on Java 25. |
| PinnaPrison 1.2.25 | Required. EdLib ships inside the PinnaPrison jar, so don't install it separately. |
| PlaceholderAPI | Optional. Adds the %prisoncrates_...% placeholders and lets you use other plugins' placeholders in crate items, holograms and messages. |
| Vault | Optional. Lets currency:money rewards pay through Vault when PinnaPrison has no money currency of its own. |
| LuckPerms | Optional. Only needed for the permission: reward, which grants a permission node. |
| Internet on first start | Paper downloads the database drivers (HikariCP, SQLite and MySQL) the first time the plugin loads. After that it doesn't need to. |
| Permissions | Run the /prisoncrates commands as an operator or with prisoncrates.admin. |
Keys and bulk opening
Keys are a number stored with each player's data, not items. You can give keys to players who are offline, as long as they've joined the server before.
In the /crates selector, left-clicking a crate icon opens one key, right-clicking opens the reward preview, Q opens every key the player has and shift + left-click opens 10. You can change these under gui.crate-click in config.yml.
Opening 1,000 keys or more at once asks the player to confirm first. Players can turn that off with the Bulk Confirmation button in the selector, and you can change the number with gui.confirm-bulk.threshold. To cap how many keys one open can spend, set limits.max-keys-per-open (0 means no cap).
However many keys are opened, each reward is handed out once with the total: 1,000 wins of currency:tokens 3,500,000 pay 3.5 billion tokens in one payment.
In the preview, players can click a reward to filter it. A filtered reward still rolls, so the odds don't change, but it's thrown away instead of given and shows as "(filtered)" in the summary. Set toggleable: false on a reward to stop players filtering it.
Reward items go into the player's inventory, and whatever doesn't fit waits in /crates claim. Nothing is dropped on the ground. Set claim.mode: always in config.yml to send every item reward from a crate straight to /crates claim instead.
Crate files and rewards
Every file in plugins/PrisonCrates/crates/ is one crate, and the file name is its id: test.yml is the crate test. Here's a trimmed copy of test.yml:
display-name: '<gradient:#F1C226:#FD6141>&lTest Crate</gradient>'
tier: '&7[Tier #0]'
# crate: virtual keys + placeable | lootbox: a physical item only (see treasure.yml)
type: crate
# A preset from animations.yml, or none
animation: 'roulette'
# Seconds between opens per player
cooldown: 0
pools:
main:
rolls: 1 # draws from this pool per key
rewards:
tokens-small:
weight: 1800 # relative weight, not a percentage (chance = weight / pool total)
rarity: common
announce: false # broadcast when won
actions:
- 'currency:tokens 3,500,000'
display:
material: MAGMA_CREAM
name: '&f&l3,500,000 &r&4┃ &r&c&lTokens'
lore:
- '{rarity}'A crate has one or more pools, and each pool draws rolls rewards per key. The bundled crates use the weights 1800 (common), 500 (rare), 120 (legendary), 20 (mythical) and 5 (final). Run /prisoncrates simulate <crate> 1000000 to check your odds before players see them. rarity: names an entry in the rarities: list in config.yml, which sets the coloured text shown for {rarity}.
A reward can also have hidden: true (it can be won but isn't shown in the preview), permission: (only players with that node roll it), sound: and slot: (its position in the preview). test.yml shows each one with a comment.
Each line under actions: gives something. Amounts accept 3,500,000, 1_000_000 or 2.5M.
| Action | Example | What it gives |
|---|---|---|
currency:<id> <amount> |
currency:tokens 3,500,000 |
Any PinnaPrison currency. money goes to Vault if PinnaPrison has no money currency. |
currency-boosted:<id> <amount> |
currency-boosted:gems 2500 |
The same, multiplied by the player's PinnaPrison boosters and multipliers. |
keys:<crate> <amount> |
keys:rusty 10 |
Keys for any crate. |
item:<amount> |
item:1 |
The reward's own display item. |
give-item:<MATERIAL> <amount> |
give-item:DIAMOND 16 |
A plain vanilla item. |
xp:<amount> or xp:levels <amount> |
xp:levels 5 |
Experience points or levels. |
command:<command> |
command:prisoncrates givelootbox {player} treasure {amount} -s |
Runs a console command once per open. {amount} is how many times the reward was won. console: works the same. |
player-command:, command-each: |
Runs the command as the player, or once per win up to limits.max-command-repeats (1,000). |
|
message:, broadcast:, actionbar:, sound: |
message:&d&lYou found the secret reward! |
Text or a sound for the player. broadcast: goes to everyone. |
title:<title>|<subtitle> |
title:&lJACKPOT|&71,000,000,000 tokens |
A title and subtitle on the player's screen. |
permission:<node> |
Sets the permission through LuckPerms. | |
booster:<id> <currency|enchants> <multiplier> <seconds> |
booster:golden-crate tokens 0.5 600 |
A PinnaPrison booster. Winning it twice in one open doubles the time. |
booster-item:, drill:, bomb:, ability-item: |
drill:<id> 1 |
PinnaPrison items by their id. |
crystal:<id> <n>, crystal-random:<min%> <max%> <n> |
crystal-random:10 50 1 |
Crystals, stored in the crystal menu when there's room. |
enchant:<id> <levels>, level:<track> <n> |
Pickaxe enchant levels (never past the max) or levels on a PinnaPrison levelling track. | |
token-blocks:<n>, gem-blocks:<n>, greed-blocks:<enchant> <n> |
token-blocks:10000 |
What the player's own greed enchant would pay for mining that many blocks. |
crystal-slots:<n>, pickaxe-skin:<id>, backpack-attachment:<id> <n> |
crystal-slots:1 |
Crystal slots, a pickaxe skin or backpack attachments. |
The boosted-gems reward in test.yml shows the long form of an action, with type, value, amount and chance. chance: is rolled once per open, not once per win, so in a bulk open the action either runs with the full total or not at all.
Adding a crate
Copy
crates/test.yml(or one of the simpler tier crates, such asrusty.yml) tocrates/<id>.ymland change its name, animation and rewards.Run
/prisoncrates reload, then/prisoncrates listto check it loaded.Add an icon to the selector in
plugins/PinnaPrison/guis/prisoncrates/prisoncrates-crates.yml. Copy an existing crate icon and changecrate:andslot:, like this one from the file:yamlrusty: custom-item: type: 'prisoncrates-crate' crate: 'rusty' material: CHEST slot: 11 name: '&6&lRusty &r&e&lKey &r&7[Tier #1]'The
filleritem covers every unused slot, so take your new slot out of itsslot:list. Then run/pinna reload.Give yourself keys with
/prisoncrates give <you> <id> 10and try it.
Physical crates and lootboxes
A physical crate is a crate shown in the world: a spinning block with a hologram above it. It's client-side only, so nothing is placed in or saved to the world, and players see it within 32 blocks (physical.hologram-range). Its look comes from the placeable: section of the crate file, and its positions are saved in plugins/PrisonCrates/data/placed.yml.
To place one, either run /prisoncrates item <crate> and right-click a block with the item, or stand on the spot and run /prisoncrates place <crate>. Crates can't be placed in PinnaPrison's mines world. To remove one, run /prisoncrates remove near it, or sneak and left-click it. Sneak-left-clicking hands the crate item back to you.
By default, left-clicking a placed crate opens one key, right-clicking opens the preview, sneak + right-click opens every key and sneak + left-click removes it. Change these under physical: in config.yml (left-click, right-click, sneak-left-click and sneak-right-click) to preview, selector, open-one, open-all, remove or none. remove only works for players with prisoncrates.place; for everyone else it opens the preview.
A lootbox is a crate with type: lootbox. It has no keys and can't be placed. Players get it as an item, right-click it to use one up, and it opens on the spot with the crate's animation. The bundled treasure.yml is one. Give lootboxes with /prisoncrates givelootbox <player> treasure 1, or from another crate's reward with a command: action, as golden.yml and mythical.yml do. In the selector, a lootbox icon only opens its preview.
Animations
A crate picks its animation with animation: <preset>, from the presets in plugins/PrisonCrates/animations.yml. Use none to give rewards instantly.
| Preset | What players see | Used by |
|---|---|---|
roulette |
Rewards slide through a reel in a menu and slow down under a marker. | test, rusty |
flicker |
Every reel slot flickers through random rewards until the result lands in the middle. | iron |
lootbox |
The crate pops up in front of the player, spins faster and bursts into its rewards. | golden |
lootbox-public |
The same, but everyone nearby can see it. | |
reveal |
One reward grows big in front of the player. Made for single rewards worth showing off. | treasure |
chests |
Chests rise in a ring around the player, who clicks them to open them. | mythical |
fountain |
The box fires its rewards up and they land in a row. | |
orbit |
The rewards circle the player, then snap into a line. |
The rewards are rolled before the animation starts, so animations never change the odds. Rewards are given at the animation's grant point, or straight away if the player closes the menu or leaves. In-world animations are client-side only.
animate-bulk: false on a crate skips the animation when more than one key is opened. Players can turn animations off with /crates animations or the button in the selector, and force-animation: true on a crate plays them anyway. Sounds and particles in the in-world animations follow each player's PinnaPrison sound and particle settings.
Commands
Player commands. /crates has the aliases /crate, /keys and /lootbox.
| Command | Permission | What it does |
|---|---|---|
/crates |
prisoncrates.use |
Opens the crate selector. /keys on its own lists your keys instead. |
/crates preview <crate> |
prisoncrates.use |
Opens a crate's reward preview. /crates <crate> does the same. |
/crates keys |
prisoncrates.use |
Lists your keys. /crates balance does the same. |
/crates claim |
prisoncrates.use |
Opens your unclaimed reward items. |
/crates animations |
prisoncrates.use |
Turns opening animations on or off for you. |
/crates open <crate> [amount|all] |
prisoncrates.use |
Opens keys without the menu. Asks first at 1,000 keys or more. |
/crates help |
prisoncrates.use |
Lists the player commands. |
Admin commands. /prisoncrates has the alias /edcrates.
| Command | Permission | What it does |
|---|---|---|
/prisoncrates reload |
prisoncrates.admin |
Reloads the config, messages, animations and crate files, and respawns placed crates. |
/prisoncrates give <player> <crate> <amount> |
prisoncrates.admin |
Adds keys. Works for offline players who've joined before. |
/prisoncrates take <player> <crate> <amount> |
prisoncrates.admin |
Removes keys, never going below zero. |
/prisoncrates set <player> <crate> <amount> |
prisoncrates.admin |
Sets a player's keys to an exact number, including 0. |
/prisoncrates giveall <crate> <amount> |
prisoncrates.admin |
Gives keys, or lootbox items, to everyone online. |
/prisoncrates givelootbox <player> <lootbox> [amount] |
prisoncrates.admin |
Gives lootbox items to an online player. |
/prisoncrates balance [player] |
prisoncrates.admin |
Shows a player's keys and how many they've opened. |
/prisoncrates item <crate> [player] [amount] |
prisoncrates.admin |
Gives the placeable crate item, or the item of a lootbox. |
/prisoncrates place <crate> |
prisoncrates.admin |
Places a crate where you're standing. |
/prisoncrates remove |
prisoncrates.admin |
Removes the nearest placed crate within 6 blocks. |
/prisoncrates preview <crate> [player] |
prisoncrates.admin |
Opens a crate's preview for you or another player. |
/prisoncrates open <crate> [amount|all] [player] [-free] |
prisoncrates.admin |
Opens keys for a player without asking. -free spends no keys, and all with -free opens one. |
/prisoncrates simulate <crate> [keys] |
prisoncrates.admin |
Rolls without giving anything and shows each reward's count against the expected one. Defaults to 100,000 keys. |
/prisoncrates top <crate> [limit] |
prisoncrates.admin |
Lists who holds the most keys. Shows 10 by default, up to 100. |
/prisoncrates list |
prisoncrates.admin |
Lists the loaded crates with their type, reward count and animation. |
/prisoncrates animations <on|off> [player] |
prisoncrates.admin |
Turns animations on or off for a player. |
/prisoncrates gui <id> [player] |
prisoncrates.admin |
Opens any PinnaPrison menu file by its id. |
Permissions
| Permission | Default | What it gives |
|---|---|---|
prisoncrates.use |
Everyone | /crates and the crate menus. |
prisoncrates.admin |
Op | Every /prisoncrates command. |
prisoncrates.place |
Op | Placing a crate by right-clicking with its item, and removing placed crates by sneak-left-clicking them. |
prisoncrates.* |
Op | All three of the above. |
You can lock a whole crate, or a single reward, behind a permission of your own with permission: in the crate file.
Files
| File | Edit it to | How changes apply |
|---|---|---|
plugins/PrisonCrates/config.yml |
Change storage, limits, rarities, click actions, the bulk confirmation threshold, claim mode and physical crate settings. | /prisoncrates reload, except the storage: section, which needs a restart. |
plugins/PrisonCrates/messages.yml |
Change any message. Leave one blank ('') to turn it off. |
/prisoncrates reload |
plugins/PrisonCrates/animations.yml |
Change or add animation presets. | /prisoncrates reload |
plugins/PrisonCrates/crates/<id>.yml |
Add or change crates and their rewards. | /prisoncrates reload |
plugins/PrisonCrates/data/ |
Nothing. It holds player data (players/<uuid>.yml with yaml storage, crates.db with sqlite) and the placed crates (placed.yml). Use the commands instead. |
|
plugins/PinnaPrison/guis/prisoncrates/*.yml |
Change the menus: prisoncrates-crates (the selector), prisoncrates-crate-preview, prisoncrates-lootbox-preview, prisoncrates-confirm, prisoncrates-claim, and the prisoncrates-roulette and prisoncrates-flicker reels. |
/pinna reload |
The menus are PinnaPrison GUI files. PrisonCrates writes them once and never overwrites them, so your edits are safe across updates. Delete one and restart to get the default back. The six bundled crate files are only written when the crates/ folder doesn't exist yet.
storage.type can be yaml, sqlite or mysql. Use mysql if you run several servers, so keys follow players between them.
Placeholders
These need PlaceholderAPI. Replace <crate> with a crate id, such as rusty. Player values only show for players who are online.
| Placeholder | Shows |
|---|---|
%prisoncrates_keys_<crate>% |
The player's keys for a crate, with separators. keys_raw_<crate> gives a plain number and keys_compact_<crate> a short one, such as 12.3K. |
%prisoncrates_total% |
The player's keys across every crate. |
%prisoncrates_opened_<crate>% |
How many keys of a crate the player has opened. opened_total counts every crate. |
%prisoncrates_unclaimed% |
How many reward items are waiting in /crates claim. unclaimed_raw gives a plain number. |
%prisoncrates_animations% |
Whether the player has animations on, using the text in messages.yml. |
%prisoncrates_name_<crate>% |
The crate's display name. |
%prisoncrates_rewards_<crate>% |
How many rewards the crate shows in its preview. |
%prisoncrates_rotating_<crate>% |
The reward the crate's hologram is showing right now. |
%prisoncrates_placed% |
How many physical crates are placed. |
Troubleshooting
A new crate works with commands but isn't in /crates.
The selector is a menu file, so it only lists the crates you add to it. Add an icon to plugins/PinnaPrison/guis/prisoncrates/prisoncrates-crates.yml (see Adding a crate) and run /pinna reload. If /prisoncrates list shows the crate with 0 rewards, or the console says crates/<id>.yml has no rewards when you reload, the file most likely has a YAML mistake. The console error above that line says where.
Menu changes don't show after /prisoncrates reload.
That command doesn't reload menus. Run /pinna reload instead. If the console says GUI '...' does not exist, the menu file is missing or the id under gui: in config.yml doesn't match a file name.
A reward gives nothing.
Check the console after opening. Unknown reward action type means a typo in the action, and no hooked economy knows means the currency id doesn't exist in PinnaPrison. token-blocks, gem-blocks and greed-blocks pay nothing to players who don't have that greed enchant, and permission: rewards need LuckPerms. If the summary shows the reward as "(filtered)", the player filtered it in the preview: they can click it again there to undo that.
Players keep seeing "Your crate data is still loading".
Their data couldn't be loaded. Look for Could not load crate data in the console. With sqlite or mysql, check the storage: settings in config.yml and that the server could download the database drivers on its first start, then restart.
A placed crate disappeared when I sneak-clicked it.
By default, sneak + left-click removes a placed crate for anyone with prisoncrates.place, which ops have, and gives the crate item back. Right-click a block with the item to put it back. To stop it happening, set physical.sneak-left-click to preview or none and run /prisoncrates reload.
"Player not found!" when giving keys.
give, take, set and balance only work for offline players who've joined this server before, or by their UUID. givelootbox, item and open need the player to be online.
Last updated