XAntiLag
Complete Server Optimization Suite
Built on XCore — The modular Minecraft server framework
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
XAntiLag is an all-in-one server optimization addon that tackles the most common performance problems: chunk entity/block limits, mob & item stacking, anti-AFK enforcement, villager optimization, hopper rate limiting, entity collision reduction, redstone clock detection, clearlag scheduling, distance-based mob AI reduction, spawn rate limiting, farmland optimization, TPS monitoring with gradual levels, anti-chunkloader detection, TNT rate limiting, and a web dashboard — all in a single, lightweight package.
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
- Per-block limits — Set maximum count per chunk for any block type (hoppers, pistons, TNT, observers, etc.)
- Per-entity limits — Set maximum count per chunk for any entity type (zombies, cows, item frames, etc.)
- Tile entity limiter — Global cap on tile entities per chunk (chests, hoppers, signs, etc.)
- Async scanning — Chunks scanned asynchronously with Caffeine caching (2h TTL)
- Full event coverage — BlockPlace, BlockBreak, BlockBurn, Piston, Explosion, Ignite, CreatureSpawn, HangingPlace, VehicleCreate
- Cross-chunk pistons — Tracks blocks moving between chunks via pistons
- Auto-cleanup — Background task removes excess entities every 5 minutes
- Anti-spam messages — Players don't get spammed when repeatedly hitting limits
- Automatic stacking — Identical mobs within 6 blocks merge into a single entity with a count label
- Drop multiplication — Death drops and XP multiplied by stack count
- Cooked drops — Food drops are automatically converted to cooked variants when killed by fire
- Slime handling — Stacked slimes don't split on death, preventing lag
- Kill one-by-one mode — Optional: killing removes one from the stack and respawns the rest
- Vanilla loot tables — Uses Minecraft's built-in loot tables for accurate drop generation
- Configurable display — Customize stack label format with MiniMessage (e.g.
<red>x%count%) - Exclude named mobs — Optionally skip mobs with custom names
- Exclude specific types — Configurable entity type exclusion list (Villagers, Ender Dragon, Wither, etc.)
- Automatic merging — Dropped items within 6 blocks merge with count label
- Overflow handling — Smart inventory management: excess items stay on the ground
- Hopper pickup — Proper handling when hoppers pick up stacked items
- Meta comparison — Only stacks items with identical metadata (enchants, colors, etc.)
- Configurable display — Customize stack label format with MiniMessage (e.g.
<aqua>x%count%) - Exclude named items — Optionally skip items with custom display names
- Configurable pickup delay — Control how soon stacked items can be picked up
- Configurable timeout — Set how long before a player is marked AFK (default: 300s)
- Visual effects — Blindness + Darkness applied to AFK players
- AFK title — Customizable title message shown to AFK players
- Custom distances — Reduce view/simulation distance for AFK players to save resources
- AFK teleport — Optionally teleport AFK players to a designated location
- Activity detection — Resets on movement, interaction, chat, commands, inventory clicks
- Per-player distances — Set custom view/simulation distance on join (normal and AFK modes)
- Pathfinding reduction — Reduce mob pathfinding calculations by configurable percentage (default: 80%)
- Distance-based scaling — Mobs far from players get maximum AI reduction, nearby mobs keep normal behavior
- Speed reduction — Lower mob movement speed (default: 0.7x)
- Disable player attacks — Optionally prevent mobs from targeting players
- Exclude specific types — Configurable entity type exclusion list
- Applied on spawn & chunk load — Ensures all mobs are affected
- Distance-based AI — Disables AI awareness for villagers far from players (default: 32 blocks)
- Auto-restore — Villagers regain full AI when a player approaches
- Periodic check — Efficient 5-second scan interval
- Massive impact — Villager pathfinding is the #1 cause of lag on most servers
- Transfer rate cap — Limits item transfers per hopper per second (default: 8/sec)
- Chain lag prevention — Prevents massive hopper sorting systems from tanking TPS
- Per-hopper tracking — Each hopper tracked independently
- Zero config — Works out of the box with sensible defaults
- Disable mob collisions — Non-player entities have collision disabled on spawn
- Reduce overhead — Significant performance gain in high-density mob farms
- Player-safe — Player collisions are unaffected
- Tick rate detection — Monitors repeater/comparator updates per 10-second window
- Configurable threshold — Default: 7 ticks/second (70 per window)
- Per-chunk rate limit — Global cap on total redstone updates per chunk per second
- Auto-break — Violating blocks replaced with warning sign
- Console logging — Coordinates and tick rate logged for server admins
- Scheduled cleanup — Automatic entity removal at configurable intervals (default: 15 minutes)
- Configurable warnings — Set any number of warning times before cleanup (default: 60s, 20s)
- Translatable messages — All messages in lang.yml with {time} and {count} placeholders
- Sound effects — Configurable sounds for warnings and cleanup
- Entity type filter — Choose which entity types to clear (items, arrows, XP orbs, etc.)
- Kill monsters — Optional: also remove hostile mobs during cleanup
- Exclude named entities — Optionally skip entities with custom names
- Stack-aware — Recognizes stacked items/mobs and handles them properly
- Global rate control — Reduce natural mob spawn rates by percentage (e.g. 50% = half as many mobs)
- Per-world filtering — Apply to specific worlds or all worlds
- TPS integration — Automatically reduces further when TPS monitor detects low TPS
- Uses ThreadLocalRandom — Efficient random cancellation with no contention
- Crop density detection — Counts crops per chunk (wheat, carrots, potatoes, beetroots, nether wart, sweet berries)
- Configurable threshold — Optimization kicks in when crops exceed threshold (default: 64)
- Random tick skipping — Cancels a percentage of growth events to reduce lag
- Early exit optimization — Stops counting crops once threshold is exceeded
- Gradual optimization levels — Multiple thresholds with different actions
- Example setup — 18 TPS: reduce spawn rate | 16 TPS: reduce distances | 14 TPS: force clearlag
- Configurable check interval — How often to check TPS (default: 5 seconds)
- View distance reduction — Automatically reduces view distance for all players
- Simulation distance reduction — Automatically reduces simulation distance
- Emergency clearlag — Triggers an immediate clearlag when TPS drops critically
- Spawn rate reduction — Reduces mob spawn rate via spawn limiter integration
- Auto-recovery — Restores normal settings when TPS recovers above all thresholds
- Portal exploit detection — Detects entities repeatedly entering portals without players nearby
- Smart flagging — Requires multiple flags before taking action to reduce false positives
- Configurable action — Remove the exploiting entity or just log a warning
- Named entity focus — Targets named/persistent entities (common in exploits)
- Per-chunk limiting — Limits TNT and TNT minecart explosions per chunk per second
- Configurable cap — Default: 5 explosions per chunk per second
- Caffeine cache — Uses 1-second TTL cache for efficient tracking
- Lag prevention — Prevents TNT cannon/bomb lag without disabling TNT entirely
- REST API — JSON endpoints for monitoring optimization status remotely
- Server status — TPS, entity count, loaded chunks, online players, feature toggles
- Chunk profiler — Top 10 most expensive chunks with entity/tile/redstone breakdown
- Stats endpoint — Clearlag timing, stacker configuration
- Rate limiting — 30 requests per minute per IP
- Token auth — Secured with XCore web dashboard token
- GUI —
/chunksopens an inventory listing every loaded chunk with full breakdown - Sort by cost —
/chunks topreuses the same GUI but ordered by descending cost so the laggiest chunks surface first - Cost formula — Entities × 1 + Tile entities × 2 + Redstone × 0.5
- Per-chunk — World, coords, total entities, total tile entities, redstone components, plus the top 5 entity types and top 5 tile types
- Click to teleport — Left-click any chunk entry to teleport to its center (Folia region-safe via
getHighestBlockYAton the owning region thread)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
Code:
/chunks — Paginated GUI of every loaded chunk with full details
/chunks top — Same GUI sorted by descending cost
/setafklocation — Set the AFK teleport location
/xantilag reload — Reload configuration
/xantilag status — Show all feature statuses
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
Code:
%xantilag_afk% — Returns "(AFK) " if the player is AFK, empty otherwise
%xantilag_isAfk% — Returns "yes" or "no"
%xantilag_clearlag% — Time remaining until next clearlag
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
Code:
xantilag.command.chunks — Access /chunks and /chunks top commands
xantilag.command.setafklocation — Set AFK teleport location
xantilag.admin — Reload and status commands
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
☐ Paper 1.21.1+ (Folia compatible)
☐ Java 21+
☐ XCore (framework)
☐ PlaceholderAPI (optional)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
1. Place
XCore.jar in plugins/2. Place
XAntiLag.jar in plugins/XCore/addons/3. Start the server
4. Configure
plugins/XCore/addons/XAntiLag/config.yml5. Adjust limits, stacker settings, and AFK thresholds to your needs
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
Made with
