diff --git a/services/minecraft/src/cognitive/perception/events/index.ts b/services/minecraft/src/cognitive/perception/events/index.ts index f1ad37280..8b477c9b5 100644 --- a/services/minecraft/src/cognitive/perception/events/index.ts +++ b/services/minecraft/src/cognitive/perception/events/index.ts @@ -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 {