Skip to content

Add AOneBlock phase requirement for generators (#121) - #162

Merged
tastybento merged 1 commit into
developfrom
121-oneblock-phase-requirement
Jul 5, 2026
Merged

tastybento merged 1 commit into
developfrom
121-oneblock-phase-requirement

Conversation

@tastybento

Copy link
Copy Markdown
Member

Closes #121

Feature

Generators can now require an AOneBlock phase to be reached before they unlock, so OneBlock servers can gate generators behind progression (the ask in #121). This is the phase-only subset of #117.

Change

  • Dependency: adds world.bentobox:aoneblock as a provided-scope dependency, mirroring how Level/Bank are integrated.
  • Data model: GeneratorTierObject.requiredPhase (String, @Expose, cloned, empty by default, null-normalised).
  • Enforcement: checkGeneratorUnlockStatus gains a phase filter. A phase-gated generator unlocks once the island's block count has reached the required phase's starting block:
    island.getBlockNumber() >= getOneBlockManager().getPhase(requiredPhase).getBlockNumberValue()
    
    Because unlocks are permanent, it stays unlocked as the player progresses further. Non-AOneBlock worlds never satisfy a phase requirement (the phase filter returns false), so a stray phase requirement in a non-OB world simply keeps the generator locked (and visible in the lore).
  • Display: requirements lore shows a Required Phase line ([phase]), with new en-US locale strings. Phase-name matching is case/space-insensitive (AOneBlock's getPhase).

Tests

  • GeneratorTierObjectTest: requiredPhase default/set/get/null-normalise/clone.
  • StoneGeneratorManagerTest (mocking AOneBlock): unlocks when the phase is reached; stays locked when not reached; stays locked in a non-AOneBlock world.

Full suite: 113 tests pass.

Scope note

requiredPhase is configurable via generator export/import JSON for now. An admin GUI editor is a sensible follow-up — the generator edit panel is currently at capacity (all inner slots used after #88/#106), so adding a button needs a small layout change I kept out of this PR.

🤖 Generated with Claude Code

Generators can now require an AOneBlock phase to be reached before they
unlock, enabling OneBlock progression-gated generators.

- Adds aoneblock as a provided-scope dependency (mirrors level/bank).
- GeneratorTierObject.requiredPhase (String, @expose, cloned, empty by
  default; null-normalised).
- checkGeneratorUnlockStatus only unlocks a phase-gated generator once
  the island's block count has reached the required phase's starting
  block, via AOneBlock's getOneBlockManager().getPhase(name) and
  getOneBlocksIsland(island).getBlockNumber(). Non-AOneBlock worlds never
  satisfy a phase requirement.
- Requirements lore shows a "Required Phase" line ([phase]) with new
  en-US locale strings.

Configurable via generator export/import for now; an admin GUI editor can
follow (the edit panel is currently full).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01D7NWPeGXmsUJnnX42X24Rd
@sonarqubecloud

sonarqubecloud Bot commented Jul 5, 2026

Copy link
Copy Markdown

@tastybento
tastybento merged commit 66ed051 into develop Jul 5, 2026
4 checks passed
@tastybento
tastybento deleted the 121-oneblock-phase-requirement branch July 5, 2026 02:02
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.

Placeholder: aoneblock_my_island_phase

1 participant