Interface EconomyProvider

All Known Implementing Classes:
VaultEconomyProvider

@Internal public interface EconomyProvider
Internal economy-provider seam behind EconomyUtils.

Introduced by D-08/D-09 (#451, 6.3.0) as the fix for a total bootstrap crash: with Vault absent, UltiTools#getEconomy() used to be the only signature on the core class mentioning a net.milkbowl.vault type, and reflecting over that class's declared methods (done the instant the core plugin bean is registered) eagerly resolved that return type, throwing NoClassDefFoundError before a single module loaded. Removing that accessor broke the crash chain at the source; this interface is where the framework's economy reporting now lives instead, one layer removed from the core class.

@ApiStatus.Internal — not public API in 6.3.0. Its only implementation this release is the Vault consumer bridge (services.impl.VaultEconomyProvider). A public, multi-currency framework economy interface is scoped for 6.4.0 (D-09); shipping one now and reshaping it later would itself become a same-release-exception removal record, which this milestone's own "6.3.0 adds no features" boundary forbids. Do not widen this interface's visibility or add a second implementation without a fresh decision.

None of this interface's methods mention a Vault type in their own signature — every Vault reference in the sole implementation lives inside method bodies as local variables, never as a declared return or parameter type — so nothing here needs an allowlist entry in buildtools.SoftDependencySignatureInvariantTest's structural guard. EconomyUtils is the one class in this seam that keeps a genuine Vault-typed signature (its pre-existing public getEconomy(): net.milkbowl.vault.economy.Economy), because its own signatures are frozen for backward compatibility with the six modules that already call it — that is why EconomyUtils carries the allowlist entry instead.

Since:
6.3.0
Author:
wisdomme
  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Interface
    Description
    static enum 
    The three states an economy request can be in, named so the operator-facing message can distinguish them (D-08): a missing plugin is not the same problem as a missing provider.
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
    deposit(org.bukkit.OfflinePlayer player, double amount)
     
    format(double amount)
     
    double
    getBalance(org.bukkit.OfflinePlayer player)
     
     
     
    The active provider's display name, for the framework's start-up log line.
    The current state, re-evaluated on every call rather than cached — a provider can register (or Vault can be installed) after this framework has already started, since plugin load order is not guaranteed.
    boolean
    has(org.bukkit.OfflinePlayer player, double amount)
     
    boolean
    withdraw(org.bukkit.OfflinePlayer player, double amount)
     
  • Method Details

    • getState

      The current state, re-evaluated on every call rather than cached — a provider can register (or Vault can be installed) after this framework has already started, since plugin load order is not guaranteed.
      Returns:
      the current economy-availability state
    • getProviderName

      String getProviderName()
      The active provider's display name, for the framework's start-up log line.
      Returns:
      the provider's name, or null when getState() is not EconomyProvider.State.AVAILABLE
    • getBalance

      double getBalance(org.bukkit.OfflinePlayer player)
      Parameters:
      player - the player to query
      Returns:
      the player's balance, or 0 when unavailable
    • has

      boolean has(org.bukkit.OfflinePlayer player, double amount)
      Parameters:
      player - the player to query
      amount - the amount to check
      Returns:
      true if the player has at least amount, false when unavailable or insufficient
    • deposit

      boolean deposit(org.bukkit.OfflinePlayer player, double amount)
      Parameters:
      player - the player to credit
      amount - the amount to deposit
      Returns:
      true if the deposit succeeded
    • withdraw

      boolean withdraw(org.bukkit.OfflinePlayer player, double amount)
      Parameters:
      player - the player to debit
      amount - the amount to withdraw
      Returns:
      true if the withdrawal succeeded
    • format

      String format(double amount)
      Parameters:
      amount - the amount to format
      Returns:
      the provider's own formatted string, or a plain two-decimal fallback when unavailable
    • getCurrencyNameSingular

      String getCurrencyNameSingular()
      Returns:
      the provider's singular currency name, or a fallback when unavailable
    • getCurrencyNamePlural

      String getCurrencyNamePlural()
      Returns:
      the provider's plural currency name, or a fallback when unavailable