GrzybcioRynek

VaultHook

Vault Economy integration — balance, withdraw, deposit by UUID, sink account, and amount formatting.

Compatible with: GrzybcioRynek 1.0.3Minecraft 26.2Web 0.1.0

Based on GrzybcioRynek 1.0.3 and web 0.1.0 source.

VaultHook is required. Without the Vault plugin or without a RegisteredServiceProvider<Economy>, the plugin disables (after one retry in 1 s).

Startup

setupEconomy():

  1. getPlugin("Vault") == null → warning Vault nie znaleziono! Plugin nie będzie działać.enabled = false.
  2. ServicesManager.getRegistration(Economy.class) == nullNie znaleziono providera ekonomii!.
  3. Success: Pomyślnie połączono z Vault!.

isEnabled() = enabled && economy != null.

MarketPlace.onEnable on first fail logs Economy jeszcze niedostępna — ponawiam za 1s (Essentials/Vault)... and calls the constructor again after 20 ticks. Second fail: Vault nie znaleziono lub brak providera ekonomii! Wyłączanie pluginu.

plugin.yml: depend: [Vault], softdepend: [..., Essentials]. Essentials has no hook class — only late-load Economy timing.

Methods

MethodBehavior
getBalance(OfflinePlayer)economy.getBalance; when disabled → 0
has(OfflinePlayer, amount)economy.has after normalizeAmount
withdraw(OfflinePlayer, amount)withdrawPlayer; amount <= 0false
deposit(OfflinePlayer, amount)delegates to deposit(player, amount, null)
deposit(OfflinePlayer, amount, sellerName)only depositPlayer(player, amount) by UUID
depositAccount(String, amount)depositPlayer(accountName, amount) — fee sink
format(double)$123 or $123.45 (not Vault format)

Amounts are rounded: Math.round(amount * 100.0) / 100.0. Deposit <= 0 returns true (no-op).

No nickname fallback

depositToSeller only calls economy.depositPlayer(player, amount). When that fails, even with a valid sellerName:

text
Vault deposit po UUID nieudany dla <uuid> (<error>) — NIE używam fallbacku po nicku.

sellerName is only for logs (resolveTargetName). The value "Nieznany" is rejected as a name.

Fail withdraw/deposit/deposit-account:

text
Vault <type> nie powiodlo sie dla <target> (<amount>): <errorMessage>

type is withdraw, deposit, or deposit-account.

Fees and sink

ConfigManager.calculateSaleFee / calculateListingFee — percent, then minimum-fee, then maximum-fee when > 0. market-fee.enabled: false → both fees = 0.

After SELLER_PAID, if fee > 0 and market-fee.sink-account is non-empty: depositAccount(sink, fee). Fail does not roll back the purchase — only a warning:

text
Nie udało się wpłacić prowizji <fee> na konto sink '<sink>'.

Empty sink-account = the fee is burned (returned to nobody).

Format in PAPI and GUI

PlaceholderHook (total_spent, total_earned, market_volume) and market messages use VaultHook.format, not Vault’s native format.