SpongeVanilla integration and JSON check fix

This commit is contained in:
Aitor Ramos Sasselli 2017-11-01 22:06:05 +01:00
parent ee5a95baa8
commit f178c6c0a1
4 changed files with 54 additions and 8 deletions

View file

@ -44,6 +44,6 @@ 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 LEVEL=world PVP=true \
DIFFICULTY=easy ENABLE_RCON=true RCON_PORT=25575 RCON_PASSWORD=minecraft \
TYPE=VANILLA VERSION=LATEST FORGEVERSION=RECOMMENDED SPONGEBRANCH=STABLE SPONGEVERSION= LEVEL=world \
PVP=true DIFFICULTY=easy ENABLE_RCON=true RCON_PORT=25575 RCON_PASSWORD=minecraft \
LEVEL_TYPE=DEFAULT GENERATOR_SETTINGS= WORLD= MODPACK= ONLINE_MODE=TRUE CONSOLE=true

View file

@ -73,6 +73,10 @@ case "$TYPE" in
exec /start-deployVanilla $@
;;
SPONGEVANILLA|spongevanilla)
exec /start-deploySpongeVanilla $@
;;
*)
echo "Invalid type: '$TYPE'"
echo "Must be: VANILLA, FORGE, BUKKIT, SPIGOT, PAPER, FTB, SPONGEVANILLA"

View file

@ -0,0 +1,37 @@
#!/bin/bash
export TYPE=spongevanilla
# Parse branch
echo "Choosing branch for Sponge"
case "$SPONGEBRANCH" in
EXPERIMENTAL|experimental|BLEEDING|bleeding)
SPONGEBRANCH=bleeding
;;
*)
SPONGEBRANCH=stable
;;
esac
# If not SPONGEVERSION selected, detect last version on selected branch
if [ -z $SPONGEVERSION ]; then
echo "Choosing Version for Sponge"
if [ "$SPONGEBRANCH" == "stable" ]; then
export SPONGEVERSION=`curl -fsSL https://dl-api.spongepowered.org/v1/org.spongepowered/$TYPE | jq -r '.buildTypes.stable.latest.version'`
else
export SPONGEVERSION=`curl -fsSL https://dl-api.spongepowered.org/v1/org.spongepowered/$TYPE | jq -r '.buildTypes.bleeding.latest.version'`
fi
fi
export SERVER="spongevanilla-$SPONGEVERSION.jar"
if [ ! -e $SERVER ]; then
echo "Downloading $SERVER ..."
wget -q https://repo.spongepowered.org/maven/org/spongepowered/$TYPE/$SPONGEVERSION/$SERVER
fi
# Continue to Final Setup
exec /start-finalSetup01World $@

View file

@ -24,12 +24,17 @@ if [ -n "$ICON" -a ! -e server-icon.png ]; then
fi
# Make sure files exist and are valid JSON (for pre-1.12 to 1.12 upgrades)
for j in *.json; do
if [[ $(python -c "print open('$j').read().strip()==''") = True ]]; then
echo "Fixing JSON $j"
echo '[]' > $j
fi
done
if [[ -z "ls *.json" ]]; then
echo "Checking JSON files"
for j in *.json; do
if [[ $(python -c "print open('$j').read().strip()==''") = True ]]; then
echo "Fixing JSON $j"
echo '[]' > $j
fi
done
else
echo "Skipping JSON check. No files present."
fi
# If any modules have been provided, copy them over
mkdir -p /data/mods