From 6d68fa18e4f9524fa72870d83288fd2e7c40e6b1 Mon Sep 17 00:00:00 2001 From: ChomeNS Date: Wed, 17 Aug 2022 17:24:54 +0700 Subject: [PATCH] auto refill core ON BREAK + better self_care --- index.js | 2 +- plugins/core.js | 4 ++++ plugins/self_care.js | 6 +++++- 3 files changed, 10 insertions(+), 2 deletions(-) diff --git a/index.js b/index.js index 2edb3fd..fa04fc9 100644 --- a/index.js +++ b/index.js @@ -169,7 +169,7 @@ function main() { } catch (e) { return; } - }, 500); + }, 400); module.exports = function() { return bot; diff --git a/plugins/core.js b/plugins/core.js index 9df4e35..5b906d9 100644 --- a/plugins/core.js +++ b/plugins/core.js @@ -63,6 +63,10 @@ function inject(bot) { bot.emit('position', position); }); + bot._client.on('block_change', (packet) => { + if (core.isCore(packet.location) && packet.type===0) fillCore(); + }); + bot.on('position', fillCore); fillCore(); diff --git a/plugins/self_care.js b/plugins/self_care.js index 2bf20b6..679aa4e 100644 --- a/plugins/self_care.js +++ b/plugins/self_care.js @@ -54,7 +54,7 @@ function inject(bot) { gameMode = data.gameMode; }); - setInterval(() => { + const interval = setInterval(() => { if (!op) { bot.chat('/minecraft:op @s[type=player]'); return; @@ -66,6 +66,10 @@ function inject(bot) { if (!prefix) bot.chat('/extras:prefix &8[&eChomeNS Bot&8]'); if (muted) bot.chat('/essentials:mute ' + bot.uuid); }, 2000); + + bot.once('end', () => { + clearInterval(interval); + }); } module.exports = {inject};