Class TownyEconomyHandler

java.lang.Object
com.palmergames.bukkit.towny.TownyEconomyHandler

public class TownyEconomyHandler extends Object
Economy handler to interface with Register or Vault directly.
Author:
ElgarL, Suneet Tipirneni (Siris)
  • Constructor Details

    • TownyEconomyHandler

      public TownyEconomyHandler()
  • Method Details

    • getServerAccount

      @Deprecated public static String getServerAccount()
      Deprecated.
    • getTownyObjectUUID

      @Nullable public 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.
      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

      @Nullable public static @Nullable Account getTownyObjectAccount(String accountName)
    • initialize

      public static void initialize(Towny plugin)
    • getType

      public static TownyEconomyHandler.EcoType 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

      public static String 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 public static void removeAccount(String accountName)
      Deprecated.
      since 0.100.4.6, use removeAccount(Account) instead.
      Parameters:
      accountName - legacy account name.
    • removeAccount

      public static void removeAccount(Account account)
      Attempt to delete the economy account.
      Parameters:
      account - account to delete
    • getBalance

      public static double getBalance(@NotNull @NotNull Account account)
      Returns the accounts current balance
      Parameters:
      account - The economy account
      Returns:
      double containing the total in the account
    • getBalance

      @Deprecated public static double getBalance(String accountName, org.bukkit.World world)
      Deprecated.
      since 0.100.4.6, use getBalance(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, use hasEnough(Account, double) instead.
      Parameters:
      accountName - legacy account name.
      amount - amount to test for.
      world - world
    • hasEnough

      public static boolean hasEnough(Account account, double amount)
      Returns true if the account has enough money
      Parameters:
      account - economy account
      amount - 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, use subtract(Account, double) instead.
      Parameters:
      accountName - legacy account name.
      amount - amount to remove.
      world - world
    • subtract

      public static boolean subtract(Account account, double amount)
      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 public static boolean add(String accountName, double amount, org.bukkit.World world)
      Deprecated.
      since 0.100.4.6, use add(Account, double) instead.
      Parameters:
      accountName - legacy account name.
      amount - amount to add.
      world - world
    • add

      public static boolean add(Account account, double amount)
      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, use setBalance(Account, double) instead.
      Parameters:
      accountName - legacy account name.
      amount - amount to set as a balance.
      world - world
    • setBalance

      public static boolean setBalance(Account account, double amount)
    • getFormattedBalance

      public static String getFormattedBalance(double balance)
      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

      public static boolean hasAccount(Account account)
    • hasAccount

      @Deprecated public static boolean hasAccount(String accountName)
      Deprecated.
      since 0.100.4.6, use hasAccount(Account) instead.
      Parameters:
      accountName - legacy account name.
    • isEssentials

      @Deprecated public static boolean isEssentials()
      Deprecated.
      since 0.100.4.6, with no replacement.
      Returns:
      true if the Server economy is Essentials Economy.
    • economyExecutor

      public static Executor economyExecutor()
      Returns:
      An executor that will schedule tasks on the right thread to respect TownySettings.isEconomyAsync()
    • getProvider

      @Internal public static EconomyProvider getProvider()
    • activeAdapter

      @Internal @Nullable public static @Nullable EconomyAdapter activeAdapter()
    • modifyNPCUUID

      @Internal public static UUID modifyNPCUUID(UUID uuid)
    • canRenameAccounts

      public static boolean canRenameAccounts()
    • rename

      public static void rename(Government gov, String newName)