DriftLag
Finds what is slowing the server, then limits it.
DriftLag is a lag-management plugin for Spigot and Paper servers. It removes excess entities, limits common lag sources and gives you tools to find out what is slowing your server down.
Features
- Automatic and triggered entity removal (ground items, mobs, projectiles and more) with configurable warnings
- Chunk and per-entity limits, spawner limits, hopper limits, TNT and TNT-minecart limits
- TPS and RAM monitoring with configurable actions when the server is overloaded
- Lag-spike detection that logs what the main thread was doing during a freeze
- Profiling tools for redstone, liquids, block updates and entity spawns
- Every command message in one English language file, easy to edit or translate
Requirements
- Spigot or Paper 1.13 or newer, including 26.x (tested on Paper 1.20.4, 1.21.11 and 26.3)
- Java 8 or newer for DriftLag itself (the server version decides what Java you need; Paper 26.x requires Java 25)
Installation
- Download
DriftLag-<version>.jar(or build it yourself, see below). - Put it in your server's
pluginsfolder. - Restart the server. DriftLag creates
plugins/DriftLag/config.yml(settings),messages.yml(broadcast messages and the chat prefix) andlang/<language>.lang(command messages). See Folder layout.
Turning features on and off
Every module is turned on or off in the features section at the top of config.yml. Its settings stay further down, under its own name. Run /driftlag reload after changing one.
| Switch | Default | What it covers |
|---|---|---|
global-broadcasts | true | Every message DriftLag broadcasts (removal warnings and so on). |
lag-spike-helper | false | Prints what the main thread was doing during a lag spike to the log. |
hopper-limiter | false | Limits item transfers for all hoppers in one chunk. |
ram-meter | false | Runs commands when memory use goes over a limit. |
player-speed-limiter | false | Stops players moving too fast and loading too many chunks. |
item-spawn-age-setter | false | Makes chosen items despawn sooner or later than others. |
mob-breeding-limiter | false | Stops mobs breeding when too many are packed together. |
log-purger | false | Deletes old files in /logs when the server starts. |
mobegg-limiter | false | Stops spawn eggs working when too many mobs are nearby. |
chunk-limiter | false | Limits new chunk generation or how many chunks can load. |
mob-range | false | Changes how far away mobs notice players. |
live-time | false | How long items and mobs stay before being removed. |
tnt-minecart | false | Stops too many TNT minecarts being placed together. |
dispenser-reducer | false | Slows down how fast dispensers fire. |
tnt-reducer | false | Cancels explosions when too much TNT is primed together. |
firespread-reducer | false | Slows down fire spreading. |
chunk-entity-limiter | false | Caps how many entities one chunk can hold. |
per-entity-chunk-entity-limiter | false | Caps each entity type per chunk. |
spawn-limiter | false | Caps how many mobs can spawn across the server. |
tps-meter | false | Runs commands when TPS drops too low. |
mobspawner | false | Nerfs mob spawners that are packed together. |
item-merger | false | Merges dropped items lying next to each other. |
auto-removal | true | Clears ground items and mobs on a timer, with warnings. |
limit | false | Removes entities when the server goes over a global entity limit. |
custom-trigger-removal | false | Your own removal jobs with their own triggers and warnings. |
Each module used to have an enabled line inside its own section. On the next start each server's values are moved into features and the old lines are taken out, so nothing changes.
Messages and prefix
All broadcast messages are in messages.yml. To remove the DriftLag prefix from every message, set prefix.enabled: false there (or change prefix.text), then run /driftlag reload. Command messages in lang/English.lang use %prefix% wherever the prefix appears.
Messages use & colour codes and &#rrggbb hex colours. Hex needs Minecraft 1.16 or newer; on older servers each hex colour shows as the closest classic colour. DriftLag has no MiniMessage, so a gradient has to be written one letter at a time, like b6d4&lDadca&lr....
The default look: the prefix is DRIFTLAG in bold solid teal (#06b6d4) followed by a dark grey » (no brackets), teal is the accent colour, command output uses bold teal titles and • bullets, soft green means success, soft red an error and amber a warning. Every DriftSuite plugin uses the same layout with its own colour.
Updates: new options are added with their notes and everything you changed is kept. When the notes change,
config.yml and messages.yml are rebuilt once with the new notes and your values written back in; the old file is
kept in data/backups/, and messages you never changed get the new wording. A language file from an older version
gets any new command messages from the bundled English file, so nothing shows up as missing.
Folder layout
plugins/DriftLag/
config.yml settings, starting with the features switches
messages.yml broadcast messages and the chat prefix
lang/English.lang command messages (add your own <Name>.lang and set settings.language)
data/ the plugin's own files, no need to open them
backups/ old copies of files the plugin replaced (before-update-config.yml, ...)
*.version which version wrote each file
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.
Updating from 1.4 or older moves everything into place on the first start, with one console line per file:
languages/ to lang/, and the hidden .version markers, messages.old.yml and English.old.lang backups and
old before-update-config.yml / Old-Config.yml / Invalid-Config.yml copies to data/. Nothing is deleted; if a
file is already at the new place, both are kept and the console says so.
Mistakes in the files
A value DriftLag can't use never stops a module from starting. The console says which option, what was wrong and what is used instead, for example:
[DriftLag] config.yml: auto-removal.autoremoval-interval "abc" isn't a whole number, using 460
[DriftLag] config.yml: item-spawn-age-setter.items.bananas "bananas" isn't an item name, so it was left out
/driftlag reload tells you how many problems it found ("Reloaded with 2 problem(s)").
Commands
The base command is /driftlag (aliases: /dl, /dlag). Run it without arguments to see the subcommands you have access to.
| Command | Description |
|---|---|
/driftlag clear | Remove entities as configured in the command-remove section |
/driftlag area <radius> | Remove entities within a radius around you |
/driftlag killmobs | Remove mobs (see kill-mobs in the config) |
/driftlag check [worlds...] | Show entity counts |
/driftlag chunk [list-size] | List the chunks with the most entities |
/driftlag checkchunk | Inspect the chunk you are standing in |
/driftlag tpchunk <x> <z> [world] | Teleport to a chunk |
/driftlag unloadchunks | Unload unused chunks |
/driftlag tps | Show the server's TPS |
/driftlag memory / performance | Live memory and performance maps |
/driftlag samplememory <seconds> | Sample memory usage |
/driftlag sampleticks [ticks] [raw/stats] | Sample tick timings |
/driftlag profile <seconds> <type> | Profile redstone, liquids, block updates or spawns |
/driftlag halt [on/off] | Temporarily halt server activity |
/driftlag gc | Request garbage collection |
/driftlag admin <reload/stop/start/list> [module] | Control individual modules |
/driftlag reload | Reload the config (says how many problems it found) |
/driftlag version | Show DriftLag's version |
/driftlag help | List the subcommands you can use (click one to fill it in) |
Permissions
Each subcommand has its own permission, driftlag.<subcommand> (for example driftlag.clear). driftlag.* grants all of them. All permissions default to operators.
Works with other DriftSuite plugins
Every feature lives in exactly one DriftSuite plugin, so no two plugins fight over the same command, chat message or part of the screen.
| Plugin | Handles |
|---|---|
| DriftChat | Chat format, public chat filter, emojis, mentions, announcements, join and leave messages, cross-server chat, private messages (/msg, /reply, /ignore) and private message spy (/spymsg, /socialspy) |
| DriftStaff | Staff mode, vanish, punishments, reports, staff chat, staff teleports (/stp, /stphere), /invsee, /clearchat, /lockchat, /slowchat, command/sign/book spy, filter for private messages and signs, 2FA |
| DriftTAB | Tab list, name tags, sidebar scoreboard, boss bars and other tab list features |
| DriftTags | Tags and the tag menu. Tags are shown through %drifttags_tag% in DriftChat and DriftTAB |
| DriftEconomy | Currencies, /pay, Vault and Treasury |
| DriftCombat | Combat tagging, combat-log punishments, combat timer in the action bar and boss bar, safe zones, item cooldowns |
| DriftLag | Entity clearing, entity and spawner limits, lag tools |
| DriftHomes | Homes, the homes menu, public homes, home invites and /visit |
| DriftEssentials | Spawn, warps, /tpa, /back, /rtp, kits, nicknames, AFK, /motd, player tools (/craft, /enderchest, /hat, /trash) and admin shortcuts (/gmc, /fly, /heal, /speed) |
| DriftShowcase | The rank showcase NPC: try a rank's look and items before buying it |
How they work together:
- DriftStaff marks vanished staff with the standard
vanishedmetadata. DriftTAB leaves them out of the tab list and online counts, DriftChat treats them as offline in/msg,/ignoreand tab completion, DriftEssentials leaves them out of/tpa,/nearand/seen, and they can't be hurt, so DriftCombat never puts them in combat. - DriftStaff mutes and
/lockchatstop a message before DriftChat formats it, and muted players can't use/msg. - DriftChat filters public chat. DriftStaff filters private messages, other commands and signs. Every message is filtered once.
- DriftLag never removes or limits NPCs, including DriftCombat's combat-log NPCs.
- DriftHomes and DriftEssentials ask DriftCombat before every teleport, so
/home,/spawn,/warp,/tpa,/backand/rtpare blocked during combat. Both use the same warmup, cooldown and safe-landing rules. /backin DriftEssentials remembers where/homeand/visittook you from.- DriftChat sends join and leave messages. DriftEssentials only adds the first-join welcome and
/motd. - Staff teleports stay in DriftStaff. DriftEssentials only has the player ones (
/tpa,/spawn,/warp,/back). - DriftEssentials nicknames are the player's display name, which DriftChat's
{displayname}shows, and%driftessentials_nick%works in DriftTAB. - DriftStaff's
/checkmenu has a button that opens the player's DriftHomes homes. - Prices in DriftHomes and DriftEssentials go through Vault, so they use DriftEconomy when
features.vaultis on in its config. - For a combat sidebar, add a DriftTAB scoreboard with
display-condition: "%driftcombat_in_combat_raw%=true". DriftCombat's README has the full example. - DriftShowcase reads DriftEssentials kits straight from its
kits.yml, so a rank in the showcase can show a kit's items. - DriftShowcase shows LuckPerms group prefixes above its NPC and in its ranks menu, and knows which ranks a player already has. It only reads from LuckPerms and never gives a group or permission.
- DriftShowcase asks DriftCombat before every preview, so ranks can't be tried on during combat. Vanished staff and staff in DriftStaff's staff mode can't try them on either.