Last active
February 15, 2023 13:51
-
-
Save TheNewHEROBRINEX/82395a78b073c4aa4dc153c798749923 to your computer and use it in GitHub Desktop.
Start script for Paper based on the one of PocketMine-MP and which uses the JVM flags listed here
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
FLAGS="-Xms256M -Xmx3584M -XX:+UseG1GC -XX:+ParallelRefProcEnabled -XX:MaxGCPauseMillis=200 -XX:+UnlockExperimentalVMOptions -XX:+DisableExplicitGC -XX:+AlwaysPreTouch -XX:G1NewSizePercent=30 -XX:G1MaxNewSizePercent=40 -XX:G1HeapRegionSize=8M -XX:G1ReservePercent=20 -XX:G1HeapWastePercent=5 -XX:G1MixedGCCountTarget=4 -XX:InitiatingHeapOccupancyPercent=15 -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 $FLAGS" | |
DIR="$(cd -P "$( dirname "${BASH_SOURCE[0]}" )" && pwd)" | |
cd "$DIR" | |
while getopts "l" OPTION 2> /dev/null; do | |
case ${OPTION} in | |
l) | |
DO_LOOP="yes" | |
;; | |
\?) | |
break | |
;; | |
esac | |
done | |
LOOPS=0 | |
set +e | |
if [ "$DO_LOOP" == "yes" ]; then | |
while true; do | |
if [ ${LOOPS} -gt 0 ]; then | |
echo "Restarted $LOOPS times" | |
fi | |
java $FLAGS -jar paper-*.jar nogui | |
echo "To escape the loop, press CTRL+C now. Otherwise, wait 5 seconds for the server to restart." | |
echo "" | |
sleep 5 | |
((LOOPS++)) | |
done | |
else | |
exec java $FLAGS -jar paper-*.jar nogui | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment