From 9a6e684b113291cb2c4b72329e01af81d75a61e9 Mon Sep 17 00:00:00 2001 From: jay Date: Sat, 16 Jan 2021 16:17:42 +0500 Subject: [PATCH] feat(informer): :sparkles: add info about nearest entities --- lib/plugins/informer.js | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/lib/plugins/informer.js b/lib/plugins/informer.js index 675cdd7..c49625e 100644 --- a/lib/plugins/informer.js +++ b/lib/plugins/informer.js @@ -21,6 +21,16 @@ function item( cfg.quiet || bot.chat(info.join(": ")) } +function entity(name) { + const entity = bot.nearestEntity((entity) => { + return name && entity.name ? entity.name == name : true + }) + console.log(entity) + let info = [entity.type, entity.name] + if (entity.metadata) info.push("len: " + entity.metadata.length) + cfg.quiet || bot.chat(info.join("; ")) +} + function command(message_parts) { switch (message_parts.length) { case 0: @@ -29,6 +39,9 @@ function command(message_parts) { case "item": item() break + case "entity": + entity() + break case "block": default: block() @@ -53,4 +66,4 @@ const load = (config) => { const unload = () => {} -module.exports = { load, unload, command, block, item } \ No newline at end of file +module.exports = { load, unload, command, block, item, entity } \ No newline at end of file