Skip to content

#121 allow hot reloads on config#143

Merged
tpwalke2 merged 3 commits into
mainfrom
feature/tpwalke2/121-config-hot-reload
Jul 18, 2026
Merged

#121 allow hot reloads on config#143
tpwalke2 merged 3 commits into
mainfrom
feature/tpwalke2/121-config-hot-reload

Conversation

@tpwalke2

@tpwalke2 tpwalke2 commented Jul 18, 2026

Copy link
Copy Markdown
Owner

What

Makes marker-group config hot-reloadable: editing BMSM-Core.json and running /bluemap reload now picks up the new group definitions without a server restart.

Why

Config was previously frozen at class-init in three places (ConfigManager.coreConfig, SignHelper.signLinesParser, SignManager.prefixGroupMap), so a /bluemap reload already replayed the sign cache but with stale group data (old icons/offsets/visibility/distances). See plans/marker-group-config-reload-plan.md.

Changes

  • ConfigManager: coreConfig is now volatile; added reload() to reload from disk.
  • SignHelper: signLinesParser is now volatile; added reloadParser() to rebuild it from current config.
  • SignManager: prefixGroupMap and actionFactory are now volatile; reset() calls a new reloadConfig() (reloads ConfigManager, rebuilds the parser, prefix map, and ActionFactory) before reloadSigns().
  • SignEntryHelper.isMarkerType: null-checks the group lookup so a sign whose prefix was removed/renamed during a reload doesn't NPE.
  • BlueMapAPIConnector.onEnable: sets blueMapAPI before firing reset, so the reset path has a valid API reference.
  • Added SignEntryHelperTest covering prefix/label/detail resolution and the now-fixed null-prefix case.
  • Added plans/marker-group-config-reload-plan.md and plans/marker-group-reload-followups-todo.md.

Testing

  • ./gradlew test — new SignEntryHelperTest cases pass.
  • Manual: ./gradlew runServer, edit BMSM-Core.json (e.g. change an icon/prefix), run /bluemap reload in-game, confirm existing markers update to the new definitions without a restart.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR implements hot-reload behavior for marker-group configuration so that running /bluemap reload (BlueMap disable/enable cycle) refreshes the mod’s config-derived caches (config singleton, sign parser, and prefix→group resolution) without requiring a full server restart.

Changes:

  • Add a reloadable ConfigManager and rebuild SignHelper’s cached SignLinesParser on reload.
  • Refresh SignManager’s prefixGroupMap and ActionFactory during BlueMap reset, then replay the sign cache.
  • Harden SignEntryHelper.isMarkerType against prefixes that no longer exist in config, and add a new unit test suite for SignEntryHelper.

Reviewed changes

Copilot reviewed 8 out of 8 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
src/test/java/com/tpwalke2/bluemapsignmarkers/core/signs/SignEntryHelperTest.java New unit tests covering SignEntryHelper behavior, including the “prefix removed from config” scenario.
src/main/java/com/tpwalke2/bluemapsignmarkers/core/signs/SignManager.java Rebuild prefix→group map and action factory on reset to support config hot reload.
src/main/java/com/tpwalke2/bluemapsignmarkers/core/signs/SignHelper.java Make the parser rebuildable to reflect updated marker groups after reload.
src/main/java/com/tpwalke2/bluemapsignmarkers/core/signs/SignEntryHelper.java Add a null-guard when a prefix no longer resolves to a configured MarkerGroup.
src/main/java/com/tpwalke2/bluemapsignmarkers/core/bluemap/BlueMapAPIConnector.java Minor ordering tweak in onEnable to assign blueMapAPI before processing/reset logic.
src/main/java/com/tpwalke2/bluemapsignmarkers/config/ConfigManager.java Make the core config reference reloadable (volatile + reload()).
plans/marker-group-reload-followups-todo.md New follow-up notes documenting deferred edge cases for marker-group reload.
plans/marker-group-config-reload-plan.md New plan document describing the intended reload design and verification steps.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 8 out of 8 changed files in this pull request and generated 1 comment.

@tpwalke2
tpwalke2 merged commit 079977e into main Jul 18, 2026
1 check passed
@tpwalke2
tpwalke2 deleted the feature/tpwalke2/121-config-hot-reload branch July 18, 2026 17:13
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.

2 participants