Stop mutating config.yml at runtime #1

Merged
NotAlexNoyle merged 1 commits from codex/remove-config.yml-modifications into master 2026-03-23 14:20:56 -04:00
NotAlexNoyle commented 2026-03-23 14:20:27 -04:00 (Migrated from github.com)

Motivation

  • Treat config.yml as immutable so startup and admin actions do not overwrite user-provided configuration.
  • Avoid automatic migrations or default-write behavior that could unexpectedly change server configuration.
  • Surface missing/legacy configuration to server operators via logs so they can update files manually.

Description

  • GameModeInventories: removed runtime writes that saved defaults or migration flags (removed saveDefaultConfig() and suppressed writes to blocks_conversion_done and creative_world.switch_to) and replaced them with informative log messages.
  • GameModeInventoriesConfig: converted checkConfig() from writing default/migrated values into config.yml to read-only validation that logs missing or legacy options instead of setting them or calling saveConfig().
  • GameModeInventoriesCommands: disabled the inline /gmi config toggles that flipped config booleans and saved them, and now reply to admins that config.yml is immutable and must be edited manually.
  • GameModeInventoriesMessage: fixed updateMessages() to write new message entries into the messages.yml FileConfiguration (messagesConfig) instead of accidentally writing into the main plugin config.

Testing

  • Ran a pattern search for config mutation calls (saveDefaultConfig, saveConfig, getConfig().set(...)) and confirmed no remaining writes to config.yml from the modified code (success).
  • Ran git diff --check to verify no whitespace/patch issues (success).
  • Attempted a Gradle build with JAVA_HOME set to Java 17; the build failed due to the environment being unable to resolve the Spotless Gradle plugin from configured repositories, which is an infra/plugin resolution issue unrelated to the code changes (failed).

Codex Task

### Motivation - Treat `config.yml` as immutable so startup and admin actions do not overwrite user-provided configuration. - Avoid automatic migrations or default-write behavior that could unexpectedly change server configuration. - Surface missing/legacy configuration to server operators via logs so they can update files manually. ### Description - GameModeInventories: removed runtime writes that saved defaults or migration flags (removed `saveDefaultConfig()` and suppressed writes to `blocks_conversion_done` and `creative_world.switch_to`) and replaced them with informative log messages. - GameModeInventoriesConfig: converted `checkConfig()` from writing default/migrated values into `config.yml` to read-only validation that logs missing or legacy options instead of setting them or calling `saveConfig()`. - GameModeInventoriesCommands: disabled the inline `/gmi` config toggles that flipped config booleans and saved them, and now reply to admins that `config.yml` is immutable and must be edited manually. - GameModeInventoriesMessage: fixed `updateMessages()` to write new message entries into the `messages.yml` `FileConfiguration` (`messagesConfig`) instead of accidentally writing into the main plugin config. ### Testing - Ran a pattern search for config mutation calls (`saveDefaultConfig`, `saveConfig`, `getConfig().set(...)`) and confirmed no remaining writes to `config.yml` from the modified code (success). - Ran `git diff --check` to verify no whitespace/patch issues (success). - Attempted a Gradle build with `JAVA_HOME` set to Java 17; the build failed due to the environment being unable to resolve the Spotless Gradle plugin from configured repositories, which is an infra/plugin resolution issue unrelated to the code changes (failed). ------ [Codex Task](https://chatgpt.com/codex/tasks/task_e_69c18250ac00832f85fb5d7393f1459f)
Sign in to join this conversation.