Skip to content

Instantly share code, notes, and snippets.

@danielledeleo
Created April 16, 2024 20:45
Show Gist options
  • Save danielledeleo/9a6f03fbdc303f99c4c4b7c84aec2349 to your computer and use it in GitHub Desktop.
Save danielledeleo/9a6f03fbdc303f99c4c4b7c84aec2349 to your computer and use it in GitHub Desktop.
PaperMC startup script
#!/bin/bash
set -e
VERSION=1.20.4
LATEST_JSON=$(curl -X 'GET' \
"https://api.papermc.io/v2/projects/paper/versions/$VERSION/builds" \
-H 'accept: application/json' \
| jq '.builds | last ')
BUILD=$(echo $LATEST_JSON \
| jq -r '.build')
JAR=$(echo $LATEST_JSON \
| jq -r '.downloads.application.name')
echo "Latest Paper version: $JAR"
if [[ ! -f "$JAR" ]]; then
wget "https://api.papermc.io/v2/projects/paper/versions/$VERSION/builds/$BUILD/downloads/$JAR"
else
echo "Already have latest version"
fi
screen -amdS paper java \
-Xms12G \
-Xmx18G \
-XX:+UseG1GC \
-XX:+ParallelRefProcEnabled \
-XX:MaxGCPauseMillis=200 \
-XX:+UnlockExperimentalVMOptions \
-XX:+DisableExplicitGC \
-XX:+AlwaysPreTouch \
-XX:G1NewSizePercent=40 \
-XX:G1MaxNewSizePercent=50 \
-XX:G1HeapRegionSize=16M \
-XX:G1ReservePercent=15 \
-XX:G1HeapWastePercent=5 \
-XX:G1MixedGCCountTarget=4 \
-XX:InitiatingHeapOccupancyPercent=20 \
-XX:G1MixedGCLiveThresholdPercent=90 \
-XX:G1RSetUpdatingPauseTimePercent=5 \
-XX:SurvivorRatio=32 \
-XX:+PerfDisableSharedMem \
-XX:MaxTenuringThreshold=1 \
-Dusing.aikars.flags=https://mcflags.emc.gs \
-Daikars.new.flags=true \
-jar $JAR \
--nogui
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment