PrismarineJS / mineflayer

Create Minecraft bots with a powerful, stable, and high level JavaScript API.
https://prismarinejs.github.io/mineflayer/
MIT License
4.96k stars 904 forks source link

in storage builder worldName is not always a string #2640

Closed rom1504 closed 1 year ago

rom1504 commented 2 years ago

Discussed in https://github.com/PrismarineJS/mineflayer/discussions/2639

rom1504 commented 2 years ago

@Daanay if you have the time, it would be great to check in mineflayer code where we assign worldName to not a string and fix it

arcctg commented 2 years ago

image Maybe somewhere here? https://github.com/PrismarineJS/mineflayer/blob/4fe54ad05a8c68892534f8f7c78e77cbff8a67b5/lib/plugins/blocks.js . . Also, full error in worldName = worldName.replace(/:/g, '_') points here:

worldName = worldName.replace(/:/g, '_')
                          ^

TypeError: worldName.replace is not a function
    at storageBuilder (C:\Users\Stepan\bot\world_saver.js:20:27)
    at switchWorld (C:\Users\Stepan\bot\node_modules\mineflayer\lib\plugins\blocks.js:490:52)
    at Client.<anonymous> (C:\Users\Stepan\bot\node_modules\mineflayer\lib\plugins\blocks.js:502:5)
    at Client.emit (node:events:539:35)
    at FullPacketParser.<anonymous> (C:\Users\Stepan\bot\node_modules\minecraft-protocol\src\client.js:91:12)
    at FullPacketParser.emit (node:events:527:28)
    at addChunk (C:\Users\Stepan\bot\node_modules\readable-stream\lib\_stream_readable.js:298:12)
    at readableAddChunk (C:\Users\Stepan\bot\node_modules\readable-stream\lib\_stream_readable.js:280:11)
    at Readable.push (C:\Users\Stepan\bot\node_modules\readable-stream\lib\_stream_readable.js:241:10)
    at Transform.push (C:\Users\Stepan\bot\node_modules\readable-stream\lib\_stream_transform.js:139:32)

Node.js v18.1.0

I haven't studied JS, so I can't help much.