docker-minecraft-server icon indicating copy to clipboard operation
docker-minecraft-server copied to clipboard

If `RESOURCE_PACK` is unset, remove entry from `server.properties` (or document manual step)

Open xurizaemon opened this issue 3 years ago • 3 comments

Enhancement Type

Improve an existing feature

Describe the enhancement

In https://github.com/itzg/docker-minecraft-server/pull/379 it became possible to add a resource pack via setting RESOURCE_PACK. Awesome!

However, if you do this and then disable the variable, the resource pack behaviour persists. As a new MC admin, it was not clear to me how the configuration had persisted. Initially I looked for a cached .zip file locally, and then for the extracted values. But the persistence was that setting the variable had written it to server.properties, and clearing the variable did not trigger a corresponding update to server.properties to remove it.

This might be complicated since we don't want to clear the entry if it's manually added ... perhaps just documenting an additional step to unset that variable would help.

xurizaemon avatar Nov 12 '21 20:11 xurizaemon

Good point. Just to confirm you're also using OVERRIDE_SERVER_PROPERTIES=true? If not, it won't touch anything in server.properties.

itzg avatar Nov 12 '21 20:11 itzg

Yep, that is set for us.

    environment:
      EULA: "TRUE"
      ENABLE_AUTOPAUSE: "TRUE"
      OVERRIDE_SERVER_PROPERTIES: "TRUE"
      MAX_TICK_TIME: "-1"
#      RESOURCE_PACK: https://vanillatweaks.net/download/VanillaTweaks_d392691_UNZIP_ME.zip
#      RESOURCE_PACK_SHA1: d7f0e5aa44f0ad1537af91c135b97f17

I had commented out the values, rather than removing them from the file. (Which might only be a factor if you were checking the yaml instead of the environment.)

(Unrelated, but (1) I now know those URLs are time-limited, and (2) that this was actually a Datapack not a Resource pack. Which is why I needed to remove it!)

xurizaemon avatar Nov 12 '21 20:11 xurizaemon

The latest image will now allow you to clear a property by setting the corresponding variable to an empty string. I had to flip the semantic a bit for an unset variable, which indicates the property should left as is.

In your case, you'll be able to do:

    environment:
      EULA: "TRUE"
      ENABLE_AUTOPAUSE: "TRUE"
      OVERRIDE_SERVER_PROPERTIES: "TRUE"
      MAX_TICK_TIME: "-1"
      RESOURCE_PACK: ""
      RESOURCE_PACK_SHA1: ""

The README section now includes a note about this behavior.

itzg avatar Nov 13 '21 03:11 itzg