Prevent server.properties from being overwritten #5

Merged
NotAlexNoyle merged 1 commits from codex/patch-purpur-server-to-protect-server.properties into ver/1.19.4 2026-01-27 22:47:55 -05:00
NotAlexNoyle commented 2026-01-27 22:47:31 -05:00 (Migrated from github.com)

Motivation

  • Ensure the server never overwrites an existing server.properties file so admin/customized values are preserved.
  • Avoid accidental configuration resets during server startup or config updates.

Description

  • Add a guard to DedicatedServerSettings.update to skip saving if this.path already exists by checking java.nio.file.Files.exists(this.path).
  • Add the same existence check to DedicatedServerSettings.save so server.properties is only written when it does not already exist.
  • Changes are delivered as a patch file at patches/server/0313-Prevent-server-properties-from-being-overwritten.patch that modifies src/main/java/net/minecraft/server/dedicated/DedicatedServerSettings.java.

Testing

  • No automated tests were executed for this patch because it is a small, patch-only change intended to alter save behavior.

Codex Task

### Motivation - Ensure the server never overwrites an existing `server.properties` file so admin/customized values are preserved. - Avoid accidental configuration resets during server startup or config updates. ### Description - Add a guard to `DedicatedServerSettings.update` to skip saving if `this.path` already exists by checking `java.nio.file.Files.exists(this.path)`. - Add the same existence check to `DedicatedServerSettings.save` so `server.properties` is only written when it does not already exist. - Changes are delivered as a patch file at `patches/server/0313-Prevent-server-properties-from-being-overwritten.patch` that modifies `src/main/java/net/minecraft/server/dedicated/DedicatedServerSettings.java`. ### Testing - No automated tests were executed for this patch because it is a small, patch-only change intended to alter save behavior. ------ [Codex Task](https://chatgpt.com/codex/tasks/task_e_69798521b7d8832f80d0d7ce7b824450)
Sign in to join this conversation.