fix(informer): 🥅 fix crash for block info when no block or an empty block is found

This commit is contained in:
jay 2021-01-17 12:20:49 +05:00
parent 67932b2f6a
commit 2601b7cfb1

View File

@ -5,6 +5,10 @@ let mcData
function block() { function block() {
const block = bot.blockAtCursor() const block = bot.blockAtCursor()
console.log(block) console.log(block)
if (!block) {
cfg.quiet || bot.chat("empty")
return block
}
let info = [block.type, block.name] let info = [block.type, block.name]
if (block.metadata) info.push(block.metadata) if (block.metadata) info.push(block.metadata)
cfg.quiet || bot.chat(info.join(": ")) cfg.quiet || bot.chat(info.join(": "))