Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Death causes crash. Bot is undefined #3553

Open
1 task done
Emibergo02 opened this issue Jan 9, 2025 · 1 comment
Open
1 task done

Death causes crash. Bot is undefined #3553

Emibergo02 opened this issue Jan 9, 2025 · 1 comment
Labels
possible bug Stage1 just created by someone new to the project, we don't know yet if it deserves an implementation / a f

Comments

@Emibergo02
Copy link

Emibergo02 commented Jan 9, 2025

  • The FAQ doesn't contain a resolution to my issue

Versions

  • mineflayer: 4.25.0
  • server: paper 1.21.3
  • node: 21

Detailed description of a problem

204 | 
205 |     await diggingTask.promise
206 |   }
207 |
208 |   bot.on('death', () => {
209 |     bot.removeAllListeners('diggingAborted')
              ^
TypeError: undefined is not an object (evaluating 'this._events')
      at removeAllListeners (node:events:453:25)
      at <anonymous> (C:\Users\Gigietto\WebstormProjects\Bot-test\node_modules\mineflayer\lib\plugins\digging.js:209:9)
      at emit (node:events:308:22)
      at <anonymous> (C:\Users\Gigietto\WebstormProjects\Bot-test\node_modules\mineflayer\lib\plugins\health.js:25:13)
      at emit (node:events:314:22)
      at emitPacket (C:\Users\Gigietto\WebstormProjects\Bot-test\node_modules\minecraft-protocol\src\client.js:84:12)
      at <anonymous> (C:\Users\Gigietto\WebstormProjects\Bot-test\node_modules\minecraft-protocol\src\client.js:113:9)
      at emit (node:events:311:22)
      at addChunk (C:\Users\Gigietto\WebstormProjects\Bot-test\node_modules\readable-stream\lib\internal\streams\readable.js:323:12)
      at readableAddChunk (C:\Users\Gigietto\WebstormProjects\Bot-test\node_modules\readable-stream\lib\internal\streams\readable.js:300:9)

What did you try yet?

To make the bots safe without dying. If they not die it works fine as always

Your current code

createBot({
    host: 'localhost', // Replace with your server's IP
    port: 25565,       // Replace with your server's port
    username: 'aaa0',
    version: '1.21.3'
})

Expected behavior

Normal handling with death event calling the listener

@Emibergo02 Emibergo02 added possible bug Stage1 just created by someone new to the project, we don't know yet if it deserves an implementation / a f labels Jan 9, 2025
@Emibergo02
Copy link
Author

Emibergo02 commented Jan 9, 2025

Simplified the code even more

createBot({
    host: 'localhost', // Replace with your server's IP
    port: 25565,       // Replace with your server's port
    username: 'aaa0',
    version: '1.21.3'
})

To reproduce:
Just kill the player or make it die by a zombie

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
possible bug Stage1 just created by someone new to the project, we don't know yet if it deserves an implementation / a f
Projects
None yet
Development

No branches or pull requests

1 participant