From 79438e14decd5b2595b9270a411de003406cfc10 Mon Sep 17 00:00:00 2001 From: "Daniel L. Polanco" Date: Wed, 4 Mar 2015 17:47:54 -0700 Subject: [PATCH] Simplify start-minecraft.sh --- minecraft-server/start-minecraft.sh | 38 ++++++++++++----------------- 1 file changed, 16 insertions(+), 22 deletions(-) diff --git a/minecraft-server/start-minecraft.sh b/minecraft-server/start-minecraft.sh index ba469853..8f332b4d 100755 --- a/minecraft-server/start-minecraft.sh +++ b/minecraft-server/start-minecraft.sh @@ -15,19 +15,24 @@ if [ ! -e /data/eula.txt ]; then fi fi +case $VERSION in + LATEST) + VANILLA_VERSION=`wget -O - https://s3.amazonaws.com/Minecraft.Download/versions/versions.json | jsawk -n 'out(this.latest.release)'` + FORGE_VERSION=`wget -O - http://files.minecraftforge.net/maven/net/minecraftforge/forge/promotions_slim.json \ + | jsawk -n 'out(this.promos.recommended)'` + ;; + SNAPSHOT) + VANILLA_VERSION=`wget -O - https://s3.amazonaws.com/Minecraft.Download/versions/versions.json | jsawk -n 'out(this.latest.snapshot)'` + FORGE_VERSION=`wget -O - http://files.minecraftforge.net/maven/net/minecraftforge/forge/promotions_slim.json \ + | jsawk -n 'out(this.promos.latest)'` + ;; +esac + cd /data case $TYPE in VANILLA) - case $VERSION in - LATEST) - export VANILLA_VERSION=`wget -O - https://s3.amazonaws.com/Minecraft.Download/versions/versions.json | jsawk -n 'out(this.latest.release)'` - ;; - SNAPSHOT) - export VANILLA_VERSION=`wget -O - https://s3.amazonaws.com/Minecraft.Download/versions/versions.json | jsawk -n 'out(this.latest.snapshot)'` - ;; - esac - export SERVER="minecraft_server.$VANILLA_VERSION" + SERVER="minecraft_server.$VANILLA_VERSION.jar" if [ ! -e $SERVER ]; then echo "Downloading $SERVER ..." @@ -36,18 +41,8 @@ case $TYPE in ;; FORGE) - case $VERSION in - LATEST) - export FORGE_VERSION=`wget -O - http://files.minecraftforge.net/maven/net/minecraftforge/forge/promotions_slim.json \ - | jsawk -n 'out(this.promos.recommended)'` - ;; - SNAPSHOT) - export FORGE_VERSION=`wget -O - http://files.minecraftforge.net/maven/net/minecraftforge/forge/promotions_slim.json \ - | jsawk -n 'out(this.promos.latest)'` - ;; - esac - export FORGE_INSTALLER="forge-$VERSION-$FORGE_VERSION-installer.jar" - export SERVER="forge-$VERSION-$FORGE_VERSION-universal.jar" + FORGE_INSTALLER="forge-$VERSION-$FORGE_VERSION-installer.jar" + SERVER="forge-$VERSION-$FORGE_VERSION-universal.jar" if [ ! -e $SERVER ]; then echo "Downloading $SERVER ..." @@ -113,4 +108,3 @@ if [ -n "$ICON" -a ! -e server-icon.png ]; then fi exec java $JVM_OPTS -jar $SERVER -