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 boolean
Add funds to an account.static boolean
addToServer
(double amount, org.bukkit.World world) Adds money to the server account (used for towny closed economy.)static Executor
static double
getBalance
(String accountName, org.bukkit.World world) Returns the accounts current balancestatic String
getFormattedBalance
(double balance) Format this balance according to the current economy systems settings.static String
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
(String accountName) static boolean
Returns true if the account has enough moneystatic void
initialize
(Towny plugin) static boolean
isActive()
Are we using any economy system?static boolean
static void
removeAccount
(String accountName) Attempt to delete the economy account.static boolean
setBalance
(String accountName, double amount, org.bukkit.World world) static boolean
Find and configure a suitable economy providerstatic boolean
Attempts to remove an amount from an accountstatic boolean
subtractFromServer
(double amount, org.bukkit.World world) Removes money to the server account (used for towny closed economy.)
-
Constructor Details
-
TownyEconomyHandler
public TownyEconomyHandler()
-
-
Method Details
-
getServerAccount
-
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.
-
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:
accountName
- name of the account to delete
-
getBalance
Returns the accounts current balance- Parameters:
accountName
- name of the economy accountworld
- name of world to check in (for TNE Reserve)- Returns:
- double containing the total in the account
-
hasEnough
Returns true if the account has enough money- Parameters:
accountName
- name of an economy accountamount
- minimum amount to check against (Double)world
- name of the world to check in (for TNE Reserve)- Returns:
- true if there is enough in the account
-
subtract
Attempts to remove an amount from an account- Parameters:
accountName
- name of the account to modifyamount
- amount of currency to remove from the accountworld
- name of the world in which to check in (TNE Reserve)- Returns:
- true if successful
-
add
Add funds to an account.- Parameters:
accountName
- account to add funds toamount
- amount of currency to addworld
- name of world (for TNE Reserve)- 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
-
addToServer
public static boolean addToServer(double amount, org.bukkit.World world) Adds money to the server account (used for towny closed economy.)- Parameters:
amount
- The amount to deposit.world
- The world of the deposit.- Returns:
- A boolean indicating success.
-
subtractFromServer
public static boolean subtractFromServer(double amount, org.bukkit.World world) Removes money to the server account (used for towny closed economy.)- Parameters:
amount
- The amount to withdraw.world
- The world of the withdraw.- Returns:
- A boolean indicating success.
-
hasAccount
-
isEssentials
public static boolean isEssentials() -
economyExecutor
- Returns:
- An executor that will schedule tasks on the right thread to respect
TownySettings.isEconomyAsync()
-