#!/bin/bash apiurl="https://papermc.io/api/v2/projects" paperproject="paper" # Get remote build info. apiurl="https://papermc.io/api/v2/projects" # Get list of projects. remotebuildresponse=$(curl -s "${apiurl}") # Get list of Minecraft versions for project. remotebuildresponseproject=$(curl -s "${apiurl}/${paperproject}") # Get latest Minecraft: Java Edition version or user-specified version. remotebuildmcversion=$(echo "${remotebuildresponseproject}" | jq -r '.versions[-1]') # Check if remotebuildmcversion is set and not empty if [ -n "${remotebuildmcversion}" ]; then # Get list of paper builds for specific Minecraft: Java Edition version. remotebuildresponsemcversion=$(curl -s "${apiurl}/paper/versions/${remotebuildmcversion}") # Get latest paper build for specific Minecraft: Java Edition version. remotebuildpaperversion=$(echo "${remotebuildresponsemcversion}" | jq -r '.builds[-1]') # Get various info about the paper build. remotebuildresponseversion=$(curl -s "${apiurl}/${paperproject}/versions/${remotebuildmcversion}/builds/${remotebuildpaperversion}") remotebuildfilename=$(echo "${remotebuildresponseversion}" | jq -r '.downloads.application.name') remotebuildhash=$(echo "${remotebuildresponseversion}" | jq -r '.downloads.application.sha256') remotebuildurl="${apiurl}/${paperproject}/versions/${remotebuildmcversion}/builds/${remotebuildpaperversion}/downloads/${remotebuildfilename}" # Combines Minecraft: Java Edition version and paper build. e.g 1.16.5-456 remotebuildversion="${remotebuildmcversion}-${remotebuildpaperversion}" echo "$remotebuildurl" echo $remotebuildurl > /home/bots/MCserverURLs/paper_url.txt else echo "Failed to determine the Minecraft version. Please check your input or the PaperMC API response." fi exit