in the script showed here it asks for a project entry but uses it only once and does not implement it in the way that it could support all projects.
this is the script listed on the docs:
#!/bin/bash
PROJECT="paper"
MINECRAFT_VERSION="1.20.4"
LATEST_VERSION=$(curl -s https://api.papermc.io/v2/projects/paper | \
jq -r '.versions[-1]')
LATEST_BUILD=$(curl -s https://api.papermc.io/v2/projects/${PROJECT}/versions/${MINECRAFT_VERSION}/builds | \
jq -r '.builds | map(select(.channel == "default") | .build) | .[-1]')
JAR_NAME=paper-${LATEST_VERSION}-${LATEST_BUILD}.jar
PAPERMC_URL="https://api.papermc.io/v2/projects/paper/versions/${LATEST_VERSION}/builds/${LATEST_BUILD}/downloads/${JAR_NAME}"
# Download the latest PaperMC version
curl -o server.jar $PAPERMC_URL
echo "Downloads completed"
Let me list the flaws
- line 5:
LATEST_VERSION=$(curl -s https://api.papermc.io/v2/projects/paper | \ the url is hardcoded to the paper project
- line 12:
JAR_NAME=paper-${LATEST_VERSION}-${LATEST_BUILD}.jar the filename is hardcoded to the paper project
- line 14:
PAPERMC_URL="https://api.papermc.io/v2/projects/paper/versions/${LATEST_VERSION}/builds/${LATEST_BUILD}/downloads/${JAR_NAME}" the url is hardcoded to the paper project.
This is a slightly modified version of the script that does support all projects and does not hard code any projects into the script
#!/bin/bash
PROJECT="paper"
MINECRAFT_VERSION="1.20.4"
LATEST_VERSION=$(curl -s https://api.papermc.io/v2/projects/${PROJECT} | \
jq -r '.versions[-1]')
LATEST_BUILD=$(curl -s https://api.papermc.io/v2/projects/${PROJECT}/versions/${MINECRAFT_VERSION}/builds | \
jq -r '.builds | map(select(.channel == "default") | .build) | .[-1]')
JAR_NAME=${PROJECT}-${LATEST_VERSION}-${LATEST_BUILD}.jar
PAPERMC_URL="https://api.papermc.io/v2/projects/${PROJECT}/versions/${LATEST_VERSION}/builds/${LATEST_BUILD}/downloads/${JAR_NAME}"
# Download the latest PaperMC version
curl -o server.jar $PAPERMC_URL
echo "Downloads completed"
in the script showed here it asks for a
projectentry but uses it only once and does not implement it in the way that it could support all projects.this is the script listed on the docs:
Let me list the flaws
LATEST_VERSION=$(curl -s https://api.papermc.io/v2/projects/paper | \the url is hardcoded to the paper projectJAR_NAME=paper-${LATEST_VERSION}-${LATEST_BUILD}.jarthe filename is hardcoded to the paper projectPAPERMC_URL="https://api.papermc.io/v2/projects/paper/versions/${LATEST_VERSION}/builds/${LATEST_BUILD}/downloads/${JAR_NAME}"the url is hardcoded to the paper project.This is a slightly modified version of the script that does support all projects and does not hard code any projects into the script