Package com.palmergames.bukkit.towny
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 booleanDeprecated.static booleanstatic Executorstatic doublegetBalance(@NotNull Account account) Returns the accounts current balancestatic doublegetBalance(String accountName, org.bukkit.World world) Deprecated.since 0.100.4.6, usegetBalance(Account)instead.static StringgetFormattedBalance(double balance) Format this balance according to the current economy systems settings.static EconomyProviderstatic StringDeprecated.static @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 booleanhasAccount(String accountName) Deprecated.since 0.100.4.6, usehasAccount(Account)instead.static booleanReturns true if the account has enough moneystatic booleanDeprecated.since 0.100.4.6, usehasEnough(Account, double)instead.static voidinitialize(Towny plugin) static booleanisActive()Are we using any economy system?static booleanDeprecated.since 0.100.4.6, with no replacement.static UUIDmodifyNPCUUID(UUID uuid) static voidremoveAccount(Account account) Attempt to delete the economy account.static voidremoveAccount(String accountName) Deprecated.since 0.100.4.6, useremoveAccount(Account)instead.static voidrename(Government gov, String newName) static booleansetBalance(Account account, double amount) static booleansetBalance(String accountName, double amount, org.bukkit.World world) Deprecated.since 0.100.4.6, usesetBalance(Account, double)instead.static booleanFind and configure a suitable economy providerstatic booleanAttempts to remove an amount from an accountstatic booleanDeprecated.since 0.100.4.6, usesubtract(Account, double)instead.
-
Constructor Details
-
TownyEconomyHandler
public TownyEconomyHandler()
-
-
Method Details
-
getServerAccount
Deprecated. -
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
Deprecated.since 0.100.4.6, useremoveAccount(Account)instead.- Parameters:
accountName- legacy account name.
-
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
-
getBalance
Deprecated.since 0.100.4.6, usegetBalance(Account)instead.- Parameters:
accountName- legacy account name.world- world.
-
hasEnough
@Deprecated public static boolean hasEnough(String accountName, double amount, org.bukkit.World world) Deprecated.since 0.100.4.6, usehasEnough(Account, double)instead.- Parameters:
accountName- legacy account name.amount- amount to test for.world- world
-
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
@Deprecated public static boolean subtract(String accountName, double amount, org.bukkit.World world) Deprecated.since 0.100.4.6, usesubtract(Account, double)instead.- Parameters:
accountName- legacy account name.amount- amount to remove.world- world
-
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
Deprecated.since 0.100.4.6, useadd(Account, double)instead.- Parameters:
accountName- legacy account name.amount- amount to add.world- world
-
add
Add funds to an account.- Parameters:
account- the Account receiving money.amount- amount of currency to add- Returns:
- true if successful
-
setBalance
@Deprecated public static boolean setBalance(String accountName, double amount, org.bukkit.World world) Deprecated.since 0.100.4.6, usesetBalance(Account, double)instead.- Parameters:
accountName- legacy account name.amount- amount to set as a balance.world- world
-
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
-
hasAccount
Deprecated.since 0.100.4.6, usehasAccount(Account)instead.- Parameters:
accountName- legacy account name.
-
isEssentials
Deprecated.since 0.100.4.6, with no replacement.- Returns:
- true if the Server economy is Essentials Economy.
-
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
-
add(Account, double)instead.