This commit is contained in:
Leonard Steppy 2025-09-18 16:15:35 +02:00
commit 405cd85f07
7 changed files with 141 additions and 0 deletions

2
bungee/launch.sh Executable file
View File

@ -0,0 +1,2 @@
#!/usr/bin/env bash
java -Xms1G -Xmx2G -agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=*:5006 -jar BungeeCord.jar nogui

7
bungee/start.sh Executable file
View File

@ -0,0 +1,7 @@
#!/usr/bin/env bash
while true
do
./launch.sh
echo sleeping...
sleep 5
done

33
configure.sh Executable file
View File

@ -0,0 +1,33 @@
#!/usr/bin/env bash
if [ "$1" == "velocity" ]; then
#disable online-mode
sed -ie "/online-mode/c\online-mode=false" server.properties
#change port to 25566
sed -ie "/server-port/c\server-port=25566" server.properties
#enable velocity
yq -iy ".proxies.velocity.enabled = true" config/paper-global.yml
#disable bungeecord
yq -iy ".settings.bungeecord = false" spigot.yml
elif [ "$1" == "bungeecord" ]; then
#disable online-mode
sed -ie "/online-mode/c\online-mode=false" server.properties
#change port to 25566
sed -ie "/server-port/c\server-port=25566" server.properties
#disable velocity
yq -iy ".proxies.velocity.enabled = false" config/paper-global.yml
#enable bungeecord
yq -iy ".settings.bungeecord = true" spigot.yml
elif [ "$1" == "standalone" ]; then
#enable online-mode
sed -ie "/online-mode/c\online-mode=true" server.properties
#change port to 25565
sed -ie "/server-port/c\server-port=25565" server.properties
#disable velocity
yq -iy ".proxies.velocity.enabled = false" config/paper-global.yml
#disable bungeecord
yq -iy ".settings.bungeecord = false" spigot.yml
else
echo "Invalid argument, possible values are: [velocity, standalone, bungeecord]"
exit 1
fi

3
launch.sh Executable file
View File

@ -0,0 +1,3 @@
#!/usr/bin/env sh
java -Xms2048M -Xmx2048M -XX:+AlwaysPreTouch -XX:+DisableExplicitGC -XX:+ParallelRefProcEnabled -XX:+PerfDisableSharedMem -XX:+UnlockExperimentalVMOptions -XX:+UseG1GC -XX:G1HeapRegionSize=8M -XX:G1HeapWastePercent=5 -XX:G1MaxNewSizePercent=40 -XX:G1MixedGCCountTarget=4 -XX:G1MixedGCLiveThresholdPercent=90 -XX:G1NewSizePercent=30 -XX:G1RSetUpdatingPauseTimePercent=5 -XX:G1ReservePercent=20 -XX:InitiatingHeapOccupancyPercent=15 -XX:MaxGCPauseMillis=200 -XX:MaxTenuringThreshold=1 -XX:SurvivorRatio=32 -Dusing.aikars.flags=https://mcflags.emc.gs -Daikars.new.flags=true -agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=*:5005 -jar paper.jar nogui

2
proxy/launch.sh Executable file
View File

@ -0,0 +1,2 @@
#!/usr/bin/env bash
java -Xms1G -Xmx1G -XX:+UseG1GC -XX:G1HeapRegionSize=4M -XX:+UnlockExperimentalVMOptions -XX:+ParallelRefProcEnabled -XX:+AlwaysPreTouch -XX:MaxInlineLevel=15 -agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=*:5006 -jar velocity.jar

7
proxy/start.sh Executable file
View File

@ -0,0 +1,7 @@
#!/usr/bin/env bash
while true
do
./launch.sh
echo sleeping...
sleep 5
done

87
start.sh Executable file
View File

@ -0,0 +1,87 @@
#!/usr/bin/env bash
PROXY_SCREEN="proxy"
proxy=false
bungee=false
help=false
for arg in "$@"; do
case "$arg" in
"--proxy")
proxy=true
if $bungee; then
echo "--proxy can't be used together with --bungee"
exit 1
fi
;;
"--bungee")
bungee=true
if $proxy; then
echo "--bungee can't be used together with --proxy"
exit 1
fi
;;
"--help")
help=true
;;
*)
echo "Unknown argument. Use --help to see all options"
exit 1
;;
esac
done
if $help; then
echo "Create a start loop for the minecraft server, additionally behind a velocity proxy or bungeecord proxy"
echo "--help Show help"
echo "--proxy Start the server behind a velocity proxy"
echo "--bungee Start the server behind a bungeecord proxy"
exit
fi
if $proxy; then
./configure.sh velocity
# create proxy screen if it doesn't exist yet
screen -ls | grep -q "$PROXY_SCREEN" || screen -dmS "$PROXY_SCREEN"
# start the proxy
screen -S "$PROXY_SCREEN" -X stuff "cd $(pwd)/proxy; ./launch.sh\n"
echo "The velocity proxy has been started in the screen '$PROXY_SCREEN'"
elif $bungee; then
./configure.sh bungeecord
# create proxy screen if it doesn't exist yet
screen -ls | grep -q "$PROXY_SCREEN" || screen -dmS "$PROXY_SCREEN"
# start the proxy
screen -S "$PROXY_SCREEN" -X stuff "cd $(pwd)/bungee; ./launch.sh\n"
echo "The bungeecord proxy has been started in the screen '$PROXY_SCREEN'"
else
./configure.sh standalone
fi
trap cleanup SIGINT
cleanup() {
if $proxy; then
# stop the proxy
screen -S "$PROXY_SCREEN" -X stuff "end\n"
echo "The proxy has been stopped"
fi
exit
}
while true
do
echo starting server...
./launch.sh
echo sleeping...
sleep 5
done