Skip to content

Release 1.10.0#66

Open
tastybento wants to merge 36 commits into
masterfrom
develop
Open

Release 1.10.0#66
tastybento wants to merge 36 commits into
masterfrom
develop

Conversation

@tastybento

Copy link
Copy Markdown
Member

No description provided.

Copilot AI and others added 19 commits March 28, 2026 18:43
Add a new placeholder `{gamemode}_latest_transaction` that displays
the most recent bank transaction for a user's island in the format
"[Username] [TxType] $[Amount]" (e.g., "tastybento Deposited $500.0").

- Add BankManager.getLatestHistory(Island) to retrieve latest transaction
- Register new placeholder in PhManager.registerPlaceholders()
- Add helper methods for formatting transaction display
- Add comprehensive unit tests for the new placeholder

Agent-Logs-Url: https://github.com/BentoBoxWorld/Bank/sessions/dbe38bf1-aeda-4c8e-94ee-b3201aaad055

Co-authored-by: tastybento <4407265+tastybento@users.noreply.github.com>
…ion-placeholder

Add latest transaction placeholder
Removed coverage badge from README.
- Reduce cognitive complexity in DepositCommand by extracting notifyMembers()
- Replace Stream.collect(Collectors.toList()) with Stream.toList() in BankManager
- Fix empty tearDown() and unnecessary throws in MoneyTest
- Use assertEquals/assertNotEquals instead of assertTrue/assertFalse in MoneyTest
- Remove commented-out code blocks in WithdrawCommandTest
- Rename shadowing local variable 'plugin' to 'pluginMock' in 9 test setUp() methods
- Remove ~100 unnecessary Mockito eq() wrappers across all test files

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Incorporate the Russian translation from issue #62 as ru.yml, sync the
two newer alert keys (bank.deposit.alert, bank.withdraw.alert) into
cs/de/ja, and add the 10 languages BentoBox supports that Bank was
missing: hr, hu, lv, nl, pl, pt-BR, pt, ro, tr, zh-HK.

Bank's locale set now matches BentoBox's 23-language set. All files
validated as YAML and confirmed in sync with en-US (55 keys each).

Closes #62

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Document build/test commands, architecture, dependencies, localization
(23-language set matching BentoBox), CI, and project layout for Claude
Code.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
…ales

Add Russian locale and all missing BentoBox languages
Modernise the build: bump java.version to 21, replace the Spigot API
with Paper 1.21.11, and target BentoBox 3.14.0-SNAPSHOT. Production
code compiles unchanged against the new API.

Swap the test stack from JUnit 4 + PowerMock to JUnit 5 + MockBukkit +
Mockito 5. Replace the Spigot repository with PaperMC and add the
codemc snapshots repository for MockBukkit. Add <fork>true</fork> to the
compiler plugin for Java 21.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Rewrite all 13 test classes (158 tests) from JUnit 4 + PowerMock to
JUnit 5 + MockBukkit + Mockito 5, preserving full coverage and the same
158 test cases.

Add shared MockBukkit infrastructure (WhiteBox, TestWorldSettings,
CommonTestSetup) adapted from the CaveBlock pattern. PowerMock static
mocking is replaced with Mockito inline static mocks (Bukkit, Util,
DatabaseSetup) and a real MockBukkit server. MoneyTest and PhManagerTest
run as standalone Mockito tests since they need no Bukkit server.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Match the Paper 1.21.11 / Java 21 target.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Replace all legacy ampersand color codes (&a, &c, &9, etc.) with their
MiniMessage tag equivalents (<green>, <red>, <blue>, ...) across the 12
locale files. BentoBox renders MiniMessage natively. 292 codes converted;
all files validated as YAML and rendering is unchanged (open tags apply
to the rest of the string, matching legacy semantics).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Convert locale color codes to MiniMessage format

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Release 1.10.0 modernizes the addon for the newer BentoBox/Paper ecosystem, refreshes localization formatting, and updates/expands the automated test suite to JUnit 5 with MockBukkit.

Changes:

  • Upgrade build/runtime targets (Java 21, Paper API, BentoBox dependency updates) and CI actions.
  • Migrate tests from JUnit 4/PowerMock to JUnit 5/Mockito + introduce shared CommonTestSetup.
  • Add a new placeholder for latest island transaction and add/refresh multiple locale files.

Reviewed changes

Copilot reviewed 47 out of 47 changed files in this pull request and generated 10 comments.

