ClearLaggEnhanced icon

ClearLaggEnhanced -----

The definitive successor to the original ClearLagg. This version has been rebuilt for modern servers




ClearLaggEnhanced Changelog

[1.4-Beta]

✨ Added
  • Lombok Support - Added Lombok framework for cleaner code
  • Database Indexes - Added 3 strategic indexes to laggy_chunks table for 10-100x faster queries
    • idx_laggy_chunks_world - Fast world filtering
    • idx_laggy_chunks_entity_count - Fast sorting by entity count
    • idx_laggy_chunks_composite - Fast chunk lookups by coordinates
  • Auto-Update System - Config and messages files now automatically update while preserving user customizations
    • Automatic backups created (e.g., config.yml.backup-v1)
    • Smart merging of new values with user settings
    • Version tracking for both config.yml and messages.yml
  • Professional Messages - Complete overhaul of messages.yml
    • Consistent color scheme with documentation
    • Added icons (✓, ✗, ⚠, ⏰, ⚡, etc.)
    • Better formatting with borders and bullets
    • All messages now properly colored
  • Java Records - Converted data classes to use modern Java 17 records

Changed
  • Entity Clearing Logic - Completely refactored for better UX
    • BREAKING: Removed confusing blacklist system
    • Now uses whitelist-only approach: "Clear everything EXCEPT whitelisted entities"
    • Items on ground (DROPPED_ITEM) now properly clear by default
    • Living entities clear by default unless whitelisted
    • Much more intuitive for server owners
  • Database Schema - Changed world column from TEXT to VARCHAR(255)
    • 50-70% storage reduction for world names
    • Better indexing performance
  • Config Defaults - Updated default world list
    • Changed from ["world_nether", "world_the_end"] to [] (all worlds)
    • More sensible defaults for new installations
  • Whitelist - Refined default protected entities
    • Added: CAT, PARROT, GLOW_ITEM_FRAME, CHEST_MINECART, FURNACE_MINECART, HOPPER_MINECART, CHEST_BOAT
    • Removed: OAK_BOAT (consolidated to BOAT)

⚡ Performance
  • Main Thread Optimization - Removed unnecessary runTask() calls
    • ClearCommand.java - Direct execution (saves ~1-2ms per operation)
    • MobLimiterListener.java - Direct execution in MONITOR event
    • Reduced main thread blocking and task queue overhead
  • Database Performance - Query speed improvements with new indexes
    • ChunkFinder queries 10-100x faster as data grows
    • Efficient world-specific filtering
    • Optimized sorting by entity count

Fixed
  • Entity Clearing Bug - Items on ground now properly clear
    • Previous logic only cleared items in blacklist
    • New logic clears all non-whitelisted entities
  • Config Migration - Improved existing migration system
    • Better handling of deprecated keys
    • Clearer console output during migration
    • Fixed edge cases in setting preservation

️ Removed
  • Blacklist System - Removed from config.yml (36 lines)
    • Confusing two-list system replaced with simpler whitelist-only
    • Old blacklist entries automatically converted during migration

Technical Details
  • Lombok Dependency: 1.18.30
  • Config Version: 1 → 2 (auto-migration implemented)
  • Messages Version: 1 → 2 (auto-migration implemented)
  • Java Version: 17 (using records and text blocks)
  • Code Cleanup: Removed all inline comments per project style

Migration Guide

From 1.3 to 1.4

Automatic Migration
When you first start v1.4, the plugin will:
  1. Detect outdated config (v1) and messages (v1)
  2. Create backups: config.yml.backup-v1 and messages.yml.backup-v1
  3. Merge your customizations with new defaults
  4. Log all migrated settings to console

Manual Steps (Optional)
None required! Everything is automatic.

Breaking Changes
  1. Blacklist Removed: If you relied on blacklist behavior, adjust your whitelist:
    • Old: Blacklist = entities to clear
    • New: Whitelist = entities to protect, everything else clears

Reverting
If you need to revert:
  1. Stop server
  2. Restore from backup: cp config.yml.backup-v1 config.yml
  3. Edit config-version: 1 in config.yml
  4. Start server with old plugin version

Performance Impact
Optimization Improvement Details
Database Indexes 10-100x faster queries Scales with data volume
Main Thread ~1-2ms per clear Immediate per-operation gain
Database Schema 50-70% less storage VARCHAR vs TEXT efficiency
Overall Significantly better Especially on large servers
----------, Oct 5, 2025

Changelog

Added
  • Hopper limiter: Cached per-chunk hopper counts to enable soft-cap–based cooldown scaling.
    • New concurrent cache: hopperCountByChunk keyed as "world:x,z".
    • Lazy initialization: If a loaded chunk has no cache entry at use time, it’s scanned and cached.
    • Event-driven updates:
      • ChunkLoadEvent: scan and seed cache.
      • ChunkUnloadEvent: remove cache and related per-chunk tick maps to prevent leaks.
      • BlockPlaceEvent (HOPPER): increment chunk count.
      • BlockBreakEvent (HOPPER): decrement chunk count (floors at 0).
    • Debug messaging for throttling per chunk uses the existing key debug.hopper.throttling from messages.yml (rate limited to once per 100 ticks per chunk).

