
NeuroLag
A smart, resource-aware optimization plugin that dynamically adjusts Mob AI based on server TPS and RAM to ensure a lag-free SMP experience
Список изменений
[1.4.1] — 2026-04-18 — Bug Fix Release
Fixed — Critical
-
Task leak on reload (
/nlag reload) —BackupManager.start()was called twice inonEnable()(once directly, once viastartRuntimeServices()), causing every scheduled task to be registered a second time on reload. The duplicate direct call has been removed; the initial backup is now triggered asynchronously insidestart()when no backups exist.stopRuntimeServices()now also callsengine.cancelAllPendingBatchTasks()before stopping the throttle task, ensuring all in-flightrunTaskLaterbatch tasks are cancelled before any new tasks are registered. (LagEngine,NeuroLag) -
collectTargets()running every tick on the main thread —LagEngine.collectTargets()calledworld.getLivingEntities()on every monitor tick, causing significant lag spikes on servers with large mob populations. The result is now cached per-world and rebuilt at most once every 4 ticks (~0.2 s). The cache is invalidated onrestoreAll()and on world state transitions. (LagEngine) -
FOLLOW_RANGE not fully restored for protected-zone mobs —
applyAiBatched()setAI = truefor protected mobs but did not always restoreFOLLOW_RANGEto its default value, so mobs could permanently retain a reduced follow range after leaving a zone. The fix unconditionally callsattr.setBaseValue(attr.getDefaultValue())for every protected mob encountered. Additionally, a newrestoreWorld(World)helper is called whenever a world transitions back toNORMAL, guaranteeing a full attribute restore even for mobs that were never re-processed by the batch scheduler. (LagEngine) -
Manual override (
/nlag toggle) not restoring mobs correctly — in-flightrunTaskLaterbatch tasks scheduled byapplyAiBatched()could execute afterrestoreAll()and re-apply AI restrictions or reduced follow ranges, leaving mobs frozen.handleToggle()now callsengine.cancelAllPendingBatchTasks()beforeengine.restoreAll()so no pending task survives the toggle. (LagEngine,NeuroLag)
Fixed — High
-
WebDashboard query-string token auth — passing
?token=...in the URL is insecure (tokens appear in server access logs, browser history, and HTTP referrer headers). The query-string fallback is now disabled by default. A new config keyweb-dashboard.auth.allow-query-token(defaultfalse) must be explicitly set totrueto re-enable it. The existing warning is preserved and now also states the config key needed to disable the fallback permanently. (WebDashboard,ConfigManager,monitors.yml) -
Redis subscriber thread not shutting down gracefully —
MultiServerSync.stop()calledredisSubThread.interrupt()but returned immediately, so the thread could still be holding a Jedis resource whenjedisPool.close()ran, causing pool-exhaustion exceptions in the server log on every reload. The fix addsredisSubThread.join(3000)afterinterrupt(), giving the thread up to 3 seconds to exit cleanly before the pool is closed. (MultiServerSync) -
MySQL reconnect logic throwing repeatedly when DB is down —
ensureConnected()calledDriverManager.getConnection()immediately on every sync cycle failure, flooding the log with stack traces. The fix introduces an atomic error-streak counter and an exponential back-off (sleep time =min(streak * 2, 30)seconds before reconnect). Log output now uses a power-of-two gating strategy (log on streak 1, 2, 4, 8, 16, …) to avoid noise during prolonged outages. (MultiServerSync) -
Batched AI task delay not capped — with 5 000+ mobs the delay between batches could reach 100 ticks (5 seconds), making mobs visibly unresponsive. The delay is now capped at 20 ticks (1 second) regardless of entity count. (
LagEngine) -
Smart culling could remove protected-zone mobs — the culling loop checked
zoneManager.isProtected()only in the main optimization path, not insidecull()itself. Mobs inside protected zones can now never be removed by smart culling. (LagEngine) -
BackupManager not backing up the
lang/directory — the ZIP bundle only included root-level.ymlfiles. Custom language files stored inplugins/NeuroLag/lang/would be lost on restore.collectConfigFiles()now recursively includeslang/*.ymlentries andrestoreZip()correctly recreates thelang/subdirectory on restore. (BackupManager)
