Add ChunkBlock support alongside AOneBlock - #14
Merged
Conversation
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
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



Summary
TopBlock now works with AOneBlock, ChunkBlock (1.0.1), or both — each hooked game mode gets its own independent top ten,
topblocksubcommand, and placeholder set.How
hookspackage:TopBlockHookinterface (getGameMode(),getAllIslandData()returning neutralIslandBlockDatarecords,getPhaseCount()) withAOneBlockHookandChunkBlockHookimplementations. 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.onEnablehooks each supported game mode that is present, enabled, and aGameModeAddon, registering thetopblocksubcommand on each one's player command. It disables itself only when neither game mode is found.TopBlockManagerkeeps 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.PlaceholderManagerregistersisland_*_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: AOneBlock→softdepend: AOneBlock, ChunkBlock; addschunkblock.island.topblockandchunkblock.intoptenpermissions mirroring the aoneblock ones.pom.xml: addsworld.bentobox:chunkblock:1.0.1(provided) andworld.bentobox:level:2.6.2(test scope only — Mockito can't mockChunkBlockwithout its hard dependency Level on the classpath).Tests
43 tests, all passing:
AOneBlockHookTest/ChunkBlockHookTestcover field mapping and phase counting against the real game-mode classes.Note: the enable-path tests now call
setState(State.LOADED)beforeonEnable()— a freshly constructedAddonstarts 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