Skip to content

Commit 722d1ff

Browse files
committed
attempt to fix MC Paper
1 parent bd49fbd commit 722d1ff

1 file changed

Lines changed: 6 additions & 36 deletions

File tree

games/minecraft/installers/paper.sh

Lines changed: 6 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -8,41 +8,11 @@ USER_AGENT="nodebyte-minecraft/1.0 (support@nodebyte.host)"
88

99
echo "Installing Paper..."
1010

11-
# 1. Resolve latest Minecraft version if needed
12-
if [ "$VERSION" = "LATEST" ]; then
13-
VERSION=$(curl -s -H "User-Agent: $USER_AGENT" \
14-
https://fill.papermc.io/v3/projects/${PROJECT}/versions \
15-
| jq -r '.versions[-1]')
16-
fi
17-
18-
echo "Target MC version: $VERSION"
19-
20-
# 2. Get latest stable build list
21-
BUILDS_JSON=$(curl -s -H "User-Agent: $USER_AGENT" \
22-
"https://fill.papermc.io/v3/projects/${PROJECT}/versions/${VERSION}/builds")
11+
LATEST_BUILD=$(curl -s -H "User-Agent: $USER_AGENT" https://fill.papermc.io/v3/projects/${PROJECT}/versions/${MINECRAFT_VERSION}/builds | \
12+
jq -r 'map(select(.channel == "STABLE")) | .[0] | .id')
2313

24-
# 3. Extract latest STABLE build ID
25-
BUILD=$(echo "$BUILDS_JSON" \
26-
| jq -r 'map(select(.channel == "STABLE")) | .[-1].id')
27-
28-
if [ -z "$BUILD" ] || [ "$BUILD" = "null" ]; then
29-
echo "No stable build found for $VERSION"
30-
exit 1
14+
if [ "$LATEST_BUILD" != "null" ]; then
15+
echo "Latest stable build is $LATEST_BUILD"
16+
else
17+
echo "No stable build for version $MINECRAFT_VERSION found :("
3118
fi
32-
33-
echo "Selected build: $BUILD"
34-
35-
# 4. Get file info
36-
FILE=$(echo "$BUILDS_JSON" \
37-
| jq -r --arg id "$BUILD" '.[] | select(.id == ($id | tonumber)) | .downloads.application.name')
38-
39-
DOWNLOAD_URL=$(echo "$BUILDS_JSON" \
40-
| jq -r --arg id "$BUILD" '.[] | select(.id == ($id | tonumber)) | .downloads.application.url')
41-
42-
# 5. Download server jar
43-
echo "Downloading: $FILE"
44-
45-
curl -L -H "User-Agent: $USER_AGENT" \
46-
-o server.jar "$DOWNLOAD_URL"
47-
48-
echo "Paper installed successfully."

0 commit comments

Comments
 (0)