AntiRedstoneLag
Advanced Redstone Lag Prevention, Forensic Diagnostics, and ClearLagg Engine for Modern Minecraft Servers (Paper & Folia 1.21.6 - 26.2)
Features | Performance | Installation | Commands and Permissions | ClearLagg Engine | Disclosures
About AntiRedstoneLag
AntiRedstoneLag is a lightweight, high-performance server protection plugin designed to eliminate redstone lag machines, 0-tick piston loops, and runaway clocks without breaking legitimate vanilla farms.
Built natively for Paper and Folia regional threading, it combines periodicity clock fingerprinting, adaptive MSPT/TPS sensitivity scaling, non-destructive freezing, 3D forensic snapshots, live BossBar HUD diagnostics, and an integrated ClearLagg engine.
Features
Modern 1.21+ Component Support
- Full coverage of modern Minecraft components: Crafters, Copper Bulbs (all oxidation and waxed states), Calibrated Sculk Sensors, and Chiseled Bookshelves.
- Real-time piston velocity tracking to intercept 0-tick push/pull crash engines.
Periodicity Clock Fingerprinting (Farm Immunity)
- Analyzes the interval delta between consecutive redstone pulses.
- Distinguishes strictly periodic loops (lag machines with near-zero interval variance) from bursty sorting systems, sugarcane farms, iron farms, and melon harvesters.
- Legitimate player farms remain 100% functional without false flags.
Dynamic Adaptive Sensitivity (MSPT & TPS Scaling)
- Automatically grants higher threshold headroom when server MSPT is healthy (<= 35ms / 20.0 TPS).
- Dynamically tightens limits when the server is under heavy load (MSPT >= 50ms or TPS < 18.0) to protect the tick rate.
Non-Destructive Tiered Freezing
- Temporarily pause-throttles runaway clocks (default 15 seconds) and notifies the owner before escalating.
- Only escalates to item dropping or removal if a machine continuously violates limits after unfreezing.
Forensic Snapshots and Lag Replay (/arl snapshot)
- Automatically records a 3D cluster scan (7x7x7 bounding box) of offending circuits when lag machines are tripped.
- Captures exact coordinates, trigger material, peak update rates, culprit player name/UUID, component breakdown, and relative block positions.
- View reports in-game or teleport directly to the snapshot site.
Live BossBar Inspection HUD (/arl inspect)
- Toggleable admin diagnostic HUD that displays Chunk Updates Per Second (UPS), MSPT, and TPS in real time using an Adventure BossBar with dynamic color coding (Green, Yellow, Red) and visual dust particles.
Integrated ClearLagg Engine (/arl clear)
- Fully configurable ground item and entity cleaner with multi-mode countdown broadcasts (Chat, Action Bar, Title, Subtitle).
- Supports advanced conditional rules (e.g.
Arrow onGround,Boat !isMounted,Tnt liveTime>100). - Pre-configured with SMP entity whitelist rules (Villagers, Iron Golems, Allays, Armor Stands, Item Frames, named mobs, tamed pets, and leashed animals are protected).
- Dropped valuables blacklist protects Netherite gear, Elytras, Totems, and Beacons.
Performance
| Optimization | Technique | Benefit |
|---|---|---|
| Threading Model | Native Paper and Folia Regional Schedulers | Zero cross-region blocking and complete Folia compatibility |
| Collections | FastUtil Primitive Maps | Minimal memory allocations and reduced garbage collection pressure |
| Configuration | Okaeri Configs with Automatic .bk Backups |
Fast, type-safe YAML serialization with data safety backups |
| Logging | Zero-Allocation Formatting | Background asynchronous flushing with zero main-thread overhead |
Installation
- Download the latest
.jarfrom Modrinth or GitHub Releases. - Place the jar file into your server's
plugins/directory. - Restart your server.
- Adjust settings in
plugins/AntiRedstoneLag/config.ymlandmessages.ymlif desired.
Requirements: Paper, Purpur, or Folia 1.21.6 through 26.2 running on Java 21+.
Commands and Permissions
| Command | Description | Permission |
|---|---|---|
/arl help |
Show plugin command help | antiredstonelag.use |
/arl reload |
Reload configuration and messages | antiredstonelag.reload |
/arl stats |
View monitored chunks, blocks, and removal stats | antiredstonelag.stats |
/arl logs [download] |
View or prepare log files for download | antiredstonelag.logs |
/arl hotspots [page\|export] |
View or export top activity clusters | antiredstonelag.hotspots |
/arl inspect [seconds] |
Toggle real-time BossBar diagnostic HUD | antiredstonelag.inspect |
/arl snapshot [list\|view\|tp\|clear] |
View and teleport to forensic lag snapshots | antiredstonelag.snapshot |
/arl clear [items\|all\|mobs\|xp\|count\|cancel] |
Clear ground items and lag entities | antiredstonelag.clear |
ClearLagg Engine
AntiRedstoneLag includes a conditional rule cleaner configured in config.yml:
clearlagg:
enabled: true
interval-seconds: 300
countdown-seconds: [60, 30, 10, 5, 4, 3, 2, 1]
broadcast-mode: CHAT # CHAT, ACTION_BAR, TITLE, SUBTITLE, ALL, NONE
clear-ground-items: true
remove-entities:
- "Arrow onGround"
- "Spectral_Arrow onGround"
- "Trident onGround"
- "Snowball"
- "Egg"
- "Ender_Pearl"
- "Experience_Bottle"
- "Fireball"
- "Small_Fireball"
- "Dragon_Fireball"
- "Wither_Skull"
- "Shulker_Bullet"
- "Boat !isMounted"
- "Chest_Boat !isMounted"
- "Minecart !isMounted"
- "Minecart_Chest !isMounted"
- "Minecart_Hopper !isMounted"
- "Minecart_Tnt"
- "Minecart_Furnace"
- "Tnt liveTime>100"
entity-whitelist:
- "Player"
- "Villager"
- "Iron_Golem"
- "Allay"
- "Armor_Stand"
- "Item_Frame"
- "Glow_Item_Frame"
- "Painting"
- "Leash_Knot"
- "Interaction"
- "Text_Display"
- "Block_Display"
- "Item_Display"
- "* hasName"
- "* isTamed"
- "* isLeashed"
- "* isMounted"
item-blacklist:
- NETHER_STAR
- BEACON
- TOTEM_OF_UNDYING
- ELYTRA
- DIAMOND
- DIAMOND_BLOCK
- NETHERITE_INGOT
- NETHERITE_BLOCK
- NETHERITE_SWORD
- NETHERITE_PICKAXE
- NETHERITE_AXE
- NETHERITE_SHOVEL
- NETHERITE_HOE
- NETHERITE_HELMET
- NETHERITE_CHESTPLATE
- NETHERITE_LEGGINGS
- NETHERITE_BOOTS
Project Disclosures and AI Policy
In accordance with Modrinth's project disclosure guidelines and content standards, the following disclosures apply to AntiRedstoneLag:
AI Assistance Disclosure
- Development Process: This project was developed with the assistance of artificial intelligence tools for code refactoring, algorithm optimization, documentation structuring, and Paper/Folia API compatibility testing.
- Human Contribution: Architecture, logic design, integration choices, testing, debugging, and final review are directed and maintained primarily and significantly by human developers.
- Visual Assets: No AI-generated project icons, banners, or gallery assets are utilized. All visual materials are human-created or sourced from standard typography and game renders.
Content Disclosures
- Advertising / Paid Features: None. AntiRedstoneLag contains no in-game advertisements, paid bypasses, or monetized feature gating.
- Telemetry / Metrics: Includes standard anonymous bStats metric collection (server version, Java version, player count). Telemetry can be disabled in
plugins/bStats/config.yml. - External System Interactions: Queries the official Modrinth API (
https://api.modrinth.com/v2/project/5UOt11Yc/version) on startup to notify server administrators when a newer release is available. No personal or server identification data is transmitted. - Derivative Content: Built as an original Paper/Folia lag prevention implementation utilizing standard open-source libraries (Okaeri Configs, FastUtil, bStats).
Support and Community
- Discord: Join Community
- Issue Tracker: GitHub Issues
License
MIT License - Copyright (c) 2025-2026
All Versions
+ Add Version### Folia Regional Thread-Safety & Performance Fixes
- Folia-Safe ClearLagg Engine** - Resolved
IllegalStateException: Thread failed main thread check: Accessing entity state off owning region's threadthat occurred during auto-clear and manual clear commands on Folia. - Regional Entity Scheduling** - Dynamically checks
Bukkit.isOwnedByCurrentRegion(entity)and dispatches off-region entity inspection (custom names, items, passengers, onGround) and removal viaentity.getScheduler().execute(...)directly onto the entity's owning regional tick thread. - Asynchronous Task Tracking** - Added atomic task completion tracking and fallback safety timeouts ensuring cleared entity counts are broadcast accurately once all regional threads complete entity processing.
- Spatial Nearby Player Queries** - Replaced full-world player iteration in proximity throttling (
RedstoneListener.hasPlayersNearby) and snapshot culprit resolution (SnapshotManager.findNearestPlayer) with Paper's native spatialworld.getNearbyPlayers(), preventing cross-region player loops and off-threadplayer.getLocation()calls on Folia. - ClearLagg Concurrency Lock** - Added an atomic execution guard (
clearingInProgress) preventing overlapping concurrent clear runs during heavy server load.
### Major Architecture and Modernization
- Native Paper Plugin Migration** - Fully converted to
paper-plugin.ymland Paper 1.21+ Lifecycle Brigadier Command API. - Folia Multi-Threading Support** - Complete regional threading compatibility using
Bukkit.getGlobalRegionScheduler(),Bukkit.getAsyncScheduler(), andBukkit.getRegionScheduler().execute(...)with zero cross-region blocking. - Okaeri Configs Engine** - Migrated configuration (
config.yml) and message handling (messages.yml) to Okaeri Configs with automatic.bksafety backups on startup. - Modrinth Integration** - Updated the update notifier to use the official Modrinth API (
project ID: 5UOt11Yc) with non-blocking asynchronous checks. - Contributor Attribution** - Merged performance optimizations and hotspot clustering from PR #2 with official contributor credit to
paradoxnafi.
### Minecraft 1.21+ Component Support
- Modern Redstone Components** - Added monitoring support for Crafters (
Material.CRAFTER), Copper Bulbs (all oxidation and waxed states), Calibrated Sculk Sensors, and Chiseled Bookshelves. - Piston Velocity and 0-Tick Interception** - Added
BlockPistonExtendEventandBlockPistonRetractEventlisteners to catch 0-tick loops and rapid push/pull lag engines.
### Intelligent Detection and Farm Protection
- Periodicity Clock Fingerprinting** - Analyzes interval deltas and variance between consecutive pulses to distinguish true lag machines from bursty contraptions.
- 100% Farm Immunity** - Implemented Sustained Consecutive Violation Detection to ensure sugarcane farms, iron farms, melon/pumpkin harvesters, and hopper sorting halls never trigger false removals.
- Adaptive Performance Scaling** - Dynamically scales thresholds based on Paper's real-time average tick time (
Bukkit.getAverageTickTime()) and TPS, providing 1.5x headroom during healthy performance and tightening under load. - Player Proximity Throttling** - Enforces stricter limits on unattended contraptions running in chunkloaded areas without nearby players.
### Non-Destructive Mitigation
- Tiered Freezing and Auto-Resume** - Added non-destructive
FREEZEas the default removal action, pause-throttling high-frequency clocks for a configurable duration (default: 15s) before escalating to block removal. - Chunk Lockdown (EMP)** - Temporarily disables all redstone activity in a chunk for a configurable duration when severe lag machines are tripped.
### Diagnostic Tools and Visuals
- Live Adventure BossBar Inspector (
/arl inspect)** - Real-time BossBar HUD displaying Chunk UPS, MSPT, and Server TPS with dynamic color grading (Green, Yellow, Red) and visual particle trails. - 3D Forensic Snapshots and Lag Replay (
/arl snapshot)** - Automatically records 3D bounding box scans (7x7x7), trigger metrics, culprit player name/UUID, and component breakdown upon detecting lag machines. Includes in-game reports and direct teleportation (/arl snapshot tp). - Hotspot Cluster Analysis (
/arl hotspots)** - Adjacent-chunk BFS clustering with activity-weighted centers, interactive teleport suggestions, and file export (/arl hotspots export).
### Integrated ClearLagg Engine (
/arl clear)- Folia-Safe Entity Cleaner** - Ground item and entity cleanup with support for manual and automatic scheduled clears.
- Conditional Entity Rules** - Rule parser supporting tags such as
onGround,!isMounted,hasName,isTamed,isLeashed,isBaby,liveTime>X, andinWater. - SMP Entity Whitelist** - Default immunity for Villagers, Iron Golems, Allays, Armor Stands, Item Frames, Display entities, named mobs, tamed pets, and leashed animals.
- Valuable Item Blacklist** - Spares dropped Netherite gear, Elytras, Totems of Undying, Diamonds, and Beacons from deletion.
- Multi-Mode Countdown Broadcasts** - Configurable countdown warnings supporting Chat, Action Bar, Title, Subtitle, All, or None.
### Bug Fixes and Usability
- Fixed Hex Color Formatting** - Resolved issue where
&#RRGGBBcolor codes rendered as raw text in chat and console. - Eliminated Notification and Snapshot Spam** - Added a 60-second snapshot cooldown per block and instant signal cancellation on frozen components.
- Smart Culprit Resolution** - Added nearby player proximity scanning (within 48 blocks) when the original block placer is not in memory.
- Fixed Brigadier Tab Completion** - Full support for empty and partial argument completion across all subcommands.
- Resolved Redstone Duplication:** Added a "state check" to the removal logic. The plugin now verifies if a block is already AIR before attempting to drop it again, which prevents fast redstone clocks from spawning multiple items in a single tick.
- Fixed Ineffective Actions (REMOVE/DISABLE):**
Now updated the logic to use applyPhysics = true. This ensures the Paper/Spigot physics engine is properly notified, immediately breaking the redstone chain and ensuring the client-side view stays in sync.
## Version 2.0.0
### Bug Fixes
- Fixed version mismatch** - Synchronized
pom.xmlversion withplugin.yml(both now 2.0.0) - Fixed unused variable** - Removed unused
materialNamevariable inRedstoneListener - Fixed stats command** -
/arl statsnow shows real statistics fromCounterManagerinstead of hardcoded zeros - Fixed unused imports** - Removed unused imports from
CommandHandlerandRedstoneListener - Fixed potential NPE** - Added null check for
location.getWorld()inCounterManager.sendAlert()to prevent crashes with unloaded chunks - Fixed event priority** - Changed from
MONITORtoLOWpriority since we modify block state - Fixed log download** -
/arl logs downloadnow shows log file info (name, size, path, modified date)
### Optimizations
- Thread-safe counters** - Replaced
HashMapwithConcurrentHashMapandAtomicIntegerfor thread safety - Memory-efficient keys** - Using String keys instead of
Chunk/Locationobjects to prevent memory leaks - Extracted time constants** - Magic numbers replaced with named constants (
TICKS_PER_HOUR,TICKS_PER_DAY,DAY_MS,ALERT_COOLDOWN_MS,BATCH_SIZE,FLUSH_INTERVAL_MS) - Cached config values** -
RedstoneListenernow caches redstone materials, enabled worlds, and removal action for better performance - Refresh cache on reload** - Cached values are automatically refreshed when config is reloaded
- Reduced object allocation** - Avoid creating
Locationobjects in hot path; only create when actually needed for logging - Batched log writes** - Log entries are buffered and flushed every 50 entries or 500ms instead of on every write
- Improved log rotation** - Log file size is now checked on every flush, not just during cleanup task
- Primitive collections (fastutil)** - Replaced
ConcurrentHashMap<String, AtomicInteger>withObject2IntOpenHashMapto eliminate boxing overhead and reduce memory allocations
### New Features
- Bypass permission** - Players with
antiredstonelag.bypasspermission can place redstone without limits - Block owner tracking** - Tracks who placed redstone blocks for bypass permission checks
- Configurable reset interval** - New
reset-interval-ticksconfig option (default: 20 ticks = 1 second) - Debug mode** - New
debugconfig option for verbose logging during troubleshooting - Config validation** - Threshold values are now validated (must be positive)
- Alert cooldown** - 1 second cooldown between alerts to prevent spam when multiple blocks are removed
- Persistent statistics** - Statistics (
totalRemovals,removalsToday) are saved tostats.ymland survive server restarts - Configurable removal action** - New
removal-actionconfig option with three modes: REMOVE- Set block to air (default)DISABLE- Cancel redstone signal without removing blockDROP- Break block and drop item- Warning system** - Warns players when their redstone activity approaches the threshold
- Configurable warning threshold (default: 80% of limit)
- Per-player cooldown to prevent spam
- Only warns block owners who are online
- Update checker** - Automatically checks for new versions on SpigotMC
- Notifies admins with
antiredstonelag.adminpermission on join - Non-blocking async check on startup
- Whitelist mode** - Only monitor specific chunks instead of all chunks
- Configure chunks as
world:chunkX:chunkZformat - Useful for monitoring only known problem areas
### Improvements
- Real-time statistics** - Stats command now displays actual monitored chunks, blocks, total removals, and daily removals
- Better code structure** -
CommandHandlernow receivesCounterManagervia dependency injection - Improved config comments** - Better documentation in
config.yml - Stats saved on shutdown** - Statistics are automatically saved when the plugin is disabled
- Null safety** - Added null checks to
CounterManagermethods to prevent potential NPEs - JavaDoc comments** - Added documentation to key methods
### New Permissions
antiredstonelag.bypass- Bypass redstone limits (default: false)
Read the description