|
|
|
@ -1,6 +1,6 @@ |
|
|
|
|
|
|
|
|
|
const pathfinder = require('mineflayer-pathfinder').pathfinder |
|
|
|
|
const { Bot } = require('mineflayer') |
|
|
|
|
let pathfinder |
|
|
|
|
//TODO replace with simple pathfinder motions
|
|
|
|
|
const { |
|
|
|
|
gameplay, |
|
|
|
|
MoveTo, |
|
|
|
@ -71,6 +71,7 @@ function sleep(quiet) { |
|
|
|
|
) |
|
|
|
|
// bot.chat('/afk')
|
|
|
|
|
} |
|
|
|
|
bot.pathfinder.movements |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
function wake() { |
|
|
|
@ -86,7 +87,7 @@ function wake() { |
|
|
|
|
function autoSleep() { |
|
|
|
|
if (!bot.time.isDay && !cfg.sleep.timeoutFn && cfg.sleep.auto && !bot.isSleeping) { |
|
|
|
|
sleep() |
|
|
|
|
cfg.sleep.timeoutFn = setTimeout(() => { cfg.sleep.timeoutFn = null }, cfg.sleep.timeout) // give 2 seconds for multiple events
|
|
|
|
|
cfg.sleep.timeoutFn = setTimeout(() => { cfg.sleep.timeoutFn = null }, cfg.sleep.timeout) |
|
|
|
|
console.log("sleeping?", bot.isSleeping, bot.time) |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
@ -98,10 +99,11 @@ const load = (config) => { |
|
|
|
|
auto: true, |
|
|
|
|
// timeout: 30 * 1000,
|
|
|
|
|
timeout: 2 * 60 * 1000, |
|
|
|
|
quiet: false |
|
|
|
|
quiet: !!cfg.quiet |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
bot.loadPlugin(pathfinder) |
|
|
|
|
pathfinder = bot.pathfinder || require('mineflayer-pathfinder').pathfinder |
|
|
|
|
// bot.loadPlugin(pathfinder)
|
|
|
|
|
bot.loadPlugin(gameplay) |
|
|
|
|
inv = cfg.plugins["inventory"] |
|
|
|
|
bot.on("time", autoSleep) |
|
|
|
|