Skip to content

Reload re-imports control panels from the template file#41

Open
tastybento wants to merge 1 commit into
developfrom
fix/reload-reimports-template
Open

Reload re-imports control panels from the template file#41
tastybento wants to merge 1 commit into
developfrom
fix/reload-reimports-template

Conversation

@tastybento

Copy link
Copy Markdown
Member

Problem

Reported on Discord: after editing controlPanelTemplate.yml and running bbox reload — with no errors — the control panel doesn't pick up the new configuration.

Root cause: panels are stored in BentoBox's database, and the template file is only a one-time seed. onReload()manager.reload() re-read only the database, so template edits were silently ignored. The only way to apply them was the confirmation-gated /<gamemode>admin cp import command.

Change

  • onReload() now wipes and re-imports each active game mode's panels from the template, so a plain bbox reload applies edits. Wiping first ensures panels removed from the template also disappear rather than lingering in the DB.
  • The template file name is now configurable via a new template-file entry in config.yml (default controlPanelTemplate.yml), honored by reload, importControlPanels, and the admin import command. Point it at your own file and both reload and cp import use it.

Tests

102 pass (was 99). Added:

  • SettingsTest — default value + setter for templateFile.
  • ControlPanelManagerTest — reimport reads the template, wipes deleted panels, and honors a custom configured filename.

🤖 Generated with Claude Code

Control panels were pinned to the database after the first seed, so editing
controlPanelTemplate.yml and running 'bbox reload' had no effect: onReload
only re-read the database. The only way to apply template edits was the
confirmation-gated admin import command.

onReload now wipes and re-imports each active game mode from the template so
plain reloads pick up edits. The template file name is configurable via a new
'template-file' entry in config.yml (default controlPanelTemplate.yml), honored
by reload, importControlPanels, and the admin import command.

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

Copy link
Copy Markdown

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