node-minecraft-protocol icon indicating copy to clipboard operation
node-minecraft-protocol copied to clipboard

versionChecking.js Bug

Open obseletecode72 opened this issue 1 year ago • 1 comments

[X] The FAQ doesn't contain a resolution to my issue

Versions

  • minecraft-protocol: latest
  • server: paper 1.20.4
  • node: #.#.#

Detailed description of a problem

just tried to join normally in the server and throwed an exception

Expected behavior

join normally in the server

Additional context

´´´ SyntaxError: "[object Object]" is not valid JSON at JSON.parse () at Client. (C:\Users\Administrator\Desktop\mine\node_modules\minecraft-protocol\src\client\versionChecking.js:6:21) at Client.emit (node:events:526:35) at emitPacket (C:\Users\Administrator\Desktop\mine\node_modules\minecraft-protocol\src\client.js:83:12) at FullPacketParser. (C:\Users\Administrator\Desktop\mine\node_modules\minecraft-protocol\src\client.js:112:9) at FullPacketParser.emit (node:events:514:28) at addChunk (C:\Users\Administrator\Desktop\mine\node_modules\protodef\node_modules\readable-stream\lib_stream_readable.js:279:12) at readableAddChunk (C:\Users\Administrator\Desktop\mine\node_modules\protodef\node_modules\readable-stream\lib_stream_readable.js:262:11) at Readable.push (C:\Users\Administrator\Desktop\mine\node_modules\protodef\node_modules\readable-stream\lib_stream_readable.js:228:10) at Transform.push (C:\Users\Administrator\Desktop\mine\node_modules\protodef\node_modules\readable-stream\lib_stream_transform.js:132:32) SyntaxError: "[object Object]" is not valid JSON at JSON.parse () at Client. (C:\Users\Administrator\Desktop\mine\node_modules\minecraft-protocol\src\client\versionChecking.js:6:21) at Client.emit (node:events:526:35) at emitPacket (C:\Users\Administrator\Desktop\mine\node_modules\minecraft-protocol\src\client.js:83:12) at FullPacketParser. (C:\Users\Administrator\Desktop\mine\node_modules\minecraft-protocol\src\client.js:112:9) at FullPacketParser.emit (node:events:514:28) at addChunk (C:\Users\Administrator\Desktop\mine\node_modules\protodef\node_modules\readable-stream\lib_stream_readable.js:279:12) at readableAddChunk (C:\Users\Administrator\Desktop\mine\node_modules\protodef\node_modules\readable-stream\lib_stream_readable.js:262:11) at Readable.push (C:\Users\Administrator\Desktop\mine\node_modules\protodef\node_modules\readable-stream\lib_stream_readable.js:228:10) at Transform.push (C:\Users\Administrator\Desktop\mine\node_modules\protodef\node_modules\readable-stream\lib_stream_transform.js:132:32) ´´´

obseletecode72 avatar Mar 06 '24 20:03 obseletecode72

This is due to the disconect handler not being updated to handle 1.20.3+ NBT based disconnects in the Configuration and Play States.

wgaylord avatar Mar 06 '24 21:03 wgaylord

Right, the underlying reason for this error is the server is kicking you (for one reason or another). It could be due to a version mismatch or something else.

Not sure what exactly the purpose of parsing the disconnect message really is beyond a formatted message, so we might be able to skip the parsing completely.

extremeheat avatar May 26 '24 17:05 extremeheat

Pretty sure I fixed this in https://github.com/PrismarineJS/node-minecraft-protocol/pull/1291 but forgot to mention it here.

wgaylord avatar May 26 '24 17:05 wgaylord

This has not been part of any release, why was this closed already? How do I make use of the fix in #1291?

Gjum avatar Aug 16 '24 14:08 Gjum