Class EconomyManager

java.lang.Object
fr.fuzeblocks.homeplugin.economy.EconomyManager

public class EconomyManager extends Object
Economy manager with a global toggle (Config.Economy.UseEconomy).
  • If disabled, payments are skipped silently (return true).
  • If amount <= 0, payments are skipped silently (return true).
  • Returns boolean instead of Vault's ResponseType for wider compatibility.
  • Constructor Details

    • EconomyManager

      public EconomyManager()
  • Method Details

    • setup

      public static void setup(HomePlugin plugin)
      Initialize economy settings and cache config reference.
      Parameters:
      plugin - the plugin instance
    • isEnabled

      public static boolean isEnabled()
      Returns:
      true if economy is enabled via config
    • getCost

      public static double getCost(String key, double defaultValue)
      Read a cost value from config.
      Parameters:
      key - config key suffix (appended to Config.Economy.)
      defaultValue - default value if config is missing
      Returns:
      the configured cost
    • getHomeCreationCost

      public static double getHomeCreationCost()
      Returns:
      home creation cost
    • getHomeTeleportPrice

      public static double getHomeTeleportPrice()
      Returns:
      home teleport price
    • getTpaRequestPrice

      public static double getTpaRequestPrice()
      Returns:
      TPA request price
    • getRtpPrice

      public static double getRtpPrice()
      Returns:
      RTP price
    • pay

      public static boolean pay(org.bukkit.entity.Player player, double amount)
      Attempts to withdraw the given amount from the player's balance. Behavior:
      • If economy is disabled (UseEconomy=false), returns true without message.
      • If amount <= 0, returns true without message.
      • If Vault is not present, sends an error message and returns false.
      • Otherwise performs a Vault withdrawal, sends a success/failure message and returns the result.
      Parameters:
      player - the player to charge
      amount - the amount to withdraw
      Returns:
      true if economy is disabled, the amount is <= 0, or the transaction succeeds; false otherwise