From 9b8ddbeaa411fdbf407632481e309aaf49b8c163 Mon Sep 17 00:00:00 2001 From: BB_pezsgo Date: Thu, 16 Jan 2025 15:32:04 +0100 Subject: [PATCH] Fix infinity setTimeout by throwing error --- lib/plugins/digging.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/lib/plugins/digging.js b/lib/plugins/digging.js index 39d3efbc5..496cf63e7 100644 --- a/lib/plugins/digging.js +++ b/lib/plugins/digging.js @@ -24,6 +24,11 @@ function inject (bot) { digFace = 'auto' } + const waitTime = bot.digTime(block) + if (waitTime === Infinity) { + throw new Error(`dig time for ${block?.name ?? block} is Infinity`) + } + bot.targetDigFace = 1 // Default (top) if (forceLook !== 'ignore') { @@ -127,7 +132,6 @@ function inject (bot) { location: block.position, face: bot.targetDigFace // default face is 1 (top) }) - const waitTime = bot.digTime(block) waitTimeout = setTimeout(finishDigging, waitTime) bot.targetDigBlock = block bot.swingArm()