SigmaClearlag
Lightweight Folia-safe entity clearlag sweep, chunk limits & global caps.
▌ Overview
SigmaClearlag is a lightweight, zero-dependency entity clearlag plugin built from the ground up for both Paper and Folia. It runs a configurable countdown and sweeps your server clean of ground items, XP orbs, projectiles, excess mobs, and empty vehicles then enforces per-chunk and server-wide entity caps to keep your TPS healthy long-term.On Folia every operation is dispatched to the correct region thread: chunk cleanup runs via RegionScheduler, entity removal via EntityScheduler, and broadcasts via GlobalRegionScheduler fully thread-safe with zero region violations. On Paper the standard scheduler is used with chunk scanning batched across ticks to avoid main-thread spikes.
▌ Features
⏱ Countdown & Warnings
- Configurable interval any value in seconds (default 300s / 5 min)
- Warning broadcasts alerts players at 60s · 30s · 10s · 5s (fully customisable list)
- Formatted time warnings display human-readable time, e.g. 1m 30s
- Force trigger /lag clear fires an instant cleanup on demand
- Hot reload /lag reload restarts the scheduler with new config values without a server restart
Phase 1 Fast Sweep
- Ground items removes all dropped items; per-material whitelist (DIAMOND, NETHERITE_INGOT, ELYTRA, etc.)
- XP orbs instant removal of all experience orbs
- Projectiles clears arrows, snowballs, fire charges; per-type exclude list (TRIDENTs kept by default)
- Mob sweep optional mass-removal of hostile/neutral mobs with an exclude list
- Empty vehicles optional removal of unoccupied boats and minecarts with an exclude list
Phase 2 Per-Chunk Limits
- Per-type mob caps set individual limits for ZOMBIE, SKELETON, SPIDER, CREEPER, etc.
- Default mob max fallback limit for any mob type not explicitly listed
- Vehicle caps per-type limits for MINECART, CHEST_MINECART, HOPPER_MINECART, etc.
- Total chunk cap hard ceiling on all limited entities in one chunk (removes most-populous type first)
- Paper: scan is batched across ticks (configurable scan_chunks_per_tick) to avoid main-thread spikes
- Folia: each chunk is processed in its own RegionScheduler task correct by design
Phase 3 Global Entity Limits
- Server-wide cap per entity type runs after the chunk pass, so local density has already been reduced
- Density-first removal excess entities are removed starting from the most-crowded chunks
- Exclude list IRON_GOLEM, ENDER_DRAGON, WITHER, etc. are always skipped
- Folia-safe removal dispatched via entity.getScheduler().run() per entity
🛡 Smart Entity Protection
- Named entities any entity with a custom name tag is never removed
- Tamed pets wolves, cats, horses, parrots and other tamed animals are always safe
- Villagers villagers and wandering traders are excluded
- Armor stands protected by default
- Leashed mobs any mob on a leash is kept
- Ridden entities any entity a player is actively riding cannot be removed
PlaceholderAPI
- %lag_next_cleanup% formatted time remaining, e.g. 2m 15s
- %lag_seconds_left% raw integer seconds until next cleanup
- %lag_last_removed% entity count from the last cleanup run
▌ Commands & Permissions
| Command | Aliases | Description | Permission |
|---|---|---|---|
| /lag clear | /clearlag clear · /scl clear | Immediately trigger entity cleanup | sigmaclearlag.clear |
| /lag info | /clearlag info · /scl info | Show next cleanup time & last removed count | sigmaclearlag.info |
| /lag reload | /clearlag reload · /scl reload | Hot-reload config and restart scheduler | sigmaclearlag.reload |
Permission Nodes
- sigmaclearlag.clear manually trigger cleanup (default: op)
- sigmaclearlag.info view timer status and stats (default: true)
- sigmaclearlag.reload reload configuration (default: op)
▌ Configuration Highlights
YAML:
# ╔══════════════════════════════════════════╗
# ║ SigmaClearLag Configuration ║
# ║ Folia-compatible lightweight clearlag ║
# ╚══════════════════════════════════════════╝
# ── Schedule ───────────────────────────────────────────────────────────────────
schedule:
interval: 300 # seconds between auto-cleanups (minimum: 10)
warnings: [3,2,1] # warn players this many seconds before cleanup
# ── Messages ───────────────────────────────────────────────────────────────────
# Supports &a &c &e &l etc. color codes.
# {time} → formatted time remaining, e.g. "1m 30s" (warning only)
# {count} → number of entities removed (cleared only)
messages:
warning: "&6⏳ &fEntities will be cleared in &e{time}&f!"
cleared: "&a✔ &fCleared"
# ── Protection ─────────────────────────────────────────────────────────────────
# Entities matching ANY enabled rule are NEVER removed by anything below.
protection:
named: true # any entity with a custom name tag
tamed: true # tamed pets (wolves, cats, horses, parrots…)
villagers: true # villagers and wandering traders
armor_stands: true # armor stands
leashed: true # mobs currently on a leash
ridden: true # any entity a player is actively riding
# ── Sweep ──────────────────────────────────────────────────────────────────────
# Fast server-wide pass that runs on every cleanup.
# Removes ALL matching entities in one go. Protection rules above always apply.
sweep:
items:
enabled: true
# Item types that will NEVER be removed (Bukkit Material names, uppercase).
whitelist:
# - DIAMOND
# - DIAMOND_BLOCK
# - NETHERITE_INGOT
# - NETHERITE_SCRAP
# - NETHER_STAR
# - ELYTRA
# - TOTEM_OF_UNDYING
xp_orbs:
enabled: true
projectiles:
enabled: true
# Projectile entity types that will NOT be removed.
exclude:
- TRIDENT
mobs:
enabled: false
# Mob types that will NOT be removed by the sweep.
exclude:
- IRON_GOLEM
- SNOW_GOLEM
- WITHER
- ENDER_DRAGON
- ELDER_GUARDIAN
# Removes empty (unoccupied) boats and minecarts.
# Vehicles with a player riding them are always kept (see protection.ridden).
vehicles:
enabled: true
# Vehicle types that will NOT be removed.
exclude:
- HOPPER_MINECART
- MINECART
- CHEST_MINECART
# ── Limits ─────────────────────────────────────────────────────────────────────
# Two-stage limiting system that runs AFTER the sweep above.
#
# per_chunk → scans each loaded chunk; removes excess of any type locally
# global → counts each type across the entire server; removes excess
# starting from the most-crowded chunks
#
# Both stages can be used together (recommended) or independently.
limits:
# Per-chunk limit — prevents pile-ups at grinders and spawner farms.
per_chunk:
enabled: true
# Fallback limit for any mob type not listed under 'mobs' below.
default_mob_max: 20
total_max: 20
# Per-type mob limits. Types NOT listed here fall back to default_mob_max.
mobs:
# ZOMBIE: 10
# SKELETON: 10
# SPIDER: 8
# CREEPER: 5
# PHANTOM: 4
# Per-type vehicle limits (boats, minecarts).
# ONLY types listed here are capped — unlisted vehicles are left alone.
vehicles:
MINECART: 5
CHEST_MINECART: 5
HOPPER_MINECART: 5
# OAK_BOAT: 5
# Entity types skipped entirely by the chunk scanner (not counted, not removed).
exclude:
# - IRON_GOLEM
# - SNOW_GOLEM
- WITHER
- ENDER_DRAGON
- ELDER_GUARDIAN
# Paper only — how many chunks to process per tick during the scan.
# Ignored on Folia. Lower = smoother server; higher = faster cleanup.
scan_chunks_per_tick: 20
# Global limit — hard server-wide cap per entity type.
# Runs AFTER per_chunk so local cleanup reduces density first.
global:
enabled: false
# Entity types skipped by global enforcement.
exclude:
- IRON_GOLEM
- SNOW_GOLEM
- WITHER
- ENDER_DRAGON
- ELDER_GUARDIAN
# Total cap across ALL worlds combined. Works for mobs and vehicles.
caps:
ZOMBIE: 300
SKELETON: 200
SPIDER: 150
CREEPER: 100
PHANTOM: 50
SLIME: 100
ENDERMAN: 100
# MINECART: 50
# OAK_BOAT: 30
▌ Technical Details
- Server software: Paper 1.21+ and Folia fully region-safe
- Java version: Java 21
- Hard dependencies: None
- Soft dependencies: PlaceholderAPI (optional)
- Folia thread model: Countdown → AsyncScheduler · Chunk cleanup → RegionScheduler · Entity removal → EntityScheduler · Broadcasts → GlobalRegionScheduler
- Paper batching: Chunk scan spread across ticks via configurable scan_chunks_per_tick no main-thread spike
- 3-phase cleanup order: Fast sweep → Per-chunk limits → Global entity caps
- Hot reload: /lag reload cancels the running scheduler, reloads config, and starts a fresh countdown
- Keyed entity types: Entity type identity resolved via getType().getKey().getKey() stable across all Paper/Folia 1.21.x versions including the 1.21.4 EntityType restructure
SigmaClearlag is provided as-is. Bug reports and feature requests are welcome.
Support & Community
Join our Discord
Join our Discord