Show a summary per file
File Description
src/test/java/world/bentobox/bank/WhiteBox.java Adds small reflection helper for setting static fields in tests.
src/test/java/world/bentobox/bank/TestWorldSettings.java Adds minimal WorldSettings test implementation.
src/test/java/world/bentobox/bank/PhManagerTest.java Migrates tests to JUnit 5 and adds coverage for new latest-transaction placeholder.
src/test/java/world/bentobox/bank/data/MoneyTest.java Migrates Money tests to JUnit 5 assertions/exception style.
src/test/java/world/bentobox/bank/CommonTestSetup.java Introduces shared MockBukkit/Mockito static setup & teardown for tests.
src/test/java/world/bentobox/bank/commands/user/WithdrawCommandTest.java Migrates to JUnit 5 and uses CommonTestSetup.
src/test/java/world/bentobox/bank/commands/user/StatementCommandTest.java Migrates to JUnit 5 and uses CommonTestSetup.
src/test/java/world/bentobox/bank/commands/user/DepositCommandTest.java Migrates to JUnit 5 and uses CommonTestSetup.
src/test/java/world/bentobox/bank/commands/user/BalanceCommandTest.java Migrates to JUnit 5 and uses CommonTestSetup.
src/test/java/world/bentobox/bank/commands/admin/AdminTakeCommandTest.java Migrates to JUnit 5 and uses CommonTestSetup.
src/test/java/world/bentobox/bank/commands/admin/AdminStatementCommandTest.java Migrates to JUnit 5 and uses CommonTestSetup.
src/test/java/world/bentobox/bank/commands/admin/AdminSetCommandTest.java Migrates to JUnit 5 and uses CommonTestSetup.
src/test/java/world/bentobox/bank/commands/admin/AdminGiveCommandTest.java Migrates to JUnit 5 and uses CommonTestSetup.
src/test/java/world/bentobox/bank/commands/admin/AdminBalanceCommandTest.java Migrates to JUnit 5 and uses CommonTestSetup.
src/test/java/world/bentobox/bank/BankTest.java Updates addon lifecycle tests to JUnit 5 + new DB mocking approach.
src/test/java/world/bentobox/bank/BankManagerTest.java Updates manager tests to JUnit 5 + new DB mocking approach.
src/main/resources/plugin.yml Bumps Bukkit api-version to 1.21.
src/main/resources/locales/zh-HK.yml Adds new locale file.
src/main/resources/locales/zh-CN.yml Converts many messages to MiniMessage-style formatting.
src/main/resources/locales/vi.yml Converts many messages to MiniMessage-style formatting.
src/main/resources/locales/uk.yml Converts many messages to MiniMessage-style formatting.
src/main/resources/locales/tr.yml Adds new locale file.
src/main/resources/locales/ru.yml Adds new locale file.
src/main/resources/locales/ro.yml Adds new locale file.
src/main/resources/locales/pt.yml Adds new locale file.
src/main/resources/locales/pt-BR.yml Adds new locale file.
src/main/resources/locales/pl.yml Adds new locale file.
src/main/resources/locales/nl.yml Adds new locale file.
src/main/resources/locales/lv.yml Adds new locale file.
src/main/resources/locales/ko.yml Converts many messages to MiniMessage-style formatting.
src/main/resources/locales/ja.yml Converts many messages to MiniMessage-style formatting.
src/main/resources/locales/it.yml Converts many messages to MiniMessage-style formatting (has placeholder/text issues).
src/main/resources/locales/id.yml Converts many messages to MiniMessage-style formatting.
src/main/resources/locales/hu.yml Adds new locale file.
src/main/resources/locales/hr.yml Adds new locale file.
src/main/resources/locales/fr.yml Converts many messages to MiniMessage-style formatting.
src/main/resources/locales/es.yml Converts many messages to MiniMessage-style formatting.
src/main/resources/locales/en-US.yml Converts many messages to MiniMessage-style formatting (has a typo).
src/main/resources/locales/de.yml Converts many messages to MiniMessage-style formatting.
src/main/resources/locales/cs.yml Converts many messages to MiniMessage-style formatting.
src/main/java/world/bentobox/bank/PhManager.java Registers new *_latest_transaction placeholder and formats output.
src/main/java/world/bentobox/bank/commands/user/DepositCommand.java Extracts deposit alert logic into notifyMembers.
src/main/java/world/bentobox/bank/BankManager.java Adds getLatestHistory and modernizes getHistory list collection.
README.md Removes Sonar coverage badge.
pom.xml Updates Java level/dependencies (Paper, JUnit 5, Mockito, MockBukkit) and plugin versions.
CLAUDE.md Adds repo guidance doc (currently contains outdated build/test/dependency info).
.github/workflows/build.yml Updates GitHub Actions to v4 actions and keeps Java 21 build.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/main/java/world/bentobox/bank/BankManager.java
Comment thread src/main/java/world/bentobox/bank/PhManager.java Outdated
Comment thread src/main/java/world/bentobox/bank/commands/user/DepositCommand.java
Comment thread CLAUDE.md Outdated
Comment thread CLAUDE.md Outdated
Comment thread CLAUDE.md Outdated
Comment thread src/main/resources/locales/it.yml Outdated
Comment thread src/main/resources/locales/it.yml Outdated
Comment thread src/main/resources/locales/it.yml Outdated
Comment thread src/main/resources/locales/en-US.yml Outdated
tastybento and others added 8 commits June 12, 2026 17:15
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
tastybento and others added 2 commits June 12, 2026 17:19
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 47 out of 47 changed files in this pull request and generated 5 comments.

