I would like to request help to achieve the following:
My idea is an automatic updater of the Minecraft server, without human intervention
I tried to search the Internet, but I can not see how to do it
The code that was being used at the time was the following
cd /juegos/Minecraft/Release/
VER='curl -s https://launchermeta.mojang.com/mc/game/version_manifest.json | jsawk -n 'out(this.latest.release)''
echo $VER $1
wget -N https://s3.amazonaws.com/Minecraft.Download/versions/"$VER"/minecraft_server."$VER".jar
find . -type f \( -iname "minecraft_*.jar" ! -iname "*.$VER.jar" \) -delete
screen -A -m -d -S Minecraft_Release java -Xmx2048M -Xms1024M -jar minecraft_server.$VER.jar
The problem that currently exists is that the url does not work:
https://s3.amazonaws.com/Minecraft.Download/versions/"$VER"/minecraft_server."$VER".jar
I get the version with the
VER='curl -s https://launchermeta.mojang.com/mc/game/version_manifest.json | jsawk -n 'out(this.latest.release)''
Right now by accessing the link we see this
This code below belongs to version_manifest.json
"latest":
{
"release": "1.13.1",
"snapshot": "1.13.1"
},
"versions":[
{
"id": "1.13.1",
"type": "release",
"url": "https://launchermeta.mojang.com/v1/packages/bbed6214da465e25f769366835b7321d5380a1fa/1.13.1.json",
"time": "2018-09-10T15:44:04+00:00",
"releaseTime": "2018-08-22T14:03:42+00:00"},
{
"id": "1.13.1-pre2",
"type": "snapshot",
"url": "https://launchermeta.mojang.com/v1/packages/1594d6f7242d2065c2b61c242397f40677e5123c/1.13.1-pre2.json",
"time": "2018-09-06T10:02:33+00:00",
"releaseTime": "2018-08-20T13:52:09+00:00"
But I do not know how to get the value
"url": "https://launchermeta.mojang.com/v1/packages/bbed6214da465e25f769366835b7321d5380a1fa/1.13.1.json"
since I think the jsawk makes the code sh simpler
Once you get the url as a variable
" link "
I could already get your download url
{
"arguments":
{
"game":
[
"--username",
"${auth_player_name}",
"--version",
"${version_name}",
"--gameDir",
"${game_directory}",
"--assetsDir",
"${assets_root}",
"--assetIndex",
"${assets_index_name}",
"--uuid", "${auth_uuid}",
"--accessToken",
"${auth_access_token}",
"--userType",
"${user_type}",
"--versionType",
"${version_type}",
{
"rules":
[
{
"action": "allow",
"features":
{"is_demo_user": true}
}
],
"value": "--demo"
},
{
"rules":
[
{
"action": "allow",
"features":
{
"has_custom_resolution": true
}
}
],
"value":
[
"--width",
"${resolution_width}",
"--height",
"${resolution_height}"
]
}
],
"jvm":
[
{
"rules":
[
{
"action": "allow",
"os": {"name": "osx"}
}
],
"value":
["-XstartOnFirstThread"]
},
{
"rules":
[
{
"action": "allow",
"os": {"name": "windows"}
}
],
"value": "-XX:HeapDumpPath=MojangTricksIntelDriversForPerformance_javaw.exe_minecraft.exe.heapdump"
},
{
"rules":
[
{
"action": "allow",
"os": {"name": "windows", "version": "^10\."}
}
],
"value": ["-Dos.name=Windows 10", "-Dos.version=10.0"]
},
{
"rules":
[
{
"action": "allow",
"os": {"arch": "x86"}
}
],
"value": "-Xss1M"
},
"-Djava.library.path=${natives_directory}",
"-Dminecraft.launcher.brand=${launcher_name}",
"-Dminecraft.launcher.version=${launcher_version}",
"-cp",
"${classpath}"]},
"assetIndex":
{
"id": "1.13.1",
"sha1": "68182cfc27e6807e7230740abb9e5ea56db7d0bf",
"size": 181977,
"totalSize": 186655692,
"url": "https://launchermeta.mojang.com/v1/packages/68182cfc27e6807e7230740abb9e5ea56db7d0bf/1.13.1.json"},
"assets": "1.13.1",
"downloads":
{
"client":
{
"sha1": "8de235e5ec3a7fce168056ea395d21cbdec18d7c",
"size": 16088559,
"url": "https://launcher.mojang.com/v1/objects/8de235e5ec3a7fce168056ea395d21cbdec18d7c/client.jar"
},
"server":
{
"sha1": "fe123682e9cb30031eae351764f653500b7396c9",
"size": 33832589,
"url": "https://launcher.mojang.com/v1/objects/fe123682e9cb30031eae351764f653500b7396c9/server.jar"
}
The code continues
It will be achieved this
"server":
{
"sha1": "fe123682e9cb30031eae351764f653500b7396c9",
"size": 33832589,
Nueva variable >> "url": "https://launcher.mojang.com/v1/objects/fe123682e9cb30031eae351764f653500b7396c9/server.jar"
}
Is it possible to do it ?? I'm sorry but I do not control anything from json or jsaw. Nor am I going to lie that the first sh code looks for it on the Internet.
Warm regards and thanks to everyone who can help me