Skip to content

Modernise to BentoBox 3.14.0 / Paper / Java 21 and fix top ten panel#12

Merged
tastybento merged 6 commits into
developfrom
modernise-bentobox-3.14
Apr 26, 2026
Merged

Modernise to BentoBox 3.14.0 / Paper / Java 21 and fix top ten panel#12
tastybento merged 6 commits into
developfrom
modernise-bentobox-3.14

Conversation

@tastybento
Copy link
Copy Markdown
Member

Summary

  • Fix /<gamemode> topblock panel showing only fallback green panes — root cause was @EventHandler on a private method, which Bukkit silently skipped, so the refresh task never ran and topTen stayed empty
  • Modernise build: Java 17 → 21, Spigot → Paper 1.21.11, BentoBox 2.7.1 → 3.14.0, AOneBlock 1.12.3 → 1.18.0, drop PowerMock for JUnit 5 + MockBukkit
  • Strip dead code (commented-out WARP/VISIT/VIEW block in TopLevelPanel, unused ConversationUtils, unused helpers in Utils)
  • Replace the broken TopBlockManagerTest (failing with Cannot redefine singleton Server since Java 17) with three new test classes covering 22 cases

Test plan

  • mvn clean package succeeds (shaded jar + javadoc + sources)
  • mvn test — 22 tests pass across TopBlockTest, TopBlockManagerTest, PlaceholderManagerTest
  • Drop the built jar onto a 1.21.11 Paper server with BentoBox 3.14.0 + AOneBlock 1.18.0 and confirm /oneblock topblock shows player heads and per-island stats (count / lifetime / phase) the same way /oneblock top does for the Level addon

🤖 Generated with Claude Code

tastybento and others added 6 commits April 25, 2026 20:39
The @eventhandler on TopBlockManager.startMonitoring was declared
private, so Bukkit silently skipped it. BentoBoxReadyEvent never
fired the refresh task, the topTen list stayed empty, and the panel
only ever rendered fallback (LIME_STAINED_GLASS_PANE) items — no
player head, no stats. Renamed to public onBentoBoxReady.

Also removed dead code surfaced while diffing against the Level
addon: the large commented-out WARP/VISIT/VIEW block in
TopLevelPanel (TopBlock has no warp/visit hooks), the unused
ConversationUtils class, and the unused helpers in Utils
(sendMessage, getNextValue, getPreviousValue, prettifyObject,
prettifyDescription).

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
- Java 17 -> 21
- Spigot -> Paper 1.21.11-R0.1-SNAPSHOT
- BentoBox 2.7.1-SNAPSHOT -> 3.14.0-SNAPSHOT
- AOneBlock 1.12.3-SNAPSHOT -> 1.18.0
- Drop PowerMock; add JUnit 5 + MockBukkit + Mockito 5 deps
- Maven plugins refreshed (compiler 3.15.0 with fork=true,
  surefire 3.5.2, shade 3.6.0, jar 3.4.2, javadoc 3.11.2,
  source 3.3.1, install/deploy 3.1.3, jacoco 0.8.12)
- Add papermc, codemc-snapshots and jitpack repos; drop spigot repo
- Bump build.version to 2.0.0
- TopBlockPladdon: cache the Addon instance instead of building a
  fresh one on every getAddon() call
- Fix typo in plugin.yml api-version (`"1.21""` -> `"1.21"`)

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Replaces the old JUnit 4 + PowerMock TopBlockManagerTest (which had
been broken since the Java 17 migration with `Cannot redefine
singleton Server` errors) with a JUnit 5 + MockBukkit suite
following the CaveBlock pattern:

- CommonTestSetup: shared base wiring up Bukkit, BentoBox singleton,
  IslandWorldManager / IslandsManager / PlayersManager / Locales /
  Placeholders / Notifier / Hooks mocks
- WhiteBox: tiny reflective static-field setter for injecting the
  BentoBox singleton
- TestWorldSettings: minimal WorldSettings impl
- TopBlockTest: addon load / enable / disable / reload, with a
  synthesised in-memory addon.jar holding config.yml and
  panels/top_panel.yml
- TopBlockManagerTest: data flow through getOneBlockData and
  formatLevel (covers shorthand k / M / G branches)
- PlaceholderManagerTest: getMemberNames sort order and
  out-of-range rank handling
- mocks/ServerMocks.java removed (replaced by MockBukkit)

Total: 22 tests passing (TopBlock 6, TopBlockManager 13,
PlaceholderManager 3).

Also adds CLAUDE.md describing the addon's architecture and the
gotchas that were time-consuming to rediscover (Pladdon split,
private @eventhandler trap, locale resource filtering, surefire
--add-opens requirement).

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Adds the permission with default: true so every player is included
unless an admin removes it. Filtering is on the island owner only,
applied at refresh time in getOneBlockData. Offline owners always
pass — admins must remove the perm from a player who can actually
log in. README updated to describe the behaviour.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
- GitHub Actions: bump checkout/setup-java/cache to v4, switch to
  the temurin distribution (adopt is deprecated), and target
  Java 21 instead of Java 17. Drop the redundant
  -Dsonar.projectKey CLI flag — it's already set in pom.xml.
- README: fix the "level addon jar" copy/paste, document
  requirements (Paper 1.21, Java 21, BB 3.14.0, AOneBlock 1.18.0),
  add a config table for refresh-time and shorthand, document the
  /oneblock topblock alias, explain how a player gets into the top
  ten, document the topblock.icon.<MATERIAL> per-player override,
  and clarify placeholder behaviour past the available rank count.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
@tastybento tastybento merged commit eda4b21 into develop Apr 26, 2026
1 check failed
@tastybento tastybento deleted the modernise-bentobox-3.14 branch April 26, 2026 04:45
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