PrismarineJS / mineflayer

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

Symbols crash the bot. #1469

Closed ghost closed 3 years ago

ghost commented 3 years ago

Versions

Detailed description of a problem

When you receive a chat message with text (✯ᴗ✯)(✯ᴗ✯)(✿^‿^)(✯ᴗ✯)(◡ ω ◡)(✷‿✷)(✯ᴗ✯)(✿^‿^)(。•̀ᴗ-)✧(◍•ᴗ•◍)(。•̀ᴗ-)✧(✯ᴗ✯)(◠‿◕)(◍•ᴗ•◍)(◠‿◕)(✯ᴗ✯)(◍•ᴗ•◍)(人 •͈ᴗ•͈)(◔‿◔)(人 •͈ᴗ•͈)(人 •͈ᴗ•͈)(・∀・)(◕દ◕)(〃゚3゚〃)ෆ╹ .̮ ╹ෆෆ╹ .̮ ╹ෆ♥╣[-_-]╠♥( ˘ ³˘)♥(•ө•)♡( ˘ ³˘)♥(◕દ◕)(●’3)♡(ε●)(♡ω♡ ) ~♪(灬º‿º灬)♡( ˘ ³˘)♥╰(´︶`)╯⊂(◉‿◉)つ⊂(・﹏・⊂)~(つˆДˆ)つ。☆ლ(´ ❥ ლ)╰(⸝⸝⸝´꒳⸝⸝⸝)╯╰(´︶`)╯ლ(・﹏・ლ)ヾ(˙❥˙)ノ╰(⸝⸝⸝´꒳⸝⸝⸝)╯⊂(・﹏・⊂)ᕙ(ಠ ਊ ಠ)ᕗᕙ (° ~ ° ~)ᕙ(ಠ ਊ ಠ)ᕗᕙ (° ~ ° ~)ᕙ(ಠ ਊ ಠ)ᕗ the bot crashes.

What did you try yet?

bot.on('message')

Your current code

bot.on('message', function(message) {
       console.log(message.toString())
});

Expected behavior

Additional context

wvffle commented 3 years ago

latest does not say anything.

What's the stack trace?

ghost commented 3 years ago

latest does not say anything.

What's the stack trace?

version 2.34.0 What do you mean by stack trace?

TheDudeFromCI commented 3 years ago

A stack trace is the error message in the console. It helps you to find where the issue is and what's causing it.

ghost commented 3 years ago

A stack trace is the error message in the console. It helps you to find where the issue is and what's causing it.

More specifically? How do I handle this problem?

amoraschi commented 3 years ago

I think he's trying to say what get's printed in the console when the bot crashes

ghost commented 3 years ago

I think he's trying to say what get's printed in the console when the bot crashes

@wvffle Nothing was output to the console after the message. Not a single mistake was made

FiftiOnGithub commented 3 years ago

There is no error. This happens on many individual symbols (Most noticeably the circle used on hypixel that is colored to show whether someone is online when using /g online).

The client receives the message, but does not act on it. The process then hangs forever, with no error.

Minecraft gamechat image of the symbol I'm talking about: image

rom1504 commented 3 years ago

if you care about this problem being solved, please provide a simple and reliable way to reproduce it

ghost commented 3 years ago

if you care about this problem being solved, please provide a simple and reliable way to reproduce it

const​ ​mineflayer​ ​=​ ​require​(​'mineflayer'​)​

​const​ ​bot​ ​=​ ​mineflayer​.​createBot​(​{​
  ​host​: ​'localhost'​,​ ​
  ​port​: ​25565​,​
  ​username​: ​'username',​ ​          ​
  ​version​: ​false​
​}​)​

​bot​.​on​(​'message',​ ​function​ ​(​message)​ ​{​
  ​console.log(message.toString())
​}​)​

​
​bot​.​on​(​'kicked'​,​ ​(​reason​,​ ​loggedIn​)​ ​=>​ ​console​.​log​(​reason​,​ ​loggedIn​)​)​
​bot​.​on​(​'error'​,​ ​err​ ​=>​ ​console​.​log​(​err))

npm install flying-squid and create simple local server with

const mcServer = require('flying-squid')

mcServer.createMCServer({
  motd: 'Test server',
  port: 25565,
  'max-players': 10,
  'online-mode': false,
  logging: true,
  gameMode: 1,
  difficulty: 1,
  worldFolder: 'world',
  generation: {
    name: 'diamond_square',
    options: {
      worldHeight: 80
    }
  },
  kickTimeout: 10000,
  plugins: {

  },
  modpe: false,
  'view-distance': 10,
  'player-list-text': {
    header: 'Flying squid',
    footer: 'Test server'
  },
  'everybody-op': true,
  'max-entities': 100,
  version: '1.16.1'
})
u9g commented 3 years ago

Can confirm this is still a problem, looks like any debug lines from minecraft-protocol stop instantly aswell, not a problem with minecraft-protocol

extremeheat commented 3 years ago

Duplicate of #902

u9g commented 3 years ago

should be closed, duplicate of https://github.com/PrismarineJS/mineflayer/issues/902