parent
9bf20e6af3
commit
da3f10fddd
2 changed files with 32 additions and 11 deletions
@ -1,16 +1,37 @@ |
||||
import requests |
||||
import sys |
||||
|
||||
version = "1.18.1" |
||||
destPath = "../server/paper.jar" |
||||
|
||||
base = "https://papermc.io/api/v2/projects/paper/versions" |
||||
r = requests.get(f"{base}/{version}") |
||||
def get_paper(version, destination): |
||||
print(f"Trying to fetch {version} into {destination}") |
||||
|
||||
build = max(r.json()['builds']) |
||||
r = requests.get(f"{base}/{version}/builds/{build}") |
||||
base = "https://papermc.io/api/v2/projects/paper/versions" |
||||
r = requests.get(f"{base}/{version}") |
||||
if not r.ok: |
||||
print(f"Cannot find version {version}, aborting.") |
||||
return |
||||
|
||||
download = r.json()['downloads']['application']['name'] |
||||
content = requests.get(f"{base}/{version}/builds/{build}/downloads/{download}").content |
||||
build = max(r.json()['builds']) |
||||
r = requests.get(f"{base}/{version}/builds/{build}") |
||||
|
||||
with open(destPath, "wb") as file: |
||||
file.write(content) |
||||
download = r.json()['downloads']['application']['name'] |
||||
content = requests.get(f"{base}/{version}/builds/{build}/downloads/{download}").content |
||||
|
||||
with open(destination, "wb") as jarFile: |
||||
jarFile.write(content) |
||||
|
||||
|
||||
def main(argv): |
||||
if len(argv) == 1: |
||||
print("No version defined!") |
||||
return |
||||
version = argv[1] |
||||
if len(argv) == 2: |
||||
destination = "paper.jar" |
||||
else: |
||||
destination = argv[2] |
||||
get_paper(version, destination) |
||||
|
||||
|
||||
if __name__ == "__main__": |
||||
main(sys.argv) |
||||
|
@ -1,2 +1,2 @@ |
||||
cd server || exit |
||||
java -agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=5005 -jar spigot.jar nogui |
||||
java -agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=5005 -jar paper.jar nogui |
Loading…
Reference in new issue