Skip to content

Add ChunkBlock support alongside AOneBlock - #14

Merged
tastybento merged 1 commit into
developfrom
chunkblock-support
Aug 8, 2026
Merged

Add ChunkBlock support alongside AOneBlock#14
tastybento merged 1 commit into
developfrom
chunkblock-support

Conversation

@tastybento

Copy link
Copy Markdown
Member

Summary

TopBlock now works with AOneBlock, ChunkBlock (1.0.1), or both — each hooked game mode gets its own independent top ten, topblock subcommand, and placeholder set.

How

  • New hooks package: TopBlockHook interface (getGameMode(), getAllIslandData() returning neutral IslandBlockData records, getPhaseCount()) with AOneBlockHook and ChunkBlockHook implementations. The two game modes have twin APIs in unrelated packages, so these hook classes are the only place game-mode packages are imported — a game mode that isn't installed is never class-loaded.
  • TopBlock.onEnable hooks each supported game mode that is present, enabled, and a GameModeAddon, registering the topblock subcommand on each one's player command. It disables itself only when neither game mode is found.
  • TopBlockManager keeps a top ten list per hook (Map<TopBlockHook, List<TopTenData>>); the refresh task updates all of them. The panel shows the ranking of whichever game mode owns the command's world.
  • PlaceholderManager registers island_*_top_<1..10> once per hook, scoped to that hook's addon — so %aoneblock_island_count_top_1% and %chunkblock_island_count_top_1% are automatically separate.
  • addon.yml: depend: AOneBlocksoftdepend: AOneBlock, ChunkBlock; adds chunkblock.island.topblock and chunkblock.intopten permissions mirroring the aoneblock ones.
  • pom.xml: adds world.bentobox:chunkblock:1.0.1 (provided) and world.bentobox:level:2.6.2 (test scope only — Mockito can't mock ChunkBlock without its hard dependency Level on the classpath).

Tests

43 tests, all passing:

  • Hook selection: AOneBlock only / ChunkBlock only / both / neither (disables), disabled game mode skipped, world → hook resolution.
  • Per-hook top ten separation and refresh behaviour.
  • Per-game-mode placeholder registration (60 registrations verified against the game mode addon).
  • AOneBlockHookTest / ChunkBlockHookTest cover field mapping and phase counting against the real game-mode classes.

Note: the enable-path tests now call setState(State.LOADED) before onEnable() — a freshly constructed Addon starts DISABLED and only AddonsManager sets ENABLED, so the old no-game-mode test was passing trivially.

🤖 Generated with Claude Code

https://claude.ai/code/session_01UtAC44orba7UkTpFwHEw22

TopBlock now hooks into AOneBlock, ChunkBlock, or both, keeping a
separate top ten, command, and placeholder set per game mode.

- New hooks package: TopBlockHook interface with AOneBlockHook and
  ChunkBlockHook implementations. These are the only classes that
  reference their game mode's packages, so a game mode that is not
  installed is never class-loaded.
- TopBlock.onEnable hooks each supported game mode that is present and
  enabled, registering a topblock subcommand on each player command;
  it disables itself only if neither game mode is found.
- TopBlockManager keeps one top ten list per hook; the refresh task
  updates all of them.
- PlaceholderManager registers island_*_top_1..10 placeholders once per
  hook, scoped to that game mode's addon, so %aoneblock_...% and
  %chunkblock_...% stay separate.
- addon.yml: depend AOneBlock -> softdepend AOneBlock, ChunkBlock;
  add chunkblock.island.topblock and chunkblock.intopten permissions.
- pom.xml: add chunkblock 1.0.1 (provided) and level 2.6.2 (test only,
  needed to mock ChunkBlock which hard-depends on Level).
- Tests: hook selection scenarios, per-hook top ten separation,
  world-to-hook resolution, per-game-mode placeholder registration,
  and unit tests for both hook implementations.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01UtAC44orba7UkTpFwHEw22
@sonarqubecloud

sonarqubecloud Bot commented Aug 8, 2026

Copy link
Copy Markdown

@tastybento
tastybento merged commit 18549e5 into develop Aug 8, 2026
3 checks passed
@tastybento
tastybento deleted the chunkblock-support branch August 8, 2026 04:55
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