PrismarineJS / mineflayer

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

Mineflayer bot fails to connect with AntiBot plugin #2281

Open azurenekowo opened 3 years ago

azurenekowo commented 3 years ago

Versions

Detailed description of a problem

Bot auto get kicked after 40 seconds logging in server with the error Internal Exception: io.netty.handler.timeout.ReadTimeoutException

What did you try yet?

Did you try any method from the API? Yes Did you try any example? Any error from those? Yes, and yes. I also tried to specify a version. No luck.

Your current code

const mineflayer = require('mineflayer') 
var AutoAuth = require('mineflayer-auto-auth') //auto - auth bc offline server
const moment = require('moment'); //import momentjs

const bot = mineflayer.createBot({
  host: 'server.ip.here',
  username: 'username',
  version: "1.17.1",             
  plugins: [AutoAuth],
  AutoAuth: 'password'
})
bot.on('serverAuth', function() {
    console.log(`Logged in`);   
});

bot.on('chat', (username, message) => {
    if(message.includes("hi")) 
        bot.chat("Hello!")
})

Expected behavior

It should log in and stay afk.

Additional context

The server is running Application Management Panel (AMP for MC).

U5B commented 3 years ago

Any other plugins the server is running?

azurenekowo commented 3 years ago

@U5B so I just find out the server runs botsentry too, maybe it is the problem?

U5B commented 3 years ago

Try this PR: https://github.com/PrismarineJS/mineflayer/pull/2217 npm i https://github.com/PrismarineJS/mineflayer/pull/2217

This fixed an issue with a different anticheat on 1.17. EDIT: also if you don't mind dropping the server ip so I can test hehe

azurenekowo commented 3 years ago

@U5B uhhh image

memosoff commented 3 years ago

@U5B have same problem, and can't install pull. Any solution? server ip: mc.FunDaily.xyz (which is 1.17.1)

you can use this to log into 1.17.1

    if(mcbot.heldItem.type == 795 && mcbot.heldItem.nbt.value.display.value.Name.value.includes("Выбор режима "))
      {
        while(mcbot.heldItem.type == 795)
        {
          mcbot.activateItem();
          await sleep(1000);
          mcbot.on('windowOpen', (window) => {
            mcbot.clickWindow(5,0,0)
            mcbot.removeAllListeners("windowOpen");
            })
          await sleep(10000);
        }
      }
      return
})
patyhank commented 3 years ago

@EndermanHackerVN maybe use npm i https://github.com/PrismarineJS/mineflayer#pull/2217/head refer to this answer