diff --git a/minecraft-server/Dockerfile b/minecraft-server/Dockerfile index bb4d1144..564ecc8e 100644 --- a/minecraft-server/Dockerfile +++ b/minecraft-server/Dockerfile @@ -41,7 +41,6 @@ WORKDIR /data ENTRYPOINT [ "/start" ] ENV UID=1000 GID=1000 \ - MOTD="A Minecraft Server Powered by Docker" \ JVM_XX_OPTS="-XX:+UseG1GC" MEMORY="1G" \ TYPE=VANILLA VERSION=LATEST FORGEVERSION=RECOMMENDED SPONGEBRANCH=STABLE SPONGEVERSION= LEVEL=world \ PVP=true DIFFICULTY=easy ENABLE_RCON=true RCON_PORT=25575 RCON_PASSWORD=minecraft \ diff --git a/minecraft-server/README.md b/minecraft-server/README.md index 00da6cd6..9b07b4e0 100644 --- a/minecraft-server/README.md +++ b/minecraft-server/README.md @@ -628,8 +628,14 @@ The message of the day, shown below each server entry in the UI, can be changed docker run -d -e 'MOTD=My Server' ... -If you leave it off, the last used or default message will be used. _The example shows how to specify a server -message of the day that contains spaces by putting quotes around the whole thing._ +If you leave it off, a default is computed from the server type and version, such as + + A Paper Minecraft Server powered by Docker + +when `TYPE` is `PAPER`. That way you can easily differentiate between several servers you may have started. + +_The example shows how to specify a server message of the day that contains spaces by putting quotes +around the whole thing._ ### PVP Mode diff --git a/minecraft-server/start-configuration b/minecraft-server/start-configuration index be90fd39..2a45fb67 100755 --- a/minecraft-server/start-configuration +++ b/minecraft-server/start-configuration @@ -58,6 +58,8 @@ esac cd /data +export ORIGINAL_TYPE=${TYPE} + echo "Checking type information." case "$TYPE" in *BUKKIT|*bukkit|SPIGOT|spigot) diff --git a/minecraft-server/start-finalSetup04ServerProperties b/minecraft-server/start-finalSetup04ServerProperties index 96203cb1..7cb95002 100755 --- a/minecraft-server/start-finalSetup04ServerProperties +++ b/minecraft-server/start-finalSetup04ServerProperties @@ -34,6 +34,22 @@ if [ ! -e $SERVER_PROPERTIES ]; then setServerProp "white-list" "true" fi + # If not provided, generate a reasonable default message-of-the-day, + # which shows up in the server listing in the client + if [ -z $MOTD ]; then + # snapshot is the odd case where we have to look at version to identify that label + if [[ ${ORIGINAL_TYPE} == "VANILLA" && ${VERSION} == "SNAPSHOT" ]]; then + label=SNAPSHOT + else + label=${ORIGINAL_TYPE} + fi + + # Convert label to title-case + label=${label,,} + label=${label^} + MOTD="A ${label} Minecraft Server powered by Docker" + fi + setServerProp "server-port" "$SERVER_PORT" setServerProp "motd" "$MOTD" setServerProp "allow-nether" "$ALLOW_NETHER"