TreasureSpawn
Treasure chests turn up near your players as they explore, on a clock you control. Each one rolls a tier, fills itself from your loot tables and floats a label above it. And some of them are alive.
How it works
Every player has their own clock. When it runs out they get one chest and the clock starts again. There is no global draw, no queue, and nobody waits behind anybody else. "A chest every two minutes" means exactly that.
Installation
- Copy TreasureSpawn-2.0.jar into your server's plugins/ folder.
- Restart the server. Java 21 is required.
config.yml,loot.ymland thelang/folder are written, all commented.- Set it up with /tsadmin or by editing the files. Read
chests.max-per-playerbefore anything else.
Permission nodes renamed since 1.x
| 1.x | 2.0 | Note |
|---|---|---|
treasurespawn.spawn | treasurespawn.receive | Receive chests. |
treasurespawn.cooldown.<x> | treasurespawn.fast.<x> | Interval reduction for VIPs. |
treasurespawn.bypass.cooldown | removed | It was the cause of the 1.x bug. treasurespawn.request with /ts spawn replaces it, and the per-player cap still applies to it. |
When chests appear
Everything that decides when a chest appears is in one place in the config, and the three settings that affect each other sit together. That is not tidiness for its own sake: it is exactly what went wrong in 1.x.
spawn:
# Segundos entre los cofres de UN jugador. Un rango o un número suelto.
interval: "300-900"
# Si no se puede colocar, se reintenta dentro de este rato.
# NO se guarda el cofre para después: nadie recibe cinco de golpe.
retry-seconds: 30
# Tiene que haberse movido hace poco. Para que las cuentas aparcadas
# no recojan nada por la noche.
require-activity: true
activity-seconds: 120
# A qué distancia del jugador, en bloques.
min-distance: 12
max-distance: 30The cap, which is the important one
chests:
# Cofres SIN ABRIR que un jugador puede tener alrededor a la vez.
# Es un techo, no un objetivo. Mientras esté en su tope, no se le
# pone ninguno más, por corto que sea el intervalo.
max-per-player: 2
# Red de seguridad para servidores llenos. No es el freno principal.
max-per-world: 60
# Segundos que espera un cofre a que lo reclamen.
despawn-seconds: 600If your numbers fight each other, the plugin says so: once in the console, and inside the admin menu on the very screen where you are changing them.
VIPs: shorter intervals
interval-reductions:
"treasurespawn.fast.vip": 25
"treasurespawn.fast.vip2": 50
"treasurespawn.fast.mvp": 75Give a player one of those permissions and their interval drops by that percentage. With several, the biggest one wins. You choose the names.
Chests & loot
Each tier is a kind of chest: its weight, its loot table, how many items it rolls, its coloured name and its block. The block matters more than it looks — it is what tells a player what they found before they get there.
| Tier | Block | Weight |
|---|---|---|
| Common | BARREL | 60 |
| Rare | CHEST | 25 |
| Legendary | ORANGE_SHULKER_BOX | 12 |
| Mythic | MAGENTA_SHULKER_BOX | 3 |
Any single-block container works: chest, trapped chest, barrel or any shulker colour. If you set a block with no inventory, the console tells you at load time instead of leaving you a chest that will not open. The block also turns to face the player, so it looks placed rather than generated.
The loot table
common:
display-name: "&fCommon Chest"
weight: 60
chest-material: BARREL
hologram: "&f&lCOMMON CHEST\n&7Gone in &f{time}"
items-min: 3
items-max: 5
loot:
- item: IRON_INGOT
amount: "2-6"
chance: 70
- item: DIAMOND_SWORD
amount: "1"
chance: 25
name: "&6Treasure Blade"
lore:
- "&7Pulled from a forgotten chest."
enchants:
- "sharpness:4"
- "unbreaking:3"Every item is checked when the file loads. Anything the server does not recognise is skipped with a line in the console saying which one, so a typo costs you that item and not the whole tier.
Items from other plugins
- mmoitems: "SWORD:CUTLASS"
chance: 20
- elementalarms: "flame_sword"
chance: 15The in-game editor
/tsadmin loot. Numbers are easier to tune in the file — you see them all together and you can copy them to another server. The editor exists for one thing the file cannot do: adding an item. Writing an item by hand with its enchantments, lore and model data is impossible to get right first time.
- Shift-click any item in your inventory and it is added to the table. Six items, six clicks, without closing anything.
- Nothing moves. The item never leaves your inventory — it is only read and written down.
- It recognises items from MMOItems or ElementalArms and writes the right reference.
- Left/right adjusts the chance, shift the amount, Q removes the line.
- You can create and delete whole tiers without touching a file. New ones start empty: a tier with loot nobody chose hands out things you did not pick.
Mimics
A mimic is not a trap that slaps you and ends: it is a fight. The chest wakes up and comes at you. Beating it drops more than the honest chest it was pretending to be; letting it escape costs you the lot.
That matters because a random punishment has a problem underneath it: the player decides nothing and can do nothing, so the sensible reaction is to stop opening chests — the opposite of what the plugin wants.
The five kinds
| Kind | Mob | The question it asks |
|---|---|---|
| Brawler | Zombie | Can I take it? |
| Runner | Husk | Can I catch it? |
| Splitter | Zombie | Can I get them all? |
| Flyer | Vex | Where do I stand? |
| Swarm | Baby zombies ×5 | Which one first? |
What makes it a fight and not a coin flip
The ten abilities
Each one has a when, and that is the whole difference. A lightning bolt that lands while you fight makes you move; the same bolt fired as you open the chest just takes health off you. Same ability, nothing alike.
| When | What it is |
|---|---|
wake | Once, as it bursts out. The scare. |
fight | Every few seconds while you fight it. |
hurt | When you land a hit. Its answer. |
death | Its last trick. |
- scream — a ghast scream. The only one on by default.
- lightning — a bolt. Cosmetic unless you set
real: true, because the real one also sets fire to the ground. - creepers — they are lit, not detonated outright: you get half a second to move. An explosion with no warning is not difficulty, it is a tax.
- ignite — sets you on fire.
- cage — walls you in. It only replaces air and puts every block back: a cage that eats somebody's floor is permanent damage for a five-second scare.
- teleport — throws you somewhere else. Never into a wall: it gives up first.
- money-penalty — charges through Vault. It takes a percentage instead of a flat amount if you want, because a flat number is nothing in two months and ruinous for a new player. It never leaves a negative balance.
- explosion — breaks no blocks unless you say so, and never sets fire.
- fake-loot — drops, glitters and is gone before you reach it. The only purely mocking one, and rightly so: it costs the player nothing.
- commands — runs console commands, with
{player}.
Protection & hooks
Who the chest belongs to
chests:
# Segundos en los que solo su dueño puede abrirlo. 0 = de quien lo encuentre.
protect-owner-seconds: 90
# No se puede romper, quemar, empujar con un pistón ni volar.
unbreakable: true
# Los jugadores no pueden meter SUS objetos dentro.
block-item-insert: trueOne thing worth knowing: if protect-owner-seconds is equal to or greater than despawn-seconds, nobody but the owner will ever open a chest — they vanish before they come free. The plugin warns you if that happens.
WorldGuard
worldguard:
# Nunca donde ESE jugador no podría construir.
respect-build-permission: true
# Obedecer la flag 'treasure-spawn'.
respect-flag: true
# Más estricto: en ninguna región, sea de quien sea.
block-all-regions: falseA region flag of its own is registered. To keep chests out of a region:
/rg flag <region> treasure-spawn denyCommands
| Command | What it does |
|---|---|
/ts | For an admin: how long until the next chest and where the waiting ones are. For a normal player: what the plugin is. |
/ts spawn | Ask for one now. Needs treasurespawn.request, and your cap still applies. |
/ts give <tier> [jugador] | Place a chest of that tier. |
/ts ver | Version and author. |
/tsadmin | Opens the settings menu. |
/tsadmin loot | The tier and loot editor. |
/tsadmin why [jugador] | Why they have, or have not, got a chest. |
/tsadmin status | Settings and how many chests are out. |
/tsadmin clear | Remove every chest. |
/tsadmin reload | Reload config, languages and loot. |
Aliases for /treasurespawn: /ts, /treasure, /randomchest. Aliases for /treasurespawnadmin: /tsadmin.
Permissions
| Permission | What it grants | Default |
|---|---|---|
treasurespawn.receive | Chests appear for them. | true |
treasurespawn.command | Use the player command. | true |
treasurespawn.admin | Admin commands, the settings menu, the loot editor and seeing the countdown. | op |
treasurespawn.request | Ask for a chest by hand with /ts spawn. | false |
treasurespawn.open.any | Open somebody else's chest, ignoring its protection. | op |
treasurespawn.fast.<nombre> | A percentage off their interval. You define the names in the config. | — |
Configuration
One commented config.yml and a loot.yml for your tables. Almost all of it can also be set from /tsadmin — 43 settings, by clicking: left raises, right lowers, shift multiplies by ten. Every change saves and reloads on the spot.
Sounds and particles
effects:
enabled: true
chest-spawn-sound: "ENTITY_PLAYER_LEVELUP"
chest-spawn-particle: "HAPPY_VILLAGER"
mimic-wake-sound: "ENTITY_RAVAGER_ROAR"
mimic-hit-sound: "BLOCK_WOOD_BREAK"
mimic-death-sound: "ENTITY_PLAYER_LEVELUP"
mimic-flee-sound: "ENTITY_ENDERMAN_TELEPORT"
mimic-tell-sound: "BLOCK_BARREL_CLOSE"
mimic-scream-sound: "ENTITY_GHAST_SCREAM"Every name is looked up when it is used, and if this server does not know it, it is reported once in the console and the plugin carries on without it: a wrong name costs you that one sound, never the plugin. Leave any of them empty ("") to turn just that one off.
Languages
Four are included and all are editable: en, es, fr, zh, in the lang/ folder. Copy one, rename it and put its name in language. New text from an update is added to your file on its own, so a translation is never lost.
Version history
Every release and what changed in it.
- ✨Rewritten from scratch. A clean install is strongly recommended: move your plugins/TreasureSpawn/ folder aside as a backup and let the new files generate.
- ✨Renamed permissions: treasurespawn.spawn → treasurespawn.receive, treasurespawn.cooldown.<name> → treasurespawn.fast.<name>. treasurespawn.bypass.cooldown was removed.
- ✨Mimics are a fight, not a trap. The chest wakes up and comes at you, and beating it drops more than the honest chest it imitated.
- ✨Five kinds of mimic: brawler, runner, splitter, flyer and swarm.
- ✨Mimics drop part of their loot as you damage them, so a fight you lose still leaves something behind.
- ✨Mimics can disguise themselves as a better tier than they carry, and give themselves away to an attentive player.
- ✨A killed mimic may leave another chest behind, which is likelier than usual to bite too.
- ✨Ten mimic abilities, each with its own moment (waking, mid-fight, when hurt, on death): scream, lightning, creepers, fire, cage, teleport, money penalty, explosion, fake loot and commands.
- ✨Admin GUI with 43 settings, edited by clicking: left raises, right lowers, shift multiplies by ten.
- ✨In-game loot editor: shift-click an item in your inventory and it enters the loot table, enchantments and all. Nothing leaves your inventory.
- ✨ElementalArms items can now be used in loot tables, alongside MMOItems.
- ✨Each tier has its own block (barrel, chest, shulker...), so players can tell what they found from a distance.
- ✨The chest spawn message now includes the coordinates.
- ✨/tsadmin why explains in four lines why a player has, or has not, got a chest.
- ✨New commands: /tsadmin loot, status and why; /ts spawn, give and ver; plus the /randomchest alias.
- ✨New permission treasurespawn.request lets a player ask for a chest with /ts spawn, capped as usual.
- ✨WorldGuard: chests never spawn where the player could not build.
- ✨A 1.x config.yml is migrated automatically, keeping a copy as config-1.x.yml.old.
- 🔧Every player now has their own spawn clock instead of a global draw. 60-120 seconds means exactly that, per player.
- 🔧New setting chests.max-per-player caps how many unclaimed chests a player can have at once.
- 🔧Player clocks survive restarts. The time LEFT is stored, so offline time does not count and reconnecting changes nothing.
- 🔧All four language files are now created and kept up to date, not just the active one.
- 🔧Holograms no longer need DecentHolograms — the plugin uses Minecraft's own floating text.
- 🔧No database. SQLite, MySQL and their libraries are gone; the jar went from 17 MB to 165 KB. Networks: clocks no longer sync between servers.
- 🔧One jar now covers Minecraft 1.21 through 26.2.
- 🔧Every sound and particle is configurable by name, with a master switch.
- 🔧Settings that contradict each other are now reported, in the console and in the admin menu.
- 🔧Players no longer see their own countdown: finding a chest you were not expecting is the point. Admins still see it.
- 🔧Players can no longer store their own items in a treasure chest, which used to cost them their belongings.
- 🔧Loot referencing a plugin you do not have is skipped without using up a slot.
- 🐛Chests no longer pile up around players. Nothing capped how many unclaimed ones a player could have, so lowering the interval gave more at once instead of more often.
- 🐛Chest spawns are no longer rolled on player movement. That path ignored the cooldown for anyone with treasurespawn.bypass.cooldown, which every operator has.
- 🐛Chests no longer appear inside regions where the player could not build.
- 🐛Chests and mimics are no longer left orphaned in the world after a crash.
- 🐛The mimic no longer sounds like the mob underneath it.
- 🐛Reloading the config no longer resets every player's clock, which the menu was doing on every click.
- 🐛Fixed the WorldGuard region check, which could switch itself off for the session.
- ✨Chests are handed out per player, not one at a time for the whole server. Before, a single chest appeared every 5–15 minutes and went to one player, so on a busy server most people almost never saw on
- ✨AFK protection — a player has to have moved recently to be included, so parked alts collect nothing overnight. Configurable, and can be turned off.
- ✨Chest protection can expire — protection-duration releases an unclaimed chest to anyone after a while. 0 keeps the old behaviour.
- 🔧VIP cooldown reductions are worth buying now — a 50% reduction means twice the chests. The server-wide bottleneck used to eat most of the benefit.
- 🔧No more disk write per chest — chests.yml was rewritten in full, on the main thread, every time a chest appeared or vanished. Batched now.
- 🔧config.yml documents what actually happens, including two options that existed but were written nowhere.
- 🐛Loot could vanish out of your hands — if the despawn timer ran out with the chest open, it was emptied and removed mid-pick. An open chest is now left alone.
- 🐛The "protection time" in the admin GUI did nothing. You could set it and save it, and nothing read it.
- 🐛treasurespawn.spawn was ignored by the automatic spawner — revoking it stopped nothing.
- 🐛treasurespawn.bypass.cooldown no longer floods a world — it exempts from the cooldown when a chest is asked for by hand, which is its purpose.
No notes for this version.
Discussion
Comment and share your experience on each plugin version.
No comments on this version yet — be the first!
No comments on this version yet — be the first!
No comments on this version yet — be the first!
Player reviews
What server owners think of this plugin.
Buen plugin!