Interface EconomyProvider
- All Known Implementing Classes:
VaultEconomyProvider
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 ClassesModifier and TypeInterfaceDescriptionstatic enumThe 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 TypeMethodDescriptionbooleandeposit(org.bukkit.OfflinePlayer player, double amount) format(double amount) doublegetBalance(org.bukkit.OfflinePlayer player) The active provider's display name, for the framework's start-up log line.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.booleanhas(org.bukkit.OfflinePlayer player, double amount) booleanwithdraw(org.bukkit.OfflinePlayer player, double amount)
-
Method Details
-
getState
EconomyProvider.State 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
nullwhengetState()is notEconomyProvider.State.AVAILABLE
-
getBalance
double getBalance(org.bukkit.OfflinePlayer player) - Parameters:
player- the player to query- Returns:
- the player's balance, or
0when unavailable
-
has
boolean has(org.bukkit.OfflinePlayer player, double amount) - Parameters:
player- the player to queryamount- the amount to check- Returns:
trueif the player has at leastamount,falsewhen unavailable or insufficient
-
deposit
boolean deposit(org.bukkit.OfflinePlayer player, double amount) - Parameters:
player- the player to creditamount- the amount to deposit- Returns:
trueif the deposit succeeded
-
withdraw
boolean withdraw(org.bukkit.OfflinePlayer player, double amount) - Parameters:
player- the player to debitamount- the amount to withdraw- Returns:
trueif the withdrawal succeeded
-
format
- 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
-