mc: compute default MOTD based on the given type and version

This commit is contained in:
Geoff Bourne
2018-04-14 13:52:46 -05:00
parent 1f04ca946c
commit 5267927c3f
4 changed files with 26 additions and 3 deletions
@@ -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"