From f178c6c0a1dc47223720140ec77f4a3532582717 Mon Sep 17 00:00:00 2001 From: Aitor Ramos Sasselli Date: Wed, 1 Nov 2017 22:06:05 +0100 Subject: [PATCH 1/3] SpongeVanilla integration and JSON check fix --- minecraft-server/Dockerfile | 4 +-- minecraft-server/start-configuration | 4 +++ minecraft-server/start-deploySpongeVanilla | 37 ++++++++++++++++++++++ minecraft-server/start-minecraftFinalSetup | 17 ++++++---- 4 files changed, 54 insertions(+), 8 deletions(-) create mode 100755 minecraft-server/start-deploySpongeVanilla diff --git a/minecraft-server/Dockerfile b/minecraft-server/Dockerfile index bd14043c..ec8686e9 100644 --- a/minecraft-server/Dockerfile +++ b/minecraft-server/Dockerfile @@ -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 diff --git a/minecraft-server/start-configuration b/minecraft-server/start-configuration index f045bf08..10ce5da7 100755 --- a/minecraft-server/start-configuration +++ b/minecraft-server/start-configuration @@ -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" diff --git a/minecraft-server/start-deploySpongeVanilla b/minecraft-server/start-deploySpongeVanilla new file mode 100755 index 00000000..fd4e781c --- /dev/null +++ b/minecraft-server/start-deploySpongeVanilla @@ -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 $@ diff --git a/minecraft-server/start-minecraftFinalSetup b/minecraft-server/start-minecraftFinalSetup index dba9ad33..a4e5c0fb 100755 --- a/minecraft-server/start-minecraftFinalSetup +++ b/minecraft-server/start-minecraftFinalSetup @@ -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 From f347f30353438f32da96fdeb92cd387ccba924a0 Mon Sep 17 00:00:00 2001 From: Aitor Ramos Sasselli Date: Sun, 5 Nov 2017 22:41:11 +0100 Subject: [PATCH 2/3] Added initial SpongeForge information to Readme --- minecraft-server/README.md | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/minecraft-server/README.md b/minecraft-server/README.md index 011143ba..337bb8be 100644 --- a/minecraft-server/README.md +++ b/minecraft-server/README.md @@ -398,6 +398,13 @@ example: Note: The FTB server start script will also override other options, like `MOTD`. +## Running a SpongeVanilla server + +Enable SpongeVanilla server mode by adding a `-e TYPE=SPONGEVANILLA` to your command-line. + + docker run -d -v /path/on/host:/data -e TYPE=SPONGEVANILLA \ + -p 25565:25565 -e EULA=TRUE --name mc itzg/minecraft-server + ## Using Docker Compose Rather than type the server options below, the port mappings above, etc From 7797bf23fb251702f6db7373e8a98bc6cfb13aaf Mon Sep 17 00:00:00 2001 From: Aitor Ramos Sasselli Date: Mon, 6 Nov 2017 09:52:26 +0100 Subject: [PATCH 3/3] Added optional parameters on SpongeVanilla server --- minecraft-server/README.md | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/minecraft-server/README.md b/minecraft-server/README.md index 337bb8be..d6b241cb 100644 --- a/minecraft-server/README.md +++ b/minecraft-server/README.md @@ -401,9 +401,17 @@ like `MOTD`. ## Running a SpongeVanilla server Enable SpongeVanilla server mode by adding a `-e TYPE=SPONGEVANILLA` to your command-line. +By default the container will run the latest `STABLE` version. +If you want to run a specific version, you can add `-e SPONGEVERSION=1.11.2-6.1.0-BETA-19` to your command-line. docker run -d -v /path/on/host:/data -e TYPE=SPONGEVANILLA \ -p 25565:25565 -e EULA=TRUE --name mc itzg/minecraft-server + +You can also choose to use the `EXPERIMENTAL` branch. +Just change it with `SPONGEBRANCH`, such as: + + $ docker run -d -v /path/on/host:/data ... \ + -e TYPE=SPONGEVANILLA -e SPONGEBRANCH=EXPERIMENTAL ... ## Using Docker Compose