summaryrefslogtreecommitdiff
path: root/papermc_getlatest.sh
blob: f8d0ca95a0710b360cfc9403b27e68e99af0111e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
PROJECT="paper"
MINECRAFT_VERSION="1.20.4"

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}-${MINECRAFT_VERSION}-${LATEST_BUILD}.jar

PAPERMC_URL="https://api.papermc.io/v2/projects/${PROJECT}/versions/${MINECRAFT_VERSION}/builds/${LATEST_BUILD}/downloads/${JAR_NAME}"

# Download the latest PaperMC version
curl -o /opt/minecraft/server.jar $PAPERMC_URL
echo "Downloads completed"