mirror of
https://github.com/itzg/docker-minecraft-server
synced 2025-01-07 09:48:43 +00:00
mc: compute default MOTD based on the given type and version
This commit is contained in:
parent
1f04ca946c
commit
5267927c3f
4 changed files with 26 additions and 3 deletions
|
@ -41,7 +41,6 @@ WORKDIR /data
|
||||||
ENTRYPOINT [ "/start" ]
|
ENTRYPOINT [ "/start" ]
|
||||||
|
|
||||||
ENV UID=1000 GID=1000 \
|
ENV UID=1000 GID=1000 \
|
||||||
MOTD="A Minecraft Server Powered by Docker" \
|
|
||||||
JVM_XX_OPTS="-XX:+UseG1GC" MEMORY="1G" \
|
JVM_XX_OPTS="-XX:+UseG1GC" MEMORY="1G" \
|
||||||
TYPE=VANILLA VERSION=LATEST FORGEVERSION=RECOMMENDED SPONGEBRANCH=STABLE SPONGEVERSION= LEVEL=world \
|
TYPE=VANILLA VERSION=LATEST FORGEVERSION=RECOMMENDED SPONGEBRANCH=STABLE SPONGEVERSION= LEVEL=world \
|
||||||
PVP=true DIFFICULTY=easy ENABLE_RCON=true RCON_PORT=25575 RCON_PASSWORD=minecraft \
|
PVP=true DIFFICULTY=easy ENABLE_RCON=true RCON_PORT=25575 RCON_PASSWORD=minecraft \
|
||||||
|
|
|
@ -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' ...
|
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
|
If you leave it off, a default is computed from the server type and version, such as
|
||||||
message of the day that contains spaces by putting quotes around the whole thing._
|
|
||||||
|
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
|
### PVP Mode
|
||||||
|
|
||||||
|
|
|
@ -58,6 +58,8 @@ esac
|
||||||
|
|
||||||
cd /data
|
cd /data
|
||||||
|
|
||||||
|
export ORIGINAL_TYPE=${TYPE}
|
||||||
|
|
||||||
echo "Checking type information."
|
echo "Checking type information."
|
||||||
case "$TYPE" in
|
case "$TYPE" in
|
||||||
*BUKKIT|*bukkit|SPIGOT|spigot)
|
*BUKKIT|*bukkit|SPIGOT|spigot)
|
||||||
|
|
|
@ -34,6 +34,22 @@ if [ ! -e $SERVER_PROPERTIES ]; then
|
||||||
setServerProp "white-list" "true"
|
setServerProp "white-list" "true"
|
||||||
fi
|
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 "server-port" "$SERVER_PORT"
|
||||||
setServerProp "motd" "$MOTD"
|
setServerProp "motd" "$MOTD"
|
||||||
setServerProp "allow-nether" "$ALLOW_NETHER"
|
setServerProp "allow-nether" "$ALLOW_NETHER"
|
||||||
|
|
Loading…
Reference in a new issue