From 8c2b47a667fd917f2e51a2467ae5d3a41381c673 Mon Sep 17 00:00:00 2001 From: Sefirosweb Date: Sun, 7 Apr 2024 14:34:09 +0200 Subject: [PATCH] Add hotfix to avoid memory leak --- core/src/BehaviorModules/BehaviorSleep.ts | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/core/src/BehaviorModules/BehaviorSleep.ts b/core/src/BehaviorModules/BehaviorSleep.ts index 03dd23a..6b147f2 100644 --- a/core/src/BehaviorModules/BehaviorSleep.ts +++ b/core/src/BehaviorModules/BehaviorSleep.ts @@ -58,12 +58,13 @@ export class BehaviorSleep implements StateBehavior { /****/ // Pending issue - // https://github.com/PrismarineJS/mineflayer/issues/3349 - + this.bot.sleep(block) - .catch(err => { - /** HOTFIX until sleep() is fixed **/ - console.log('clearing timeout') + .catch(err => { + /** HOTFIX until sleep() is fixed **/ + console.log('clearing timeout') + // https://github.com/PrismarineJS/mineflayer/issues/3349 + this.bot.removeAllListeners('sleep') clearTimeout(timeOutForsleep) /****/