feat: add informer plugin to show info

Data and information plugin.
Expose methods in mcData with acceptable ux.
Also central place for all kinds of debug features.
This commit is contained in:
jay 2020-12-24 21:39:50 +05:00
parent 94574a4296
commit 288b7045b6
2 changed files with 23 additions and 0 deletions

View File

@ -97,6 +97,7 @@ bot.once("spawn", () => {
command: require('./plugins/command'),
eater: require('./plugins/eater'),
inventory: require('./plugins/inventory'),
informer: require('./plugins/informer'),
finder: require('./plugins/finder'),
sleeper: require('./plugins/sleeper'),
armor: require('./plugins/armor'),

22
lib/plugins/informer.js Normal file
View File

@ -0,0 +1,22 @@
let cfg
let bot
let mcData
function info() {
const block = bot.blockAtCursor()
console.log(block)
cfg.quiet || bot.chat([block.id, block.name])
}
const load = (config) => {
cfg = config
bot = cfg.bot
cfg.info = {
quiet: cfg.quiet,
}
mcData = bot.mcData || (bot.mcData = require('minecraft-data')(bot.version))
}
const unload = () => {}
module.exports = { load, unload, info }