Comment thread src/main/java/world/bentobox/bank/PhManager.java
Comment thread src/main/java/world/bentobox/bank/BankManager.java Outdated
Comment thread pom.xml Outdated
Comment thread src/main/resources/locales/de.yml Outdated
Comment thread src/main/resources/locales/de.yml Outdated
tastybento and others added 6 commits June 12, 2026 18:27
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
A prior automated edit inlined the fully-qualified name
world.bentobox.bentobox.util.Util.getWorld(world), but the method
parameter `world` shadowed the package root, so the compiler parsed
`world.bentobox` as field access on the World variable and failed with
"cannot find symbol variable bentobox".

Revert to the original direct island lookup via getIsland(world, user),
which is what the getLatestTransaction tests expect. This fixes the
Jenkins compile failure and the 4 PhManagerTest errors (and their
cascading "Already mocking" failures) the broken Util call caused.

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

@tastybento tastybento left a comment

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review of Release 1.10.0 (PR #66)

Mostly a solid modernization (JUnit 5/MockBukkit migration, Java 21 / api-version 1.21 bump, locale fills, new _latest_transaction placeholder). Build + tests pass on develop. A few points on the new production code:

Main issue

  • The new _latest_transaction placeholder returns hardcoded, non-localized English (Deposited, Withdrew, Received, ...). Everything else in the addon is localized, and matching keys already exist in all 23 locale files (bank.statement.{deposit,withdrawal,interest,set,give,take,unknown}), used by StatementTab. The placeholder should reuse those via user.getTranslation(...).

Minor

  • BankManager.getLatestHistory() uses inline fully-qualified names and an unchecked cast to NavigableMap, and duplicates the entry-parsing logic from getHistory() (with a subtle split(":", 3) vs split(":") difference). Worth tidying.

See inline comments. I'll push fixes for these.

case TAKE -> "Lost";
case SET -> "Set";
case INTEREST -> "Earned";
default -> "Unknown";

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not localized. These display strings are hardcoded English, unlike the rest of the addon. Locale keys for transaction types already exist in all 23 locale files and are used by StatementTab (bank.statement.deposit, withdrawal, interest, set, give, take, unknown). Reuse them via user.getTranslation("bank.statement." + key) so the placeholder respects the player's language. This requires threading the User through formatTransaction/getTxTypeDisplay.

Map<Long, String> history = account.getHistory();
if (history.isEmpty()) return null;

java.util.Map.Entry<Long, String> latest = ((java.util.NavigableMap<Long, String>) history).lastEntry();

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Uses inline fully-qualified names (java.util.Map.Entry, java.util.NavigableMap) where the codebase convention is imports (Map.Entry is already imported here as Entry). The unchecked cast to NavigableMap only works because getHistory() happens to return a TreeMap — the declared return type is Map, so this is fragile if the backing type ever changes.

Long latestKey = latest.getKey();
String value = latest.getValue();

String[] split = value.split(":", 3);

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Entry-parsing here duplicates getHistory() above, with a subtle inconsistency: this uses split(":", 3) while getHistory() uses split(":"). Consider extracting a shared private parseEntry(Long, String) helper so both stay in sync.

…n history parsing

- PhManager: the _latest_transaction placeholder now localizes transaction
  type names via the existing bank.statement.* locale keys (reused from
  StatementTab) instead of returning hardcoded English. User is threaded
  through formatTransaction/getTxTypeDisplay.
- BankManager: extract shared parseEntry() helper so getHistory() and
  getLatestHistory() parse stored entries identically. getLatestHistory no
  longer casts the history Map to NavigableMap — that cast risked a
  ClassCastException when Gson deserializes the map from the database into a
  non-TreeMap; instead find the latest key via Collections.max.
- PhManagerTest: stub user.getTranslation for the statement keys and assert
  on the localized output.

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

Copy link
Copy Markdown
Member Author

Pushed 10ba0a7 addressing the review:

  • Localization_latest_transaction now resolves transaction-type names via the existing bank.statement.* locale keys (same ones StatementTab uses), so the placeholder respects the player's language instead of returning hardcoded English. User is threaded through formatTransaction/getTxTypeDisplay.
  • History parsing — extracted a shared parseEntry() helper so getHistory() and getLatestHistory() stay in sync, and dropped the NavigableMap cast. That cast would have risked a ClassCastException in production: when Gson loads the account from the database it doesn't necessarily reconstruct the Map as a TreeMap. getLatestHistory() now finds the most recent entry with Collections.max(keySet()), which is impl-agnostic.
  • Updated PhManagerTest to stub the translations and assert on localized output.

All 158 tests pass locally (mvn clean test).

@sonarqubecloud

Copy link
Copy Markdown

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.

3 participants