CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
PrismarineJS

Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place. Commercial Alternative to JupyterHub.

GitHub Repository: PrismarineJS/mineflayer
Path: blob/master/examples/multiple.js
Views: 789
1
const mineflayer = require('mineflayer')
2
3
if (process.argv.length < 3 || process.argv.length > 5) {
4
console.log('Usage : node multiple.js <host> <port>')
5
process.exit(1)
6
}
7
8
let i = 0
9
function next () {
10
if (i < 10) {
11
i++
12
setTimeout(() => {
13
createBot(`mineflayer-bot${i}`)
14
next()
15
}, 100)
16
}
17
}
18
next()
19
20
function createBot (name) {
21
mineflayer.createBot({
22
host: process.argv[2],
23
port: parseInt(process.argv[3]),
24
username: name
25
})
26
}
27
28