mirror of
https://github.com/itzg/docker-minecraft-server
synced 2024-11-10 14:24:28 +00:00
parent
0cbfb81b4c
commit
fa53abdfb7
2 changed files with 9 additions and 3 deletions
|
@ -61,7 +61,6 @@ if [[ $RCON_PASSWORD_FILE ]]; then
|
|||
log ""
|
||||
fi
|
||||
|
||||
export SERVER_PROPERTIES=/data/server.properties
|
||||
export VERSIONS_JSON=https://launchermeta.mojang.com/mc/game/version_manifest.json
|
||||
|
||||
case "X$VERSION" in
|
||||
|
|
|
@ -2,6 +2,8 @@
|
|||
|
||||
. ${SCRIPTS:-/}start-utils
|
||||
|
||||
: ${SERVER_PROPERTIES:=/data/server.properties}
|
||||
|
||||
# FUNCTIONS
|
||||
function setServerProp {
|
||||
local prop=$1
|
||||
|
@ -12,8 +14,13 @@ function setServerProp {
|
|||
TRUE|FALSE)
|
||||
var=${var,,} ;;
|
||||
esac
|
||||
log "Setting ${prop} to '${var}' in ${SERVER_PROPERTIES}"
|
||||
sed -i "/^${prop}\s*=/ c ${prop}=${var//\\/\\\\}" "$SERVER_PROPERTIES"
|
||||
if grep "${prop}" "$SERVER_PROPERTIES" > /dev/null; then
|
||||
log "Setting ${prop} to '${var}' in ${SERVER_PROPERTIES}"
|
||||
sed -i "/^${prop}\s*=/ c ${prop}=${var//\\/\\\\}" "$SERVER_PROPERTIES"
|
||||
else
|
||||
log "Adding ${prop} with '${var}' in ${SERVER_PROPERTIES}"
|
||||
echo "${prop}=${var//\\/\\\\}" >> "$SERVER_PROPERTIES"
|
||||
fi
|
||||
else
|
||||
log "Skip setting ${prop}"
|
||||
fi
|
||||
|
|
Loading…
Reference in a new issue