Skip to content

Commit

Permalink
Fix infinity setTimeout by throwing error
Browse files Browse the repository at this point in the history
  • Loading branch information
BBpezsgo committed Jan 16, 2025
1 parent b8f5814 commit 9b8ddbe
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion lib/plugins/digging.js
Original file line number Diff line number Diff line change
Expand Up @@ -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') {
Expand Down Expand Up @@ -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()
Expand Down

0 comments on commit 9b8ddbe

Please sign in to comment.