DriftSpawners
Spawners that make loot, not mobs.
Virtual spawners for Paper and Folia 26.3, in the style of DonutSMP: placed spawners never spawn mobs. Instead they put their mob's loot and XP into their own storage, they stack, they sell their storage in one click and they come back with Silk Touch. Part of DriftSuite.
Features
- No mobs, just loot: while a player is within 16 blocks, every spawner rolls its mob's loot table once for each spawner in its stack and keeps the items and XP. Nothing spawns, so there's no mob lag.
- Every vanilla mob with drops is in
mobs.yml(loot, chance, amounts, XP and timing), and can be changed in game with/spawners editloot <mob>. - Spawner menu: info, a paged storage (click to take a stack, shift-click for all that fit, take all, sort), a drop filter, Sell all, Collect XP and a stack menu. Everyone looking at the same spawner sees it change live.
- Stacking: right-click a spawner with one of the same mob to add it, sneak to add the whole hand, or add and take exact amounts in the stack menu. Storage and loot grow with the stack.
- Sell all at DriftShop prices (rank modifiers, daily limits and dynamic prices included), or at fallback
prices in
config.ymlwithout DriftShop. - Silk Touch pickup, sneak-breaking up to 64 off a stack, and a "break again within 5 seconds" warning when the last spawner still has loot stored.
- Natural spawners (dungeons, fortresses) mined with Silk Touch become virtual spawner items.
- Safe from explosions, withers and pistons.
- Holograms above each spawner with its stack, items and XP; players can hide them with
/spawners hologram. - Optional: hoppers under spawners that pull from storage, and item spawners (iron, gold, diamond...).
- Staff tools:
/spawners give,/spawners list(every spawner by world, teleport or remove),/spawners near(spawners near you glow through walls for you only) and a log of everything indata/logs/. - Works with DriftEssentials'
/spawner <mob>: the virtual spawner changes to the new mob. - Respects WorldGuard and claim plugins: a break, place or right-click they cancel stays cancelled.
Requirements
- Paper (or a fork like Leaf) or Folia 26.3, Java 25
- Optional: DriftShop (prices for Sell all), Vault or DriftEconomy (for the fallback prices without DriftShop), PlaceholderAPI, Nexo, ItemsAdder or Oraxen (custom items as loot)
Getting started
- Put
DriftSpawners-<version>.jarinplugins/and start the server. It works without any changes:mobs.ymlanditems.ymlare written toplugins/DriftSpawners/, and its own data toplugins/DriftSpawners/data/(see Folder layout). - Give yourself a spawner with
/spawners give <you> zombie, place it and stand near it. Right-click it after 20 seconds to see the loot. - With DriftShop installed, its spawners shop sells these spawner items and buys them back, and Sell all uses its prices. Nothing to set up.
Commands
/spawners (alias /driftspawners). It's /spawners, not /spawner: DriftEssentials owns /spawner.
| Command | Permission | What it does |
|---|---|---|
/spawners hologram | driftspawners.hologram (everyone) | Hide or show spawner holograms for yourself |
/spawners give <player> <mob> [amount] | driftspawners.admin | Give spawner items (works from the console) |
/spawners list | driftspawners.admin | Every spawner by world: click to teleport, shift-right-click to remove |
/spawners near | driftspawners.admin | Spawners within 32 blocks glow through walls for you for 10 seconds |
/spawners editloot <mob> | driftspawners.admin | Change a mob's loot, XP and timing in a menu |
/spawners reload | driftspawners.admin | Reload every file |
/spawners version | driftspawners.admin | Show the version |
/spawners help | everyone | The list of commands (staff see the staff list; click a line to fill it in) |
The name and alias can be changed in commands.yml.
Permissions
| Permission | Default | What it allows |
|---|---|---|
driftspawners.use | everyone | Right-click a spawner to open its menu |
driftspawners.place | everyone | Place spawners |
driftspawners.break | everyone | Break spawners to pick them up |
driftspawners.stack | everyone | Stack spawners and take them off a stack |
driftspawners.sell | everyone | Sell a spawner's storage |
driftspawners.hologram | everyone | /spawners hologram |
driftspawners.admin | op | The staff commands |
driftspawners.bypass.silktouch | nobody | Pick up spawners without Silk Touch |
driftspawners.bypass.gamemode | nobody | Sell in creative or spectator with the fallback prices (DriftShop has its own rule) |
How spawners work
A placed spawner item makes a virtual spawner. Once a second, every loaded chunk with spawners in it gets one task
on the thread that owns it. For each spawner that's due (every generation-seconds from mobs.yml) and has a
player (not in spectator) within spawners.player-range, the loot table is rolled once per spawner in the stack,
and the items and XP go into storage. A spawner holds storage-per-spawner items and xp-per-spawner XP for each
spawner in its stack; when it's full it stops collecting. Unloaded chunks are never touched or loaded.
The block still shows the mob spinning in its cage, but it never spawns anything (SpawnerSpawnEvent is cancelled
and its spawn delay is as long as it goes).
Loot tables
mobs.yml has every vanilla mob that drops something, with vanilla-like drops. Each mob:
zombie:
name: "Zombie"
generation-seconds: 20
xp: 5
loot:
ROTTEN_FLESH:
min: 0
max: 2
chance: 1
IRON_INGOT:
min: 1
max: 1
chance: 0.025
An item can be a Minecraft item or a custom item (nexo:<id>, itemsadder:<namespace:id>, oraxen:<id>).
mobs.yml and items.yml are yours: once written, nothing is added back, so a mob you take out stays out.
Piglins, which only drop their gear in vanilla, drop gold nuggets here.
items.yml has item spawners (coal, copper, iron, gold, redstone, lapis, diamond, emerald). They're off until
features.item-spawners is turned on. Give one with /spawners give <player> iron.
Selling
Sell all (in the spawner menu and the storage menu) takes everything out of storage first, then sells it:
- With DriftShop: through
DriftShopAPI.sellTakenon the player's thread, exactly like/sell. The player's price modifiers, daily limits and dynamic prices apply, and DriftShop's no-selling-in-creative rule too. - Without DriftShop: at
selling.fallback-prices(the same as DriftShop's default sell prices), paid inselling.economy(vault,xpor a DriftEconomy currency).
Whatever didn't sell goes back into storage.
Breaking
- With
features.silk-touchon, a spawner only comes back with a Silk Touch tool. Without one,breaking.no-silk-drop-chance(0 at first) decides. - A normal break takes one off the stack, a sneaking break up to
breaking.sneak-amount(64). - Breaking the last spawner while it has loot or XP stored warns first; break it again within 5 seconds to break
it.
breaking.on-breakislose(DonutSMP style) ordrop. - Creative players can remove spawners but get nothing for it.
- Explosions, withers and pistons can't break or move spawners (
features.explosion-proof).
Turning features on and off
At the top of config.yml (a restart is needed):
| Switch | Default | What it does |
|---|---|---|
silk-touch | true | Spawners only drop with Silk Touch |
break-warning | true | Warn before breaking a spawner with loot stored |
explosion-proof | true | Explosions can't break spawners |
natural-spawners | true | Natural spawners mined with Silk Touch become spawner items |
item-spawners | false | The item spawners in items.yml |
hoppers | false | Hoppers under spawners pull from storage |
holograms | true | Text above each spawner |
stacking | true | Stacking by right-click and the stack menu |
selling | true | The Sell all buttons |
collect-xp | true | The Collect XP button |
logs | true | The log in data/logs/ |
placeholders | true | The PlaceholderAPI placeholders |
Settings
| Setting | Default | What it does |
|---|---|---|
spawners.player-range | 16 | How close a player has to be for loot |
spawners.max-stack | 1000 | The biggest stack |
spawners.storage-per-spawner | 1728 | Items each spawner in a stack holds |
spawners.xp-per-spawner | 5000 | XP each spawner in a stack holds |
spawners.autosave-seconds | 30 | How often loot made by spawners is saved |
spawner-item.name / lore | How spawner items look | |
xp.apply-mending | false | Collected XP repairs Mending items first |
breaking.* | Sneak amount, drop chance without Silk Touch, on-break, warning time | |
holograms.* | Lines, height and view range | |
hoppers.* | How often and how much hoppers pull | |
selling.* | Fallback economy, prices and the creative rule | |
near.* | Radius, time and colour of /spawners near | |
logs.keep-days | 30 | Log files older than this are deleted |
storage.* | H2 | H2 file or MySQL/MariaDB; server-name keeps servers sharing a database apart |
Can't be exploited
- One lock per spawner: a spawner's stack, storage and XP only change while holding its lock, so the loot roll, a hopper, a menu click and a break can never get in each other's way. Saves are queued in the order the changes happened, on one database thread.
- Taken before given: taking items, Sell all, Collect XP, taking spawners off a stack and hoppers all take from the spawner first, give second, and put back whatever didn't fit or didn't sell. Only what fits in the inventory is taken.
- Stacking takes the item first: the items leave the hand or inventory before the stack grows, and anything the stack couldn't take is handed straight back.
- Breaking: the whole spawner is marked as being broken until the break goes through, so a second break (or a menu click) in the meantime does nothing. If another plugin cancels the break, nothing is given. Natural spawners are only given once the break can't be cancelled any more.
- Player actions are saved at once. Only loot made by spawners waits for the autosave, so a crash can only lose a few seconds of loot, never duplicate anything. Hopper moves are saved at once too.
- Pistons, explosions and withers can't touch spawners. Chunks unloading doesn't matter: spawners live in memory and the database, not in the chunk.
- Locked menus: nothing can be taken out of a menu except through its buttons.
- Creative: breaking in creative gives nothing; fallback selling is blocked in creative and spectator.
- Types taken out of the files: a spawner whose mob was removed can't be broken, so nobody loses it.
PlaceholderAPI
| Placeholder | What it shows |
|---|---|
%driftspawners_count% | Spawner blocks the player has placed |
%driftspawners_stacked% | Spawners in all their stacks together |
Developer API
com.itskoazt.driftspawners.api.DriftSpawnersAPI:
spawnerItem(String mob, int amount): spawner items for a mob, or null. Items of the same mob are identical.spawnerType(ItemStack item): the mob of a spawner item, or null.
DriftShop uses spawnerItem to sell real spawner items and buy them back. Without the API it would use the
console command spawners give {player} {mob} {amount}, which also works.
Configuration files
| File | What's in it |
|---|---|
config.yml | Feature switches, spawner limits, breaking, holograms, hoppers, selling, spawner items, /spawners near, logs, storage |
mobs.yml | Every mob's loot, XP and timing |
items.yml | Item spawners (off at first) |
commands.yml | The command name, alias and permission |
messages.yml | Every message, in MiniMessage |
menus.yml | The spawner, storage, filter, stack, list and loot editor menus |
Every file starts with a boxed header saying how to apply changes, is split into sections, and has a note above
every option saying what it does, its unit and the values it takes. The prefix is DRIFTSPAWNERS in bold
solid stone (#78716c), followed by a dark grey ».
When you update, new options are added with their notes and everything you changed is kept. When the notes
themselves change, each file is rebuilt once with the new notes and your values written back in; the old file is
kept in data/backups/. Messages you never changed get the new default wording.
Mistakes in the files
A value DriftSpawners can't use never stops the plugin. The console says which file and option, what was wrong and what is used instead, for example:
[DriftSpawners] config.yml: breaking.on-break "keep" isn't one of lose, drop, using "lose"
/spawners reload tells you how many problems it found, so you know to look.
Folder layout
plugins/DriftSpawners/
config.yml settings, starting with the features: switches
messages.yml every message
menus.yml every menu
commands.yml command names, aliases and permissions
mobs.yml what each mob's spawner makes (yours to edit)
items.yml item spawners (yours to edit)
data/ the plugin's own files, no need to open them
database.mv.db every placed spawner, its stack, storage and XP (H2 storage)
logs/ one log file per day of places, breaks, stacks, sales and gives
backups/ old copies of files DriftSpawners replaced
*.version which version of each file you have
Older versions kept data.mv.db, logs/ and the .version markers next to config.yml. They are moved into
data/ the first time the new version starts (one console line per file), and nothing is overwritten or deleted.