From 288b7045b6189cd89935446fd2ced6488e89a8b3 Mon Sep 17 00:00:00 2001 From: jay Date: Thu, 24 Dec 2020 21:39:50 +0500 Subject: [PATCH] feat: :sparkles: 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. --- lib/index.js | 1 + lib/plugins/informer.js | 22 ++++++++++++++++++++++ 2 files changed, 23 insertions(+) create mode 100644 lib/plugins/informer.js diff --git a/lib/index.js b/lib/index.js index 152e7bb..e056507 100644 --- a/lib/index.js +++ b/lib/index.js @@ -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'), diff --git a/lib/plugins/informer.js b/lib/plugins/informer.js new file mode 100644 index 0000000..6f3c79f --- /dev/null +++ b/lib/plugins/informer.js @@ -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 } \ No newline at end of file