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

SyntaxError: Unexpected token #873

Closed
505051 opened this issue Oct 27, 2019 · 6 comments · Fixed by #876
Closed

SyntaxError: Unexpected token #873

505051 opened this issue Oct 27, 2019 · 6 comments · Fixed by #876
Labels

Comments

@505051
Copy link

505051 commented Oct 27, 2019

Versions

  • mineflayer: 2.9.6
  • server: spigot 1.12.2
  • node: 8.11.4

Detailed description of a problem

I tried to connect to a server with the bot, but the bot don't work, I don't really know why.

Current code

var mineflayer = require('mineflayer');
var bot = mineflayer.createBot({
  host: "play.hadaria.fr", // optional
  port: 25565,       // optional
  username: "MyEmail", // email and password are required only for
  password: "MyPassword",          // online-mode=true servers
  version: "1.12.2",               // false corresponds to auto version detection (that's the default), put for example "1.8.8" if you need a specific version
  keepAlive: true,
 });
bot.on('message', (message) => {
	console.log(message.toAnsi());
});
bot.on('error', err => console.log(err))

Expected behavior

I've tried to read the chat in the cmd

Additional context

I have this error when I try to join the server :

Auto logged in
Connexion » Connexion effectuée !

undefined:1
{"text":"","extra":[{"text":"\n","color":"yellow"},{"text":"✦ ","color":"yellow"},{"text":"HADARIA ","color":"gold","bold":"true"},{"text":"• ","color":"gray"},{"text":"PvP/Factions ","color":"gold","bold":"true"},{"text":"Farm2Win ","color":"green","bold":"true"},{"text":"N","color":"red","bold":"true"},{"text":"°","color":"red"},{"text":"1 FR ","color":"red","bold":"true"},{"text":"✦
                                                                                                                                                                                                                                                                                                                                                                                                    ^

SyntaxError: Unexpected token
 in JSON at position 388
    at JSON.parse (<anonymous>)
    at Client.bot._client.on (C:\Users\Admin\node_modules\mineflayer\lib\plugins\tablist.js:18:49)
    at emitTwo (events.js:126:13)
    at Client.emit (events.js:214:7)
    at FullPacketParser.deserializer.on (C:\Users\Admin\node_modules\minecraft-protocol\src\client.js:82:12)
    at emitOne (events.js:116:13)
    at FullPacketParser.emit (events.js:211:7)
    at addChunk (C:\Users\Admin\node_modules\readable-stream\lib\_stream_readable.js:297:12)
    at readableAddChunk (C:\Users\Admin\node_modules\readable-stream\lib\_stream_readable.js:279:11)
    at FullPacketParser.Readable.push (C:\Users\Admin\node_modules\readable-stream\lib\_stream_readable.js:240:10)```
@wvffle
Copy link
Member

wvffle commented Oct 28, 2019

Can you show a screenshot of tablist on the server?

@505051
Copy link
Author

505051 commented Oct 28, 2019

2019-10-28_09 33 46

@wvffle wvffle added bug and removed possible bug labels Nov 5, 2019
@RedNicStone
Copy link

Same error here
Server:
1.8 bukkit, with support for 1.9-1.13 protocolls
IP (If someone wants to join and check):
spreed.mooo.com:25565

@patyhank
Copy link

patyhank commented Jun 24, 2020

Same Error here
Server:
1.15.2
IP: mcfallout.net
image

@rom1504
Copy link
Member

rom1504 commented Jun 24, 2020

That's a server bug, fix your server

@wvffle
Copy link
Member

wvffle commented Jun 24, 2020

Same Error here
Server:
1.15.2
IP: mcfallout.net
image

Or create a new issue. You gave absolutely no context.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants