Try to make proxy connection on mineflayer, but it doesn't work

See original GitHub issue
  • The FAQ doesn’t contain a resolution to my issue

Detailed description of a problem

My stupid brain bug, i don’t understand how i can do this

What did you try yet?

I try to add proxy support like in FAQ

Your current code

const snekfetch = require("snekfetch")
const config = require("./config.json")
const mc = require('minecraft-protocol');
const SocksClient = require('socks').SocksClient;
let number = 100
setInterval(() => {
number = number + 1
var mineflayer = require('mineflayer');
var bot = mineflayer.createBot({
	connect: (client) => {
		SocksClient.createConnection({
		  proxy: {
			host: '194.85.124.150',
			port: 4153,
			type: 4,
			userId: config.crackedusernameprefix + number.toString(),
		  },
		  command: 'connect',
		  destination: {
			host: '135.181.20.179',
			port: 25565
		  }
		}, (err, info) => {
		  if (err) {
			console.log(err)
			return
		  }
		  client.setSocket(info.socket)
		  client.emit('connect')
		})
	  },
	port: config.port,
	username: config.crackedusernameprefix + number.toString(),
	version: config.version,
	plugins: {
		conversions: false,
		furnace: false,
		math: false,
		painting: false,
		scoreboard: false,
		villager: false,
		bed: false,
		book: false,
		boss_bar: false,
		chest: false,
		command_block: false,
		craft: false,
		digging: false,
		dispenser: false,
		enchantment_table: false,
		experience: false,
		rain: false,
		ray_trace: false,
		sound: false,
		tablist: false,
		time: false,
		title: false,
		physics: config.physics,
		blocks: true
	}
});
bot.on('login', () => {
	bot.chat("/login p@ssword123")
	bot.chat("/register p@ssword123 p@ssword123")
	setInterval(() => {
		// bot.chat(config.spammessage)
	}, config.spamintervalms)
	console.log("Logged in " + bot.username)
});
bot.on('error', err => console.log(err))
bot.on('kicked', function(reason) {
	console.log("I got kicked for", reason, "lol");
});
}, config.loginintervalms)

What i do wrong?

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Reactions:1
  • Comments:19 (7 by maintainers)

github_iconTop GitHub Comments

1reaction
Aroxiscommented, Jul 6, 2021

For those who are trying to use offline accounts with the proxies, don’t be like me and don’t forget the ‘skipValidation’: true on the options object. Wasted 5 hours of my life on this.

1reaction
Aroxiscommented, Jul 5, 2021

I based myself of the given example but that didn’t work. Upon adding host and port in the root of the options object I managed to get it working …

bot = mineflayer.createBot({
                           connect: client => {
                                socks.createConnection({
                                    proxy : mcProxy,
                                    command: 'connect',
                                    destination: {
                                        host: currentOperation.serverAddress,
                                        port: parseInt(currentOperation.serverPort)
                                    }
                                }, (err, info) => {
                                    if (err) {
                                        console.log(err)
                                        return
                                    }
                                    client.setSocket(info.socket)
                                    client.emit('connect')
                                })
                            },
                            username: account.username,
                            password: account.password,
                            host: currentOperation.serverAddress, // Without these a Not Permitted error would be thrown
                            port: parseInt(currentOperation.serverPort), // 
                            agent: agent
                        });
Read more comments on GitHub >

github_iconTop Results From Across the Web

Proxies with Socks5-Client not working · Issue #1834 - GitHub
Hi. I'm working on new project and I use proxies there. The problem is Socks5-Client isn't working for me and other developer. I...
Read more >
PrismarineJS/mineflayer - Gitter
<jan dzban> Yes I was thinking about it, but actually I need help specifically with the proxy side of the problem, like an...
Read more >
Recently Active 'mineflayer' Questions - Stack Overflow
I'm trying to pause this function using the breakTheLoop var but it wont work. ... I'm trying to make a mineflayer bot but...
Read more >
prismarine-inspector - npm
Minecraft protocol packet viewer using Chrome DevTools. Supports mineflayer , node-minecraft-protocol , prismarine-proxy and bedrock-protocol .
Read more >
Top 5 mineflayer Code Examples - Snyk
Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately. Enable here. github PrismarineJS /...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found