Skip to content

Commit 6953949

Browse files
banszkyyrom1504
andauthored
Fix infinity setTimeout by throwing error (#3561)
Co-authored-by: Romain Beaumont <romain.rom1@gmail.com>
1 parent e974e70 commit 6953949

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

lib/plugins/digging.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,11 @@ function inject (bot) {
2424
digFace = 'auto'
2525
}
2626

27+
const waitTime = bot.digTime(block)
28+
if (waitTime === Infinity) {
29+
throw new Error(`dig time for ${block?.name ?? block} is Infinity`)
30+
}
31+
2732
bot.targetDigFace = 1 // Default (top)
2833

2934
if (forceLook !== 'ignore') {
@@ -127,7 +132,6 @@ function inject (bot) {
127132
location: block.position,
128133
face: bot.targetDigFace // default face is 1 (top)
129134
})
130-
const waitTime = bot.digTime(block)
131135
waitTimeout = setTimeout(finishDigging, waitTime)
132136
bot.targetDigBlock = block
133137
bot.swingArm()

0 commit comments

Comments
 (0)