Automatically download minecraft server jars in one line (or one click)
- Download (Windows, Linux)
- Install via cargo:
cargo install mcdl
mcdl
- download latest server asserver.jar
mcdl -s
- download latest snapshot jarmcdl -sp
- print latest snapshot versionmcdl -n
- download latest server asserver-1.17.1.jar
mcdl -n 1.16.5
- download 1.16.5 asserver-1.16.5.jar
To create shortcuts that will automatically download the latest snapshot:
- Right click on
mcdl.exe
and click "Create Shortcut" - Right click on the newly created shortcut and click "Properties"
- In the "Target" text area, add "-s" to the end
You can replace the "-s" in step 3 with any of the other flags from the examples above or the usage below
USAGE:
mcdl.exe [FLAGS] [OPTIONS] [--] [VERSION]...
FLAGS:
-h, --help Prints help information
-i, --insecure Don't check the sha1 for the file
-l, --latest Use latest version, snapshot or not
-n, --named Use the version as the file name
-p, --print Print the version instead of downloading it
-q, --quiet Don't print any unnecessary output
-s, --snapshot Use the latest snapshot
-V, --version Prints version information
OPTIONS:
-r, --rename <rename>... Provide a file name (.jar) is appended
ARGS:
<VERSION>... Get a specific version
I thought it would be fun to write in Rust. If you wanted a single line of bash to do it, use one of these (requires jq
, curl
, and wget
):
-
Download latest available (snapshot or release) minecraft server.jar
curl -s $(curl -s "https://launchermeta.mojang.com/mc/game/version_manifest.json" | jq -r ".versions[0].url") | jq -r ".downloads.server.url" | xargs wget
-
Download latest release minecraft server.jar
curl -s $(curl -s "https://launchermeta.mojang.com/mc/game/version_manifest.json" | jq -r ".latest.release as \$v | .versions[] | select(.id == \$v) | .url") | jq -r ".downloads.server.url" | xargs wget
-
Download latest snapshot minecraft server.jar
curl -s $(curl -s "https://launchermeta.mojang.com/mc/game/version_manifest.json" | jq -r ".latest.snapshot as \$v | .versions[] | select(.id == \$v) | .url") | jq -r ".downloads.server.url" | xargs wget
@echo OFF
@REM if a version file exists, check if it's the latest, otherwise download the server
if exist version.txt (
goto checkVersion
) else (
goto download
)
:checkVersion
@REM compare latest version with the one that is installed
mcdl.exe -sp > temp.version.txt
fc /b temp.version.txt version.txt > nul
if errorlevel 1 (
@REM on different version - install the game
mcdl.exe -s
move /y temp.version.txt version.txt > nul
) else (
@REM on same version delete the temp file
del temp.version.txt > nul
)
goto server
@REM download the game and update the version
:download
mcdl.exe -s
mcdl.exe -sp > version.txt
@REM start the server
:server
java -Xmx4G -Xms2G -jar server.jar nogui
timeout /t 5
goto server
pause