Skip to main content

SimpleEconomy Hooks

How to integrate your plugin with Vault 2.1.0’s native API by directly accessing the provider via VaultPlugin.getEconomyProvider().

Get the Provider from VaultPlugin

The most direct and fastest way:

Detection Flowchart

Complete Plugin Example

Advantages of Direct Hook (SimpleEconomy)

Extend: Access Internal Services

If your plugin hard-depends on Vault 2.1.0 you can access other services:

Example Shop Command

Fallback to Legacy Vault 1.x

If you must support both (1.x and 2.x):

Detect Vault Version at Runtime

Precautions

  • ✅ Call getEconomyProvider() only once in onEnable and store the reference in a field.
  • ⚠ Do not call Bukkit.getServicesManager().getRegistration(...) every tick.
  • ⚠ In soft-depend plugins always validate that the provider is instanceof SimpleEconomy before casting.
  • ✅ Use a PluginLoader that waits for Vault to be fully enabled if using WorldGuard/ProtocolLib.