Skip to content

fix: retry Vault hook before disabling so addon-provided economies work#67

Merged
tastybento merged 1 commit into
developfrom
fix/retry-vault-hook
Jun 20, 2026
Merged

fix: retry Vault hook before disabling so addon-provided economies work#67
tastybento merged 1 commit into
developfrom
fix/retry-vault-hook

Conversation

@tastybento

Copy link
Copy Markdown
Member

Problem

BentoBox hooks Vault during its early-hook phase, before addons are enabled. If no economy plugin has registered a provider by then, that early hook fails and is discarded, so getPlugin().getVault() is empty.

When the economy is provided by an addon rather than a standalone plugin — e.g. InvSwitcher, which registers a per-world Vault Economy in its own onEnable() — Bank's onEnable checks getVault().isEmpty(), finds it empty, and disables itself with "Vault is required" even though a working per-world economy is available.

Fix

  • Retry the Vault hook before giving up. If getVault() is empty, call getPlugin().getHooks().registerHook(new VaultHook()) once, then re-check. An economy registered by an addon that enabled earlier is now picked up.
  • Add InvSwitcher as a softdepend so that, when present, InvSwitcher enables (and registers its economy provider) before Bank — making the ordering deterministic rather than relying on addon load order.

Pairs with BentoBoxWorld/BentoBox#2995 (which retries the hook after all addons enable). Either change alone helps; together they make addon-provided economies robust regardless of enable order.

🤖 Generated with Claude Code

BentoBox hooks Vault before addons enable, so if no economy plugin had
registered a provider yet, that early hook failed and was discarded. An
addon (e.g. InvSwitcher) can provide an economy during enable, so Bank
disabled itself even though a per-world economy was available.

Retry the Vault hook before giving up, and add InvSwitcher as a
softdepend so it enables (and registers its economy) before Bank.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@sonarqubecloud

Copy link
Copy Markdown

@tastybento tastybento merged commit 1265ca7 into develop Jun 20, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant