@@ -37,11 +37,19 @@ public void run() throws InterruptedException {
37
37
if (!playerInBank ()) {
38
38
walkToBank ();
39
39
} 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 ();
43
41
} 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
+ }
45
53
}
46
54
}
47
55
@@ -60,6 +68,10 @@ private boolean walkToBank() {
60
68
}
61
69
62
70
boolean isBankOpen () {
71
+ if (useDepositBoxes && getBank () != null && getDepositBox () != null ) {
72
+ return getBank ().isOpen () || getDepositBox ().isOpen ();
73
+ }
74
+
63
75
if (getBank () != null ) {
64
76
return getBank ().isOpen ();
65
77
}
@@ -71,19 +83,16 @@ boolean isBankOpen() {
71
83
return false ;
72
84
}
73
85
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 ;
80
90
}
81
91
82
92
if (useDepositBoxes && getDepositBox () != null ) {
83
93
if (getDepositBox ().open ()) {
84
94
Sleep .sleepUntil (() -> getDepositBox ().isOpen (), 5000 );
85
95
}
86
- return BankType .DEPOSIT_BOX ;
87
96
}
88
97
89
98
throw new IllegalStateException ("Cannot open bank, no bank or deposit box found." );
0 commit comments