Created
December 9, 2020 19:19
-
-
Save earthmeLon/b4dfab818362037687e5484ccdce5761 to your computer and use it in GitHub Desktop.
Determine and download latest Minecraft Server
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function minecraft-latest-download(){ | |
export MINECRAFT_MANIFEST=$(curl -s https://launchermeta.mojang.com/mc/game/version_manifest.json) | |
export MINECRAFT_LATEST=$(echo "${MINECRAFT_MANIFEST}" | jq .latest.release) | |
export MINECRAFT_LATEST_VERSION=$(echo "${MINECRAFT_MANIFEST}" | jq -r .latest.release) | |
export MINECRAFT_LATEST_URL=$(echo "${MINECRAFT_MANIFEST}" | jq -r ".versions[] | select(.id==${MINECRAFT_LATEST}).url") | |
export MINECRAFT_SERVER_JAR=$(curl -s ${MINECRAFT_LATEST_URL} | jq -r .downloads.server.url) | |
echo "Retrieving $MINECRAFT_LATEST_VERSION from $MINECRAFT_SERVER_JAR" | |
curl ${MINECRAFT_SERVER_JAR} --output minecraft-$MINECRAFT_LATEST_VERSION-server.jar | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment