How to Handle Banking
Walking and opening the nearest bank
The client has a convenient method that will automatically walk to and open the nearest bank to the player:
@Override
public int onLoop() {
if (Bank.open()) {
// If this returns true, that means the bank is open and ready
// You can see other things you can do now below
} else {
// If this returns false, that means the client is still walking
// or interacting with the bank
return 500;
}
return 500;
}
This should work as long as your player is anywhere on our web walking nodes, if calling Bank#openClosest does nothing, you will need to manually walk to the bank.
Depositing Items
Once the bank is opened, you can deposit items by either their name (preferred) or ID like so:
Bank.deposit(995); // Both of these will deposit one coin
Bank.deposit("Coins");
Bank.deposit(995, 10); // Both of these will deposit 10 coins
Bank.deposit("Coins", 10);
Bank.depositAll(995); // Both of these will deposit all coins
Bank.depositAll("Coins");
Bank.depositAllItems(); // This will deposit everything in your inventory
Bank.depositAllEquipment(); // This will deposit all of your equipment
Withdrawing Items
You can also withdraw items using very similar methods:
Bank.withdraw(995); // Both of these will withdraw one coin
Bank.withdraw("Coins");
Bank.withdraw(995, 10); // Both of these will withdraw 10 coins
Bank.withdraw("Coins", 10);
Bank.withdrawAll(995); // Both of these will withdraw all coins
Bank.withdrawAll("Coins");