Skip to content

Instantly share code, notes, and snippets.

@earthmeLon
Created December 9, 2020 19:19
Show Gist options
  • Save earthmeLon/b4dfab818362037687e5484ccdce5761 to your computer and use it in GitHub Desktop.
Save earthmeLon/b4dfab818362037687e5484ccdce5761 to your computer and use it in GitHub Desktop.
Determine and download latest Minecraft Server
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