Compare commits
No commits in common. "086251bce60b9f98346432b501d2aa8c20e2c020" and "eae4e958036a94d3c0d32660221570bbabace9e0" have entirely different histories.
086251bce6
...
eae4e95803
29
lib/index.js
29
lib/index.js
|
@ -9,22 +9,19 @@ let cfg = {
|
||||||
const mineflayer = require("mineflayer");
|
const mineflayer = require("mineflayer");
|
||||||
// const { createGetAccessor } = require('typescript');
|
// const { createGetAccessor } = require('typescript');
|
||||||
|
|
||||||
const options = !isNaN(parseInt(process.argv[3])) && parseInt(process.argv[3]) > 1e2 ?
|
const bot =
|
||||||
{
|
!isNaN(parseInt(process.argv[3])) && parseInt(process.argv[3]) > 1e2 ?
|
||||||
host: process.argv[2] || process.env.MINECRAFT_HOST || env.MINECRAFT_HOST || 'localhost', // Change this to the ip you want.
|
mineflayer.createBot({
|
||||||
port: parseInt(process.argv[3]) || process.env.MINECRAFT_PORT || env.MINECRAFT_PORT // || 58471,
|
host: process.argv[2] || process.env.MINECRAFT_HOST || env.MINECRAFT_HOST || 'localhost', // Change this to the ip you want.
|
||||||
}
|
port: parseInt(process.argv[3]) || process.env.MINECRAFT_PORT || env.MINECRAFT_PORT // || 58471,
|
||||||
:
|
})
|
||||||
{
|
:
|
||||||
host: process.argv[2] || process.env.MINECRAFT_HOST || env.MINECRAFT_HOST || 'localhost', // Change this to the ip you want.
|
mineflayer.createBot({
|
||||||
username: process.argv[3] || process.env.MINECRAFT_USER || env.MINECRAFT_USER,
|
host: process.argv[2] || process.env.MINECRAFT_HOST || env.MINECRAFT_HOST || 'localhost', // Change this to the ip you want.
|
||||||
password: process.argv[4] || process.env.MINECRAFT_PASS || env.MINECRAFT_PASS,
|
username: process.argv[3] || process.env.MINECRAFT_USER || env.MINECRAFT_USER,
|
||||||
// port: process.argv[5] || process.env.MINECRAFT_PORT || 58471,
|
password: process.argv[4] || process.env.MINECRAFT_PASS || env.MINECRAFT_PASS,
|
||||||
}
|
// port: process.argv[5] || process.env.MINECRAFT_PORT || 58471,
|
||||||
|
})
|
||||||
const bot = mineflayer.createBot(options)
|
|
||||||
|
|
||||||
cfg.botOptions = options
|
|
||||||
|
|
||||||
|
|
||||||
let plugins = {}
|
let plugins = {}
|
||||||
|
|
|
@ -46,17 +46,7 @@ const events = {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
, chat: command
|
, chat: command
|
||||||
, kicked: function rejoin(reason, loggedIn) {
|
, kicked: (reason, loggedIn) => console.warn(reason, loggedIn)
|
||||||
console.warn(reason, loggedIn && "logged_in")
|
|
||||||
if (reason.extra && reason.extra[0].text === "Server closed") {
|
|
||||||
bot.quit()
|
|
||||||
bot.end()
|
|
||||||
// TODO implement all startup features (maybe refactor all into a single function / module?)
|
|
||||||
setTimeout((bot, cfg) => {
|
|
||||||
bot = mineflayer.createBot(cfg.botOptions)
|
|
||||||
}, 15 * 60 * 1000, bot, cfg);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const events_registered = []
|
const events_registered = []
|
||||||
|
@ -193,7 +183,7 @@ function command(username, message) {
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case "follow":
|
case "follow":
|
||||||
subcommand("go follow " + message_parts.slice(2).join(" "))
|
subcommand("go follow me")
|
||||||
break;
|
break;
|
||||||
case "come":
|
case "come":
|
||||||
subcommand("go follow once")
|
subcommand("go follow once")
|
||||||
|
|
Loading…
Reference in New Issue
Block a user