Skip to main content
The IslandBank interface provides methods for managing an island’s bank account, including deposits, withdrawals, and transaction history.

Getting the Island Bank

import com.bgsoftware.superiorskyblock.api.island.Island;
import com.bgsoftware.superiorskyblock.api.island.bank.IslandBank;

public IslandBank getBank(Island island) {
    return island.getIslandBank();
}

Balance Management

getBalance()

Get the current balance in the bank.
returns
BigDecimal
The current bank balance
IslandBank bank = island.getIslandBank();
BigDecimal balance = bank.getBalance();

setBalance(BigDecimal balance)

Set the balance in the bank. This does not create transaction records and is primarily used for loading data from the database.
balance
BigDecimal
required
The balance to set
bank.setBalance(new BigDecimal("10000"));

Deposits

depositMoney(SuperiorPlayer superiorPlayer, BigDecimal amount)

Deposit money into the bank from a player’s account.
superiorPlayer
SuperiorPlayer
required
The player depositing the money
amount
BigDecimal
required
The amount to deposit
returns
BankTransaction
The transaction details
import com.bgsoftware.superiorskyblock.api.island.bank.BankTransaction;
import java.math.BigDecimal;

BankTransaction transaction = bank.depositMoney(
    superiorPlayer, 
    new BigDecimal("1000")
);

depositAdminMoney(CommandSender commandSender, BigDecimal amount)

Deposit money into the bank without taking it from any player’s account. This is an admin command that creates money.
commandSender
CommandSender
required
The command sender performing the deposit (typically console or admin)
amount
BigDecimal
required
The amount to deposit
returns
BankTransaction
The transaction details
BankTransaction adminDeposit = bank.depositAdminMoney(
    Bukkit.getConsoleSender(), 
    new BigDecimal("5000")
);

canDepositMoney(BigDecimal amount)

Check if it’s possible to deposit money without exceeding the bank limit.
amount
BigDecimal
required
The amount to check
returns
boolean
True if the deposit is allowed
BigDecimal depositAmount = new BigDecimal("10000");
if (bank.canDepositMoney(depositAmount)) {
    bank.depositMoney(superiorPlayer, depositAmount);
} else {
    // Bank limit would be exceeded
}

Withdrawals

withdrawMoney(SuperiorPlayer superiorPlayer, BigDecimal amount, List<String> commandsToExecute)

Withdraw money from the bank and give it to a player.
superiorPlayer
SuperiorPlayer
required
The player withdrawing the money
amount
BigDecimal
required
The amount to withdraw
commandsToExecute
List<String>
Optional commands to execute instead of using the default economy provider. Use for player name and for amount
returns
BankTransaction
The transaction details
// Standard withdrawal using economy provider
BankTransaction withdrawal = bank.withdrawMoney(
    superiorPlayer, 
    new BigDecimal("500"),
    null
);

// Withdrawal with custom commands
List<String> commands = Arrays.asList(
    "give {0} diamond {1}"
);
BankTransaction customWithdrawal = bank.withdrawMoney(
    superiorPlayer,
    new BigDecimal("100"),
    commands
);

withdrawAdminMoney(CommandSender commandSender, BigDecimal amount)

Withdraw money from the bank without giving it to any player. This is an admin command that removes money.
commandSender
CommandSender
required
The command sender performing the withdrawal (typically console or admin)
amount
BigDecimal
required
The amount to withdraw
returns
BankTransaction
The transaction details
BankTransaction adminWithdrawal = bank.withdrawAdminMoney(
    Bukkit.getConsoleSender(),
    new BigDecimal("2000")
);

Transaction History

getAllTransactions()

Get all transactions of the bank, sorted by creation time.
returns
List<BankTransaction>
List of all bank transactions
List<BankTransaction> allTransactions = bank.getAllTransactions();
for (BankTransaction transaction : allTransactions) {
    // Process transaction
}

getTransactions(SuperiorPlayer superiorPlayer)

Get all transactions made by a specific player.
superiorPlayer
SuperiorPlayer
required
The player whose transactions to retrieve
returns
List<BankTransaction>
List of transactions by the player
List<BankTransaction> playerTransactions = bank.getTransactions(superiorPlayer);

getConsoleTransactions()

Get all transactions made by CONSOLE (admin commands).
returns
List<BankTransaction>
List of console transactions
List<BankTransaction> consoleTransactions = bank.getConsoleTransactions();

loadTransaction(BankTransaction bankTransaction)

Load a transaction log. This is used internally to load transactions from the database.
bankTransaction
BankTransaction
required
The transaction object to load

Bank Limits

Bank limits are managed at the Island level:
// Get bank limit
BigDecimal limit = island.getBankLimit();

// Set bank limit (-1 for unlimited)
island.setBankLimit(new BigDecimal("100000"));

// Get raw bank limit (set via command)
BigDecimal rawLimit = island.getBankLimitRaw();

Bank Interest

The island also manages bank interest:
// Give bank interest
boolean interestGiven = island.giveInterest(true);

// Get last interest time
long lastInterest = island.getLastInterestTime();

// Set last interest time
island.setLastInterestTime(System.currentTimeMillis());

// Get next interest time in seconds
long nextInterest = island.getNextInterest();

Example: Complete Bank Transaction

import com.bgsoftware.superiorskyblock.api.island.Island;
import com.bgsoftware.superiorskyblock.api.island.bank.IslandBank;
import com.bgsoftware.superiorskyblock.api.island.bank.BankTransaction;
import com.bgsoftware.superiorskyblock.api.wrappers.SuperiorPlayer;
import java.math.BigDecimal;

public void handleBankDeposit(Island island, SuperiorPlayer player, double amount) {
    IslandBank bank = island.getIslandBank();
    BigDecimal depositAmount = BigDecimal.valueOf(amount);
    
    // Check if deposit is allowed
    if (!bank.canDepositMoney(depositAmount)) {
        player.asPlayer().sendMessage("Bank limit would be exceeded!");
        return;
    }
    
    // Perform deposit
    BankTransaction transaction = bank.depositMoney(player, depositAmount);
    
    // Notify player
    player.asPlayer().sendMessage(
        "Deposited $" + amount + ". New balance: $" + bank.getBalance()
    );
}