Changed
  • Hopper cooldown computation now properly applies the soft cap:
    • Base cooldown: lag-prevention.hopper-limiter.transfer-cooldown ticks (min 1).
    • If hopper count in the chunk > max-hoppers-per-chunk, effective cooldown increases by 2 * (excess) ticks.
  • The count method is now cache-backed:
    • countHoppersInChunkCached(Chunk) returns the cached number, performs a synchronous scan if necessary for loaded chunks, and returns 0 for unloaded chunks (no forced chunk loads).

Fixed
  • Soft-cap effect was previously ineffective because hopper counts always returned 0; now it reflects real counts and increases cooldown in hopper-dense chunks.

Performance/Memory
  • Event-driven cache maintenance avoids per-tick scanning.
  • Lazy scan only occurs on first access for loaded chunks without a cache entry.
  • Cleanup on ChunkUnloadEvent prevents memory leaks by removing:
    • hopperCountByChunk, lastMoveTickByChunk, lastLogTickByChunk entries for the chunk.

Compatibility
  • Java 17+, Spigot/Paper 1.17+ APIs.
  • No changes to permissions, commands, or message keys.
  • Configuration keys reused:
    • lag-prevention.hopper-limiter.enabled
    • lag-prevention.hopper-limiter.transfer-cooldown
    • lag-prevention.hopper-limiter.max-hoppers-per-chunk
    • debug

[HR][/HR]

How to test the new hopper limiter behavior

1) Build and install
  • Build the plugin (build completed successfully during this session).
  • Place the generated JAR into your server’s plugins folder.
  • Start the server.

2) Configure
In plugins/ClearLaggEnhanced/config.yml:
Code (YAML):

lag-prevention.hopper-limiter.enabled
: true
lag-prevention.hopper-limiter.transfer-cooldown
: 8
lag-prevention.hopper-limiter.max-hoppers-per-chunk
: 5
debug
: true
 
Reload:
  • /lagg reload (or restart the server).

3) Baseline verification (≤ cap)
  • In a single chunk, place 5 hoppers (equal to the configured cap).
  • Set up a simple hopper-to-chest item transfer.
  • Observe transfers occur at the base cooldown (8 ticks in the example).
  • With debug on, you should not see persistent throttling logs for this chunk.

4) Soft-cap scaling (> cap)
  • Increase hoppers in the same chunk to 8 (3 above cap).
  • Expected effective cooldown: base + (2 * excess) = 8 + (2*3) = 14 ticks.
  • Observe that transfers are slower (roughly 75% speed of baseline).
  • With debug enabled, you should periodically see:
    debug.hopper.throttling once per ~100 ticks per chunk (rate-limited).
  • Reduce back to 5 hoppers; transfers should return to the base rate on the next allowed move.

5) Event-driven cache updates
  • Block place:
    • Place a hopper in the test chunk and confirm the slowdown increases immediately (no server reload).
  • Block break:
    • Break a hopper and confirm slowdown decreases accordingly (no server reload).
  • Chunk load:
    • Move far enough away (or use a second account) so the test chunk unloads, then return to load it.
    • On reload, behavior should match the current in-world number of hoppers (cache is reseeded).
  • Chunk unload:
    • Move away to unload the chunk; ensure no debug spam continues for that chunk; upon coming back, the count re-initializes and matches reality.

6) Unloaded chunk behavior
  • When a chunk is unloaded, the system treats the count as 0 (no extra cooldown added due to unknown state).
  • This minimizes false throttling for inactive areas.

7) Stress/regression checks
  • Place 30+ hoppers in a single chunk and verify transfers are heavily throttled without server lag spikes.
  • Verify other systems remain unaffected:
    • Entity clear commands still function (/lagg clear, /lagg next, /lagg tps).
    • Messages resolve correctly (check messages.yml entries still appear).
  • TPS stability:
    • Monitor /lagg tps or your profiler; event-driven design should avoid per-tick overhead.

8) Optional observability
  • If you have a diagnostics command or profiler, confirm:
    • No growth in per-chunk maps after chunk unloads.
    • Hopper counts change as you place/break hoppers.

[HR][/HR]

Quick reference: expected messages and keys
  • Debug throttling message key: debug.hopper.throttling in messages.yml
    • Placeholders: {x}, {z} (chunk coordinates).

[HR][/HR]

Rollback plan
  • Set lag-prevention.hopper-limiter.enabled: false to disable hopper throttling entirely if needed.
  • Revert to a previous plugin build if you need to remove the feature.
----------, Aug 26, 2025

Resource Information
Author:
----------
Total Downloads: 45
First Release: Aug 24, 2025
Last Update: Oct 5, 2025
Category: ---------------
All-Time Rating:
2 ratings
Version -----
Released: --------------------
Downloads: ------
Version Rating:
----------------------
-- ratings