Skip to content

Convert player upgrade panel to BentoBox TemplatedPanel#79

Merged
tastybento merged 1 commit intodevelopfrom
feature/templated-panel
Feb 24, 2026
Merged

Convert player upgrade panel to BentoBox TemplatedPanel#79
tastybento merged 1 commit intodevelopfrom
feature/templated-panel

Conversation

@tastybento
Copy link
Member

Summary

  • Replaces the programmatic PanelBuilder in Panel.java with a YAML-driven TemplatedPanelBuilder, separating layout from logic
  • Adds src/main/resources/panels/upgrades_panel.yml — a default 6-row layout with 3×7 upgrade slots (21 per page) and PREVIOUS/NEXT pagination buttons in the bottom row
  • UpgradesAddon.onEnable now calls saveResource("panels/upgrades_panel.yml", false) to copy the template on first run without overwriting admin edits
  • Adds previous, next, and upgrade tooltip locale keys under upgradepanel in en-US.yml

Admin customisation

Admins can edit plugins/BentoBox/addons/Upgrades/panels/upgrades_panel.yml to rearrange slots, change icons, add rows, etc. — no code changes needed.

Pagination

More than 21 upgrades automatically gets a NEXT button on page 1 and a PREVIOUS button on page 2+. Each page shows 21 upgrades (3 rows × 7 cols).

Test plan

  • All 102 existing tests pass (mvn test)
  • In-game: /[gamemode] upgrades opens the panel with upgrades in the grid
  • With >21 upgrades: NEXT/PREVIOUS pagination works correctly
  • Edit upgrades_panel.yml and reload — layout changes take effect

🤖 Generated with Claude Code

Replaces the programmatic PanelBuilder with a YAML-driven TemplatedPanel,
allowing admins to customise the upgrade GUI layout without touching code.

- Add src/main/resources/panels/upgrades_panel.yml: default 6-row layout
  with 3×7 upgrade slots (21 per page) and PREVIOUS/NEXT pagination buttons
- Rewrite Panel.java: uses TemplatedPanelBuilder with UPGRADE, NEXT, and
  PREVIOUS type builders; adds a page field for pagination
- UpgradesAddon.onEnable: saveResource("panels/upgrades_panel.yml", false)
  copies the template on first run without overwriting admin edits
- en-US.yml: add previous/next/upgrade locale keys under upgradepanel
- Update UpgradesAddonTest: include panels/upgrades_panel.yml in test JAR
- Update PanelTest: set up BentoBox singleton and temp data folder with
  panel template so TemplatedPanelBuilder can build the inventory

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@tastybento tastybento merged commit 3bd671a into develop Feb 24, 2026
1 check failed
@tastybento tastybento deleted the feature/templated-panel branch February 24, 2026 16:31
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