Class BankAccount

java.lang.Object
com.palmergames.bukkit.towny.object.economy.Account
com.palmergames.bukkit.towny.object.economy.BankAccount
All Implemented Interfaces:
Identifiable, Nameable

public class BankAccount extends Account
A variant of an Account that belongs to a Government. When that Government is a Town, a system for going into debt is provided.
  • Constructor Details

    • BankAccount

      public BankAccount(String name, Government government)
      Constructor for a Government BankAccount. Governments can be Towns or Nations.
      Parameters:
      name - Name of the EconomyAccount that will be used, ie: town-townname.
      government - Town or Nation that is getting a BankAccount.
  • Method Details

    • getBalanceCap

      public double getBalanceCap()
      Gets the maximum amount of money this account can have.
      Returns:
      the max amount allowed in this account.
    • subtractMoney

      protected boolean subtractMoney(double amount)
      Specified by:
      subtractMoney in class Account
    • addMoney

      protected boolean addMoney(double amount)
      Specified by:
      addMoney in class Account
    • canPayFromHoldings

      public boolean canPayFromHoldings(double amount)
      Description copied from class: Account
      Does this object have enough in it's economy account to pay?
      Overrides:
      canPayFromHoldings in class Account
      Parameters:
      amount - currency to check for
      Returns:
      true if there is enough.
    • getHoldingBalance

      public double getHoldingBalance(boolean setCache)
      Description copied from class: Account
      Gets the current balance of this account.
      Overrides:
      getHoldingBalance in class Account
      Parameters:
      setCache - when True the account will have its cachedbalance set.
      Returns:
      The amount in this account.
    • getHoldingFormattedBalance

      public String getHoldingFormattedBalance()
      Description copied from class: Account
      Used To Get Balance of Players holdings in String format for printing
      Overrides:
      getHoldingFormattedBalance in class Account
      Returns:
      current account balance formatted in a string.
    • removeAccount

      public void removeAccount()
      Attempt to delete the economy account of a Town or Nation.
      Overrides:
      removeAccount in class Account
    • isBankrupt

      public boolean isBankrupt()
      Whether the account is in debt or not.
      Returns:
      true if in debt, false otherwise.
    • getDebtCap

      public double getDebtCap()
      The maximum amount of debt this account can have. Can be overriden by the config debt_cap override. Can be overriden by the config debt_cap maximum.
      Returns:
      The max amount of debt for this account.
    • setDebtCap

      public void setDebtCap(double debtCap)
      Sets the maximum amount of debt this account can have.
      Parameters:
      debtCap - The new cap for debt on this account.