I'm writing a bash script to manage a vanilla server install on my eeePC. Right now I've been using http://s3.amazonaws.com/MinecraftDownload/launcher/minecraft_server.jar
to get the minecraft_server jar. It seems to only be getting the 1.5.2 server version instead of the 1.6.2 server version.
Any ideas as to how I can grab the latest stable version through a similar url?
Best Answer
Full Instructions
I recently decompiled the launcher for this very reason, to manage automatic updates for my server wrapper with their new naming convention.
I found the file they use to work out what the current version is and the URL to it:
https://launchermeta.mojang.com/mc/game/version_manifest.json
This file includes the following (as of this answer):
That file also has a "versions" array. Loop through this to find the version you are looking for in the
id
field. It is also usually the first entry in this array, so you could address itversions[0]
. Grab theurl
value and fetch that file which contains the following useful key:Therefore, the URL you need is contained in
downloads.server.url
.Summary
GET
https://launchermeta.mojang.com/mc/game/version_manifest.jsonGET
versions[0].url
GET
downloads.server.url
Outdated instructions - for posterity only
Which you can then use to extrapolate the latest version for release and snapshots using this scheme:
Using this method you don't need to download the jar/exe file every time, just the json file and then if it's changed, you can grab the appropriate jar.