PrismarineJS / mineflayer

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

Unable to send messages due to missing publicKey #2977

Closed ghost closed 1 year ago

ghost commented 1 year ago

Versions

Detailed description of a problem

When trying to use the method bot.Chat, I'm getting the error "Chat disabled due to missing profile public key. Please try reconnecting.", the server is online and has chat signing enabled, I've logged into the account myself to verify it could send messages and it can.

What did you try yet?

Updating everything and using the latest versions straight from git

Your current code

const mineflayer = require('mineflayer')

if (process.argv.length < 4 || process.argv.length > 6) {
  console.log('Usage : node main.js <host> <port> [<name>] [<password>]')
  process.exit(1)
}

const bot = mineflayer.createBot({
  host: process.argv[2],
  port: parseInt(process.argv[3]),
  username: process.argv[4],
  password: process.argv[5],
  auth: 'microsoft'
})

bot.on('chat', (username, message) => {
  if (username === bot.username) return
  bot.chat(message)
})

// Log errors and kick reasons:
bot.on('kicked', console.log)
bot.on('error', console.log)

Expected behavior

The chat message sends and is viewable by the rest of the server

frej4189 commented 1 year ago

What version is the server in?

ghost commented 1 year ago

What version is the server in?

1.19.3

SonicandTailsCD commented 1 year ago

Sadly, this may or may not work, as 1.19.3 has the Player Reporting system. That system is broken...

SonicandTailsCD commented 1 year ago

Let me tell you what you can do, lah.

  1. Install the plugin named "SkinRestorer (Offline and Online mode)", don't start the server yet!
  2. Set your server to offline mode, make sure your server is limited to the amount of players that will be connected simultaneously, otherwise hackers may come and NUKE the server.

If you want, I can join (Offline Mode only - I don't use a premium account yet) and I can see what happens and try to help you...

ghost commented 1 year ago

Let me tell you what you can do, lah.

  1. Install the plugin named "SkinRestorer (Offline and Online mode)", don't start the server yet!
  2. Set your server to offline mode, make sure your server is limited to the amount of players that will be connected simultaneously, otherwise hackers may come and NUKE the server.

If you want, I can join (Offline Mode only - I don't use a premium account yet) and I can see what happens and try to help you...

I don't have permission to modify anything on the server-side of things, I only have permission to run the bot

SonicandTailsCD commented 1 year ago

You don't own the server?

SonicandTailsCD commented 1 year ago

If you don't, ask the owner to install the SkinRestorer plugin and set that server in offline mode. If you don't know, SkinRestorer applies skins for offline and online mode servers. Offline mode does open up the ability for hackers to join, but the full-on player reporting will be gone, allowing the bot to join and chat!

SonicandTailsCD commented 1 year ago

One more thing you can do: go to aternos.org/login and create an account. You'll have a server for FREE!

SonicandTailsCD commented 1 year ago

The catch is, there are a few limitations…

extremeheat commented 1 year ago

Should be fixed after https://github.com/PrismarineJS/node-minecraft-protocol/pull/1091 is merged