@mousbros Why not use the depsoitBox API method open to open the depositbox?
Also to expand off what Agentcallooh said
if (getDepositBox().isOpen()) {
if (getDepositBox().depositAllExcept("Bronze pickaxe")) {
//sleep
}
} else if (getDepositBox().open()) {
//sleep till open
} else {
//walk to deposit box area
}
I would do it like this^ If the box is open it will go to the next if and only if that boolean returns true will it sleep. So it doesn't sleep for 10 seconds or whatever if the action failed. Continue to the else if statement, the API method will look and see if there is a deposit box nearby to attempt to open it. If it does it will then continue to the sleep or whatever you wanna do after. Else walk to the box.