2020-12-25 02:17:54 +00:00
|
|
|
let cfg
|
|
|
|
let bot
|
|
|
|
let mcData
|
|
|
|
|
2021-01-05 03:52:38 +00:00
|
|
|
function block() {
|
2020-12-25 02:17:54 +00:00
|
|
|
const block = bot.blockAtCursor()
|
|
|
|
console.log(block)
|
2021-01-05 04:20:35 +00:00
|
|
|
let info = [block.type, block.name]
|
|
|
|
if (block.metadata) info.push(block.metadata)
|
|
|
|
cfg.quiet || bot.chat(info.join(": "))
|
2020-12-25 02:17:54 +00:00
|
|
|
}
|
|
|
|
|
2021-01-05 06:32:33 +00:00
|
|
|
function command(message_parts) {
|
|
|
|
switch (message_parts.length) {
|
|
|
|
case 0:
|
|
|
|
case 1:
|
|
|
|
switch (message_parts[0]) {
|
|
|
|
case "block":
|
|
|
|
default:
|
|
|
|
block()
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-12-25 02:17:54 +00:00
|
|
|
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 = () => {}
|
|
|
|
|
2021-01-05 06:32:33 +00:00
|
|
|
module.exports = { load, unload, command, block }
|