2个版本
0.0.2 | 2021年10月26日 |
---|---|
0.0.1 | 2021年10月26日 |
#837 在 游戏
9KB
145 行代码
MCDL
一键(或一键)自动下载Minecraft服务器jar文件
安装
- 下载(Windows, Linux)
- 通过cargo安装:
cargo install mcdl
示例
mcdl
- 下载最新服务器作为server.jar
mcdl -s
- 下载最新快照jarmcdl -sp
- 打印最新快照版本mcdl -n
- 下载最新服务器作为server-1.17.1.jar
mcdl -n 1.16.5
- 下载1.16.5作为server-1.16.5.jar
用法
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
为什么?
我觉得用Rust写很有趣。如果你想用一行bash命令来做,请使用以下之一(需要 jq
, curl
, 和 wget
)
-
下载最新的可用的(快照或发布)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
-
下载最新的发布版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
-
下载最新的快照版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
依赖
~3–4.5MB
~108K SLoC