Use Vault Economy API for winner money rewards instead of eco console commands
Build / build (push) Successful in 1m16s

This commit is contained in:
Michael Burgess
2026-08-07 09:32:24 -04:00
parent 86f118f9e6
commit 3a87afd3c8
7 changed files with 123 additions and 8 deletions
+20 -4
View File
@@ -171,14 +171,30 @@ the new configuration the next time they return to `WAITING`.
```yaml
rewards:
winner:
money: 100
commands:
- "eco give %player% 100"
- "give %player% diamond 3"
- "say %player% won BlockParty in %arena% after %round% rounds!"
integrations:
vault: true
```
Commands run as the console, so no Vault/economy plugin is required by BlockParty itself —
if you reference an economy command (like `eco give`) you need that plugin installed
separately. `%player%`, `%arena%` and `%round%` are replaced before dispatch.
Two independent reward mechanisms fire on a win, both optional:
- **`money`** is deposited straight into the winner's balance through the
[Vault](https://www.spigotmc.org/resources/vault.34315/) Economy API — no console command
string parsing involved. This requires Vault **and** an economy plugin that registers a
Vault `Economy` provider (e.g. EssentialsX, CMI). If Vault or an economy provider isn't
present, BlockParty logs one warning and simply skips the money portion — it never crashes
and console-command rewards still run normally. Set `money: 0` to disable this entirely, or
`integrations.vault: false` to force-disable it even with Vault installed.
- **`commands`** run as the console with `%player%`, `%arena%` and `%round%` substituted, for
anything beyond currency (items, permissions, external plugin hooks, announcements, etc.).
Vault is declared as a `softdepend` in `plugin.yml`, so BlockParty starts up fine whether or
not it's installed; the Economy service lookup happens fresh each time a reward is dispatched
(not cached at startup), so plugin load order relative to your economy plugin doesn't matter.
## Statistics storage