Class Eco

java.lang.Object
valorless.havenbags.hooks.Eco

public class Eco extends Object
Minimal wrapper around the active Vault economy provider.

This utility centralizes balance checks and withdrawals used by HavenBags features. The provider instance is resolved through VaultHook.getEconomy() during init() and then reused by the static helper methods in this class.

Call init() once during plugin startup before using canAfford(UUID, double) or takeMoney(UUID, double).

  • Constructor Summary

    Constructors
    Constructor
    Description
    Eco()
     
  • Method Summary

    Modifier and Type
    Method
    Description
    static Boolean
    canAfford(UUID player, double price)
    Checks whether a player has enough balance for a charge.
    static double
    getBalance(UUID player)
    Gets the current balance of a player.
    static void
    giveMoney(UUID player, double amount)
    Deposits funds to a player's account.
    static void
    Initializes the cached Vault economy provider.
    static void
    takeMoney(UUID player, double amount)
    Withdraws funds from a player's account.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • Eco

      public Eco()
  • Method Details

    • init

      public static void init()
      Initializes the cached Vault economy provider.
    • canAfford

      public static Boolean canAfford(UUID player, double price)
      Checks whether a player has enough balance for a charge.
      Parameters:
      player - the UUID of the player to check
      price - the amount that would be charged
      Returns:
      true when the player balance is greater than or equal to price
    • getBalance

      public static double getBalance(UUID player)
      Gets the current balance of a player.
      Parameters:
      player - the UUID of the player to check
      Returns:
      the player's current balance
    • takeMoney

      public static void takeMoney(UUID player, double amount)
      Withdraws funds from a player's account.
      Parameters:
      player - the UUID of the player to charge
      amount - the amount to withdraw
    • giveMoney

      public static void giveMoney(UUID player, double amount)
      Deposits funds to a player's account.
      Parameters:
      player - the UUID of the player to give
      amount - the amount to deposit