@@ -37,11 +37,19 @@ public void run() throws InterruptedException {
3737 if (!playerInBank ()) {
3838 walkToBank ();
3939 } else if (!isBankOpen ()) {
40- currentBankType = openBank ();
41- } else if (CONTINUE_BANK_INSTRUCTIONS_WIDGET .isVisible (getWidgets ())) {
42- CONTINUE_BANK_INSTRUCTIONS_WIDGET .interact (getWidgets (), "Continue" );
40+ openBank ();
4341 } else {
44- succeeded = bank (currentBankType );
42+ if (getBank () != null && getBank ().isOpen ()) {
43+ currentBankType = BankType .BANK ;
44+ } else {
45+ currentBankType = BankType .DEPOSIT_BOX ;
46+ }
47+
48+ if (CONTINUE_BANK_INSTRUCTIONS_WIDGET .isVisible (getWidgets ())) {
49+ CONTINUE_BANK_INSTRUCTIONS_WIDGET .interact (getWidgets (), "Continue" );
50+ } else {
51+ succeeded = bank (currentBankType );
52+ }
4553 }
4654 }
4755
@@ -60,6 +68,10 @@ private boolean walkToBank() {
6068 }
6169
6270 boolean isBankOpen () {
71+ if (useDepositBoxes && getBank () != null && getDepositBox () != null ) {
72+ return getBank ().isOpen () || getDepositBox ().isOpen ();
73+ }
74+
6375 if (getBank () != null ) {
6476 return getBank ().isOpen ();
6577 }
@@ -71,19 +83,16 @@ boolean isBankOpen() {
7183 return false ;
7284 }
7385
74- private BankType openBank () throws InterruptedException {
75- if (getBank () != null ) {
76- if (getBank ().open ()) {
77- Sleep .sleepUntil (() -> getBank ().isOpen (), 5000 );
78- }
79- return BankType .BANK ;
86+ private void openBank () throws InterruptedException {
87+ if (getBank () != null && getBank ().open ()) {
88+ Sleep .sleepUntil (() -> getBank ().isOpen (), 5000 );
89+ return ;
8090 }
8191
8292 if (useDepositBoxes && getDepositBox () != null ) {
8393 if (getDepositBox ().open ()) {
8494 Sleep .sleepUntil (() -> getDepositBox ().isOpen (), 5000 );
8595 }
86- return BankType .DEPOSIT_BOX ;
8796 }
8897
8998 throw new IllegalStateException ("Cannot open bank, no bank or deposit box found." );
0 commit comments