PrismarineJS / mineflayer-navigate

mineflayer plugin which gives bots a high level 3d navigating API using A*
59 stars 22 forks source link

Unable to remove listener #52

Closed Frettarix closed 4 years ago

Frettarix commented 4 years ago

Hi,

I'm using the bot.navigate.on('arrived', sleepInBed) to head to bed and then when arrived sleep. The thing is, it's causing a memory leak since the event listeners are stacking up. Now I have a bit to remove the event listener but it doesn't seem to work:

bot.navigate.removeListener('arrived', sleepInBed)

Am I missing something? Is there a solution to having the .on('arrived') for a single time use?

Frettarix commented 4 years ago

Double checked the dependencies and it works now