Class BankAccount
java.lang.Object
com.palmergames.bukkit.towny.object.economy.Account
com.palmergames.bukkit.towny.object.economy.BankAccount
- All Implemented Interfaces:
Nameable
A variant of an
Account
that belongs to a Government
. When
that Government is a Town
, a system for going into debt is provided.-
Field Summary
Fields inherited from class com.palmergames.bukkit.towny.object.economy.Account
cachedBalance
-
Constructor Summary
ConstructorDescriptionBankAccount
(String name, org.bukkit.World world, Government government) Constructor for aGovernment
BankAccount. -
Method Summary
Modifier and TypeMethodDescriptionprotected boolean
addMoney
(double amount) boolean
canPayFromHoldings
(double amount) Does this object have enough in it's economy account to pay?double
Gets the maximum amount of money this account can have.double
The maximum amount of debt this account can have.double
getHoldingBalance
(boolean setCache) Gets the current balance of this account.Used To Get Balance of Players holdings in String format for printingboolean
Whether the account is in debt or not.void
Attempt to delete the economy account of a Town or Nation.void
setDebtCap
(double debtCap) Sets the maximum amount of debt this account can have.protected boolean
subtractMoney
(double amount) Methods inherited from class com.palmergames.bukkit.towny.object.economy.Account
addObserver, deposit, getAuditor, getBukkitWorld, getCachedBalance, getCachedBalance, getHoldingBalance, getName, getObservers, payFromServer, payTo, payTo, payToServer, removeObserver, setAuditor, setBalance, setName, withdraw
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface com.palmergames.bukkit.towny.object.Nameable
getFormattedName
-
Constructor Details
-
BankAccount
Constructor for aGovernment
BankAccount. Governments can be Towns or Nations.- Parameters:
name
- Name of theEconomyAccount
that will be used, ie: town-townname.world
- World that will be associated with this BankAccount.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 classAccount
-
addMoney
protected boolean addMoney(double amount) -
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 classAccount
- 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 classAccount
- Parameters:
setCache
- when True the account will have its cachedbalance set.- Returns:
- The amount in this account.
-
getHoldingFormattedBalance
Description copied from class:Account
Used To Get Balance of Players holdings in String format for printing- Overrides:
getHoldingFormattedBalance
in classAccount
- 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 classAccount
-
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.
-