Skip to content

Previous: ๆ–นๅ—ๆจกๅž‹ไฝœ็‰ฉ.mdใ€€ยทใ€€Next: ../04-ๅผ€ๅ‘่€…/็ปๆตŽAPI.md Related: ../02-ๆœไธปๆŒ‡ๅ—/็ปๆตŽๅŠจไฝœ.md ยท ../04-ๅผ€ๅ‘่€…/็ปๆตŽAPI.md ยท ../02-ๆœไธปๆŒ‡ๅ—/้…็ฝฎๆ–‡ไปถ.md

๐Ÿ’ฐ Economy Plugin Integration โ€‹

QCL uses EconomyBridge to integrate three economy backends in a unified way: Vault, ExcellentEconomy, and PlayerPoints. GUI economy actions and the economy API all go through this layer, so your higher-level config/code doesn't need to care which plugin is installed underneath.

๐Ÿ›Ÿ It also follows the soft-dependency + reflection-bridge pattern: at init it calls registerOptional in order, and only backends that are "installed and enabled" get registered. If a backend isn't installed it's skipped, and it never affects startup.


โš–๏ธ Three-Backend Comparison โ€‹

DimensionVaultExcellentEconomyPlayerPoints
provider idvaultexcellenteconomy (alias ee)playerpoints (alias pp)
Currency modelSingle currencyMulti-currency (money/gold/silverโ€ฆ)Single point currency
currency parameterIgnoredRequired on every operationIgnored
Offline playersโœ… SupportedโŒ Online onlyโœ… Supported
Data typeDoubleDoubleInteger (Double is rounded)
ImplementationObtains net.milkbowl.vault.economy.Economy via service registrationReflection on su.nightexpress.excellenteconomy.api.ExcellentEconomyAPIReflection on PlayerPoints.getInstance().getAPI()
Recommended useGeneral-purpose primary currency, best compatibility with other pluginsWhen you need multiple currencies (gold/silver/points split across accounts)Pure point/score systems

โš ๏ธ ExcellentEconomy's multi-currency is a double-edged sword: the upside is one plugin managing multiple currencies; the cost is that every balance operation must specify a currencyId (such as money, gold, silver), otherwise it reports CURRENCY_REQUIRED.

โš ๏ธ PlayerPoints is an integer system: any Double passed in is rounded. Don't expect fractional points.


๐Ÿงญ auto Provider-Selection Logic โ€‹

When economy.default-provider is set to auto (the default), QCL automatically picks a backend using these rules:

CaseSelection priority
currency specifiedPrefer ExcellentEconomy (since it's the only one supporting multi-currency)
No currency specifiedVault > ExcellentEconomy > PlayerPoints, returning the first available one
text
auto + with currency  โ†’  ExcellentEconomy preferred
auto + without currency โ†’  Vault โ–ถ ExcellentEconomy โ–ถ PlayerPoints (first available)

๐Ÿ’ก Have multiple economy plugins installed and want to force a specific one? Don't use auto; just hard-set default-provider to vault / ee / pp.


โš™๏ธ config Configuration โ€‹

Economy-related config lives in the main config (see ../02-ๆœไธปๆŒ‡ๅ—/้…็ฝฎๆ–‡ไปถ.md):

yaml
economy:
  # auto | vault | excellenteconomy(ee) | playerpoints(pp)
  default-provider: auto
  # Default currency id; only meaningful for backends that support multi-currency (ExcellentEconomy)
  default-currency: money
Config keyValuesDescription
economy.default-providerauto / vault / excellenteconomy / ee / playerpoints / ppWhich backend to use; for auto see the rules above
economy.default-currencycurrency id (default money)Used when currency isn't explicitly specified; ignored by single-currency backends

๐Ÿ“‹ Three Typical Setups โ€‹

yaml
# 1๏ธโƒฃ Vault only, single currency (most common)
economy:
  default-provider: vault
yaml
# 2๏ธโƒฃ Use ExcellentEconomy's multi-currency, with default currency set to gold
economy:
  default-provider: ee
  default-currency: gold
yaml
# 3๏ธโƒฃ Pure point-currency server
economy:
  default-provider: pp

๐Ÿ”ง EconomyProvider Capabilities โ€‹

Internally each backend implements the EconomyProvider interface, with consistent capabilities:

MethodPurpose
idBackend identifier (vault / excellenteconomy / playerpoints)
isAvailableWhether this backend is currently available
getBalance(...)Query balance
has(...)Whether there's enough balance
deposit(...)Deposit
withdraw(...)Withdraw
setBalance(...)Set balance directly

All operations return an EconomyTransactionResult:

FieldMeaning
successWhether it succeeded
messageHuman-readable message
codeResult code (e.g. CURRENCY_REQUIRED)
suggestionFix suggestion
providerThe backend that actually handled it

For how developers call these methods directly, see ๐Ÿ‘‰ ../04-ๅผ€ๅ‘่€…/็ปๆตŽAPI.md.


๐Ÿ–ฑ๏ธ Relationship to GUI Economy Actions โ€‹

The economy actions server owners use in the GUI โ€” give_money / take_money / set_money โ€” call the underlying deposit / withdraw / setBalance above. In other words:

text
GUI action give_money/take_money/set_money
        โ”‚
        โ–ผ
   EconomyBridge โ†’ selected EconomyProvider โ†’ the real economy plugin

For how to write an action's value (amount, currency, etc.), see ๐Ÿ‘‰ ../02-ๆœไธปๆŒ‡ๅ—/็ปๆตŽๅŠจไฝœ.md.


๐Ÿฉบ Diagnostics โ€‹

For economy-related issues, EconomyDiagnostics gives clear hints:

DiagnosticMeaning
unavailable()No economy backend available (none installed/enabled)
providerMissing(id)The plugin for the provider id you specified isn't installed
currencyMissing(id)The specified currency id doesn't exist (common with multi-currency backends)

Pair it with /qcl status detail to inspect the economy bridge status.


โ“ FAQ โ€‹

Q: Using ExcellentEconomy, operations report CURRENCY_REQUIRED? A: EE is a multi-currency backend, so every operation must carry a currency. Either specify it explicitly in the action/call, or set economy.default-currency to a valid currency (such as money).

Q: Points show decimals / the amounts don't add up? A: PlayerPoints is an integer system, so any Double passed in is rounded. Use Vault/EE if you need to keep decimals.

Q: Giving money to offline players fails? A: ExcellentEconomy only supports online players. To pay offline players, use Vault or PlayerPoints.

Q: I have several economy plugins installed โ€” which one does QCL use? A: In auto mode it follows the priority based on "with or without currency" (see above). To lock it down, hard-set default-provider to a specific id, and use /qcl status detail to confirm the provider actually hit.

Q: What happens if no economy plugin is installed at all? A: No economy backend is registered, and related operations return failure (unavailable()), but it doesn't affect QCL or other features starting up.


๐Ÿ“š Further Reading โ€‹