Skip to content

Instantly share code, notes, and snippets.

@alexitx
Last active September 7, 2024 12:31
Show Gist options
  • Save alexitx/1c84c48192104b30010a5d46c0c45700 to your computer and use it in GitHub Desktop.
Save alexitx/1c84c48192104b30010a5d46c0c45700 to your computer and use it in GitHub Desktop.
Minecraft server scripts

Minecraft server scripts

Info

Simple scripts containing bare minimum functionality for setting up Paper servers and Waterfall proxies as quickly as possible mainly in testing environment.

start.sh - Unix script for running a Paper server
start.cmd - Windows script for running a Paper server
start-proxy.sh - Unix script for running a Waterfall proxy
start-proxy.cmd - Windows script for running a Waterfall proxy

update.sh - Unix script for downloading and updating Paper
update.cmd - Windows script for downloading and updating Paper
update-proxy.sh - Unix script for downloading and updating Waterfall
update-proxy.cmd - Windows script for downloading and updating Waterfall

Usage & Links

Paste the chosen script into a new text file and save it with the corresponding file extension, or download with curl using a direct URL: $ curl -LO <URL>
Modify memory or any variables to your linking.

Shortened URL for each script's filename is available like so: https://s.alexitx.com/start.sh

Link to this gist: https://s.alexitx.com/mss

@echo off
setlocal
set "JAR=proxy.jar"
set "MEM=256M"
set "FLAGS=-XX:+UseG1GC -XX:G1HeapRegionSize=4M -XX:+UnlockExperimentalVMOptions -XX:+ParallelRefProcEnabled -XX:+AlwaysPreTouch -XX:+PerfDisableSharedMem -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8"
set "start_cmd=java -Xms%MEM% -Xmx%MEM% %FLAGS% -jar %JAR%"
cd /d "%~dp0"
%start_cmd%
#!/bin/bash
JAR="proxy.jar"
MEM="256M"
FLAGS="-XX:+UseG1GC -XX:G1HeapRegionSize=4M -XX:+UnlockExperimentalVMOptions -XX:+ParallelRefProcEnabled -XX:+AlwaysPreTouch -XX:+PerfDisableSharedMem -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8"
start_cmd="java -Xms${MEM} -Xmx${MEM} ${FLAGS} -jar ${JAR}"
cd "$(dirname "$0")"
$start_cmd
@echo off
rem Using Aikar's flags: https://mcflags.emc.gs
setlocal
set "JAR=server.jar"
set "MEM=2G"
set "FLAGS=-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 -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8"
set "ARGS=nogui"
set "start_cmd=java -Xms%MEM% -Xmx%MEM% %FLAGS% -jar %JAR% %ARGS%"
cd /d "%~dp0"
if not exist "eula.txt" (
echo eula=true>"eula.txt"
)
%start_cmd%
#!/bin/bash
# Using Aikar's flags: https://mcflags.emc.gs
JAR="server.jar"
MEM="2G"
FLAGS="-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 -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8"
ARGS="nogui"
start_cmd="java -Xms${MEM} -Xmx${MEM} ${FLAGS} -jar ${JAR} ${ARGS}"
cd "$(dirname "$0")"
if [ ! -f "eula.txt" ]; then
echo "eula=true" > "eula.txt"
fi
$start_cmd
@echo off
setlocal
set "FILE=proxy.jar"
set "VERSION=1.16"
cd /d "%~dp0"
curl -Lo "%FILE%" -z "%FILE%" "https://papermc.io/api/v1/waterfall/%VERSION%/latest/download"
#!/bin/bash
FILE="proxy.jar"
VERSION="1.16"
cd "$(dirname "$0")"
curl -Lo "${FILE}" -z "${FILE}" "https://papermc.io/api/v1/waterfall/${VERSION}/latest/download"
@echo off
setlocal
set "FILE=server.jar"
set "VERSION=1.16.5"
cd /d "%~dp0"
curl -Lo "%FILE%" -z "%FILE%" "https://papermc.io/api/v1/paper/%VERSION%/latest/download"
#!/bin/bash
FILE="server.jar"
VERSION="1.16.5"
cd "$(dirname "$0")"
curl -Lo "${FILE}" -z "${FILE}" "https://papermc.io/api/v1/paper/${VERSION}/latest/download"
@Toxywolf001
Copy link

All these codes can be operated on a computer in local mode, right?

@alexitx
Copy link
Author

alexitx commented Sep 7, 2024

The start scripts will work fine as long as you download the server manually. The download/update scripts won't work because they aren't being updated anymore and the API changed years ago.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment