Class TownyEconomyHandler
java.lang.Object
com.palmergames.bukkit.towny.TownyEconomyHandler
Economy handler to interface with Register or Vault directly.
- Author:
- ElgarL, Suneet Tipirneni (Siris)
-
Nested Class Summary
Nested Classes -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic @Nullable EconomyAdapterstatic booleanAdd funds to an account.static booleanstatic Executorstatic doublegetBalance(@NotNull Account account) Returns the accounts current balancestatic StringgetFormattedBalance(double balance) Format this balance according to the current economy systems settings.static EconomyProviderstatic @Nullable AccountgetTownyObjectAccount(String accountName) static @Nullable UUIDgetTownyObjectUUID(String accountName) Method which can be used by Economy plugins in order to get a valid UUID from a Towny object, for use in making FakePlayer accounts.static TownyEconomyHandler.EcoTypegetType()static Stringstatic booleanhasAccount(Account account) static booleanReturns true if the account has enough moneystatic voidinitialize(Towny plugin) static booleanisActive()Are we using any economy system?static UUIDmodifyNPCUUID(UUID uuid) static voidremoveAccount(Account account) Attempt to delete the economy account.static voidrename(Government gov, String newName) static booleansetBalance(Account account, double amount) static booleanFind and configure a suitable economy providerstatic booleanAttempts to remove an amount from an account
-
Constructor Details
-
TownyEconomyHandler
public TownyEconomyHandler()
-
-
Method Details
-
getTownyObjectUUID
Method which can be used by Economy plugins in order to get a valid UUID from a Towny object, for use in making FakePlayer accounts.- Parameters:
accountName- String name which Towny uses when interacting with Vault's Economy class.- Returns:
- the TownyObject's UUID or null if no Towny Object could be resolved.
-
getTownyObjectAccount
-
initialize
-
getType
- Returns:
- the economy type we have detected.
-
isActive
public static boolean isActive()Are we using any economy system?- Returns:
- true if we found one.
-
getVersion
- Returns:
- The current economy providers version string
-
setupEconomy
public static boolean setupEconomy()Find and configure a suitable economy provider- Returns:
- true if successful.
-
removeAccount
Attempt to delete the economy account.- Parameters:
account- account to delete
-
getBalance
Returns the accounts current balance- Parameters:
account- The economy account- Returns:
- double containing the total in the account
-
hasEnough
Returns true if the account has enough money- Parameters:
account- economy accountamount- minimum amount to check against (Double)- Returns:
- true if there is enough in the account
-
subtract
Attempts to remove an amount from an account- Parameters:
account- the Account losing money.amount- amount of currency to remove from the account- Returns:
- true if successful
-
add
Add funds to an account.- Parameters:
account- the Account receiving money.amount- amount of currency to add- Returns:
- true if successful
-
setBalance
-
getFormattedBalance
Format this balance according to the current economy systems settings.- Parameters:
balance- account balance passed by the economy handler- Returns:
- string containing the formatted balance
-
hasAccount
-
economyExecutor
- Returns:
- An executor that will schedule tasks on the right thread to respect
TownySettings.isEconomyAsync()
-
getProvider
-
activeAdapter
-
modifyNPCUUID
-
canRenameAccounts
public static boolean canRenameAccounts() -
rename
-