fix(minecraft): nullify EventRegistry context on stop() to prevent stale handler execution

When stop() is called before detachFromBot(), mineflayer listeners remain
attached. Nullifying context ensures handleMineflayerEvent's guard clause
silently ignores any events that fire in this window.
This commit is contained in:
Rin
2026-02-18 11:14:44 +08:00
committed by Neko Ayaka
parent 32957e4269
commit e668b9b410
@@ -96,6 +96,10 @@ export class EventRegistry {
clearInterval(this.timer)
this.timer = null
}
// NOTICE: Nullify context so that any stale mineflayer listeners that fire
// after stop() (but before detachFromBot()) are silently ignored by the
// guard at the top of handleMineflayerEvent.
this.context = null
}
public getDebugSnapshot(): SaliencySnapshot {