Mob & World
Custom Mob AI
Reduces mob pathfinding calculations through NMS pathfinder injection. Mobs far from any player get the maximum reduction, mobs nearby keep their normal AI — players never see a frozen-looking mob.
- Distance-based scaling — Reduction percentage interpolates with player distance
- Speed reduction — Optional movement-speed multiplier (default
0.7×) - Spawner mobs — Mobs spawned from spawners get all AI removed
- Disable player attacks — Optional toggle that prevents mobs from targeting players
- Exclusion list — Bosses or quest mobs you want untouched
The pathfinder manipulation uses paperweight-userdev / NMS, so the first build of XAntiLag downloads and decompiles a Paper server bundle. Runtime cost is negligible — only the boot.
Villager Optimizer
Villager pathfinding is the #1 cause of lag on most servers. The optimizer disables AI awareness for villagers far from any player and restores it the moment a player approaches.
- Distance threshold — Default
32blocks - Periodic check — Efficient 5-second scan
- Auto-restore — Full AI returns when a player gets close
AFK System
Rebuilt from scratch. The point of AFK detection is not to notice that nobody pressed a key — it is to notice that nobody is playing, which is a different question, and the one every AFK machine is designed to blur.
What counts as activity
- Camera movement and jumping never count. Only horizontal displacement does.
- Vehicles never count, which defeats minecart and boat loops.
- A move only counts when it breaks new ground. The plugin remembers a short trail of recently occupied positions; if a move lands back inside it — water push, piston back-and-forth, ice track — the player is treated as standing still. This is what neutralises confined AFK machines.
- Discrete human actions always count: chat, commands, inventory clicks, item pickups, block placement.
Machine detection
Breaking blocks and hitting entities do count as activity — an auto-miner would otherwise be trivially disguised as mining. But doing either past a threshold without ever moving is not a player:
afk:
machine:
enabled: true
mining-blocks: 90 # blocks broken from a fixed spot
hits: 140 # entity hits from a fixed spot
loop-detection: true
loop-memory: 30 # positions remembered
notify-staff: true
The offender is disconnected, staff holding xantilag.notify are told, and the event can be forwarded to Discord.
Two stages
afk:
timeout-seconds: 300 # marked AFK
kick-after-seconds: 600 # then kicked (0 = never)
min-players-to-kick: 10 # never kick a quiet server
Being marked AFK drops the player's view and simulation distance, optionally shows a persistent title and optionally teleports them to an AFK area. Kicking only happens later, and only when the server is busy enough for it to be worth anything.
Auto-miners and auto-clickers
A player who keeps moving but never goes anywhere is running a machine, not playing. The detector watches the extent of the trail rather than the distance walked, so pacing a small circle for hours is recognised for what it is.
afk:
machine:
enabled: true
# How much ground the trail has to cover before it stops looking like a loop.
loop-radius: 8.0
# Blocks broken without leaving that area before it counts as auto-mining.
mining-blocks: 200
Raise mining-blocks rather than lower it if you are unsure. The two mistakes are not symmetrical: too low kicks real players who are quarrying, while too high only delays catching a machine.
Commands and API
/afk— mark yourself away (a manual flag is not lifted by movement alone)xantilag.bypass.afk— exempt from the whole systemPlayerAfkStateChangeEvent— cancellable, so another plugin can keep an event host from being marked away
Placeholders: %xantilag_isAfk%, %xantilag_afk_time%, %xantilag_afk_count%.