Package fr.fuzeblocks.homeplugin.economy
Class EconomyManager
java.lang.Object
fr.fuzeblocks.homeplugin.economy.EconomyManager
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 Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic doubleRead a cost value from config.static doublestatic doublestatic doublestatic doublestatic booleanstatic booleanpay(org.bukkit.entity.Player player, double amount) Attempts to withdraw the given amount from the player's balance.static voidsetup(HomePlugin plugin) Initialize economy settings and cache config reference.
-
Constructor Details
-
EconomyManager
public EconomyManager()
-
-
Method Details
-
setup
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
Read a cost value from config.- Parameters:
key- config key suffix (appended toConfig.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
truewithout message. - If amount <= 0, returns
truewithout 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 chargeamount- the amount to withdraw- Returns:
trueif economy is disabled, the amount is <= 0, or the transaction succeeds;falseotherwise
- If economy is disabled (UseEconomy=false), returns
-