diff --git a/lib/plugins/informer.js b/lib/plugins/informer.js index 091a36d..983ea38 100644 --- a/lib/plugins/informer.js +++ b/lib/plugins/informer.js @@ -7,7 +7,7 @@ function block(pos) { const block = pos ? bot.blockAt(v(pos)) : bot.blockAtCursor() console.log(block, block && block.getProperties()) if (!block) { - cfg.quiet || bot.chat("empty") + cfg.quiet || bot.chat("empty block") return block } let info = [block.type, block.name] @@ -21,6 +21,10 @@ function item( ) { const item = bot.inventory.slots[loc + bot.QUICK_BAR_START] console.log(item) + if (!item) { + cfg.quiet || bot.chat("no item") + return item + } let info = [item.type, item.name] if (item.metadata) info.push(item.metadata) cfg.quiet || bot.chat(info.join(": ")) @@ -31,6 +35,10 @@ function entity(name) { return name && entity.name ? entity.name == name : true }) console.log(entity) + if (!entity) { + cfg.quiet || bot.chat("no entity") + return entity + } let info = [entity.type, entity.name] if (entity.metadata) info.push("len: " + entity.metadata.length) cfg.quiet || bot.chat(info.join("; "))