42 lines
845 B
JavaScript
42 lines
845 B
JavaScript
let cfg
|
|
let bot
|
|
let mcData
|
|
|
|
function block() {
|
|
const block = bot.blockAtCursor()
|
|
console.log(block)
|
|
let info = [block.type, block.name]
|
|
if (block.metadata) info.push(block.metadata)
|
|
cfg.quiet || bot.chat(info.join(": "))
|
|
}
|
|
|
|
function command(message_parts) {
|
|
switch (message_parts.length) {
|
|
case 0:
|
|
case 1:
|
|
switch (message_parts[0]) {
|
|
case "block":
|
|
default:
|
|
block()
|
|
break;
|
|
}
|
|
|
|
break;
|
|
|
|
default:
|
|
break;
|
|
}
|
|
}
|
|
|
|
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, command, block } |