From 66e62ae721697aa3d144b5bfc1410b86ac07bfcb Mon Sep 17 00:00:00 2001 From: tastybento Date: Sat, 20 Jun 2026 16:26:16 -0700 Subject: [PATCH] fix: retry Vault hook before disabling Bank 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) --- RELEASE_NOTES_1.10.0.md | 69 +++++++++++++++++++++ src/main/java/world/bentobox/bank/Bank.java | 12 ++-- src/main/resources/addon.yml | 2 +- 3 files changed, 78 insertions(+), 5 deletions(-) create mode 100644 RELEASE_NOTES_1.10.0.md diff --git a/RELEASE_NOTES_1.10.0.md b/RELEASE_NOTES_1.10.0.md new file mode 100644 index 0000000..4680574 --- /dev/null +++ b/RELEASE_NOTES_1.10.0.md @@ -0,0 +1,69 @@ +## ๐ŸŽ What's new + +Bank 1.10.0 is a modernisation release. The addon now targets **Java 21, Paper 1.21.11 and BentoBox 3.14.0**, and its entire locale set has been migrated to BentoBox's modern **MiniMessage** colour format. Alongside the platform work, this release adds a brand-new `latest_transaction` placeholder, ships a full set of language files (including a new Russian translation), and rebuilds the test suite on JUnit 5 + MockBukkit. + +Because of the platform and locale-format changes, this is not a drop-in update โ€” please read the **Updating** notes below before installing. + +## โœจ Highlights + +### ๐Ÿ”บ Platform modernisation โ€” Java 21, Paper 1.21.11, BentoBox 3.14.0 (#65) +- Build upgraded to **Java 21**, **Paper 1.21.11** and **BentoBox 3.14.0** +- `plugin.yml` `api-version` bumped to **1.21** +- Test suite migrated to **JUnit 5 + MockBukkit** +- All Maven plugins updated to the latest stable versions and ~120 SonarCloud issues resolved (complexity, variable shadowing, test smells) + +### ๐Ÿ”ก ๐Ÿ”บ MiniMessage locale format (#64) +- All locale files converted from legacy `&`/`ยง` colour codes to BentoBox's **MiniMessage** format +- Aligns Bank with the rest of the 3.14.0 ecosystem and unlocks richer text formatting +- Any custom locale edits you've made will need to be re-expressed in MiniMessage syntax + +### ๐Ÿ”ก New transaction placeholder (#61) +- Adds `{gamemode}_latest_transaction`, showing a user's most recent island bank transaction +- Renders as `[Username] [TxType] $[Amount]` (e.g. `tastybento Deposited $500.0`) +- The placeholder text is fully localised + +### ๐Ÿ”ก Complete language coverage (#63) +- Adds a new **Russian** locale plus every other language file BentoBox ships, so Bank now matches the full BentoBox locale set (23 languages) + +### ๐Ÿ› Hardening +- Hardened bank transaction-history parsing against malformed entries (#66) +- Localised the latest-transaction placeholder fallback text (#66) +- Numerous code-quality and safety fixes flagged by static analysis (#66) + +## โš™๏ธ Compatibility + +โœ”๏ธ BentoBox API 3.14.0 +โœ”๏ธ Minecraft 1.21.5 - 26.1.x +โœ”๏ธ Java 21 + +## ๐Ÿ”บ Updating โ€” important notes + +๐Ÿ”บ **BentoBox 3.14.0 and Java 21 are required.** Update BentoBox first and make sure your server runs Java 21 before installing this version. + +๐Ÿ”ก ๐Ÿ”บ **Locale files were migrated to MiniMessage.** If you have customised any Bank language files, back them up and re-apply your changes in MiniMessage format. The simplest path is to delete the old locale files and let the addon regenerate them, then redo your edits. + +๐Ÿ”ก **New placeholder available.** `{gamemode}_latest_transaction` can be used wherever PlaceholderAPI placeholders are supported (e.g. scoreboards, holograms). + +## ๐Ÿ“ฅ How to update +1. Stop the server +2. Back up your BentoBox folder (especially any customised Bank locale files) +3. Update BentoBox to 3.14.0 and confirm the server is running Java 21 +4. Drop the new Bank jar into the `addons` folder and remove the old one +5. Start the server, then re-apply any custom locale edits in MiniMessage format +6. You should be good to go! + +## Legend + +* ๐Ÿ”ก locale files may need to be regenerated or updated +* โš™๏ธ config options have been removed, renamed, or added +* ๐Ÿ”บ special attention needed + +## What's Changed + +* ๐Ÿ”ก Add latest transaction placeholder by @tastybento in https://github.com/BentoBoxWorld/Bank/pull/61 +* ๐Ÿ”ก Add Russian locale and all missing BentoBox languages by @tastybento in https://github.com/BentoBoxWorld/Bank/pull/63 +* ๐Ÿ”ก ๐Ÿ”บ Convert locale color codes to MiniMessage format by @tastybento in https://github.com/BentoBoxWorld/Bank/pull/64 +* ๐Ÿ”บ Modernise to Java 21 / Paper 1.21.11 / BentoBox 3.14.0 by @tastybento in https://github.com/BentoBoxWorld/Bank/pull/65 +* ๐Ÿ”ก Release 1.10.0 โ€” harden history parsing, localise placeholder, code-quality fixes by @tastybento in https://github.com/BentoBoxWorld/Bank/pull/66 + +**Full Changelog**: https://github.com/BentoBoxWorld/Bank/compare/1.9.1...1.10.0 diff --git a/src/main/java/world/bentobox/bank/Bank.java b/src/main/java/world/bentobox/bank/Bank.java index 791446c..86d4f74 100644 --- a/src/main/java/world/bentobox/bank/Bank.java +++ b/src/main/java/world/bentobox/bank/Bank.java @@ -37,16 +37,20 @@ public class Bank extends Addon { public void onEnable() { // Register flag this.registerFlag(BANK_ACCESS); - // Vault hook + // Vault hook. BentoBox hooks Vault before addons enable, so if no economy plugin had + // registered an economy provider yet, that early hook failed and was discarded. An addon + // (e.g. InvSwitcher) can provide an economy during enable, so retry the hook before giving up. + if (getPlugin().getVault().isEmpty()) { + getPlugin().getHooks().registerHook(new VaultHook()); + } if (getPlugin().getVault().isEmpty()) { // Vault is required logError("Vault is required - disabling Bank - please install the Vault plugin"); this.setState(State.DISABLED); return; - } else { - // Get economy - vault = getPlugin().getVault().get(); } + // Get economy + vault = getPlugin().getVault().get(); saveDefaultConfig(); settings = config.loadConfigObject(); if (settings == null) { diff --git a/src/main/resources/addon.yml b/src/main/resources/addon.yml index 560fb9e..7c5c47c 100644 --- a/src/main/resources/addon.yml +++ b/src/main/resources/addon.yml @@ -6,7 +6,7 @@ api-version: 1.15.4 authors: tastybento -softdepend: AcidIsland, BSkyBlock, CaveBlock, SkyGrid, AOneBlock +softdepend: AcidIsland, BSkyBlock, CaveBlock, SkyGrid, AOneBlock, InvSwitcher permissions: '[gamemode].bank.user':