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
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic @Nullable EconomyAdapter
static boolean
Add funds to an account.static boolean
Deprecated.static boolean
static Executor
static double
getBalance
(@NotNull Account account) Returns the accounts current balancestatic double
getBalance
(String accountName, org.bukkit.World world) Deprecated.since 0.100.4.6, usegetBalance(Account)
instead.static String
getFormattedBalance
(double balance) Format this balance according to the current economy systems settings.static EconomyProvider
static String
Deprecated.static @Nullable Account
getTownyObjectAccount
(String accountName) static @Nullable UUID
getTownyObjectUUID
(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.EcoType
getType()
static String
static boolean
hasAccount
(Account account) static boolean
hasAccount
(String accountName) Deprecated.since 0.100.4.6, usehasAccount(Account)
instead.static boolean
Returns true if the account has enough moneystatic boolean
Deprecated.since 0.100.4.6, usehasEnough(Account, double)
instead.static void
initialize
(Towny plugin) static boolean
isActive()
Are we using any economy system?static boolean
Deprecated.static UUID
modifyNPCUUID
(UUID uuid) static void
removeAccount
(Account account) Attempt to delete the economy account.static void
removeAccount
(String accountName) Deprecated.since 0.100.4.6, useremoveAccount(Account)
instead.static void
rename
(Government gov, String newName) static boolean
setBalance
(Account account, double amount) static boolean
setBalance
(String accountName, double amount, org.bukkit.World world) Deprecated.since 0.100.4.6, usesetBalance(Account, double)
instead.static boolean
Find and configure a suitable economy providerstatic boolean
Attempts to remove an amount from an accountstatic boolean
Deprecated.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. -
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.