added patina server support

This commit is contained in:
grey-cat-1908 2024-01-31 13:28:24 +03:00
parent b23cae74a1
commit 569bda3ce7
3 changed files with 41 additions and 11 deletions

View file

@ -13,6 +13,7 @@ services:
- localcache:/localcache - localcache:/localcache
ports: ports:
- "25565:25565/tcp" - "25565:25565/tcp"
- "25575:25575/tcp"
ssh: ssh:
network_mode: host network_mode: host
restart: always restart: always

View file

@ -8,9 +8,9 @@ enable-status=true
view-distance=7 view-distance=7
server-ip=0.0.0.0 server-ip=0.0.0.0
server-port=25565 server-port=25565
enable-rcon=false enable-rcon=true
simulation-distance=5 simulation-distance=5
rcon.password= rcon.password=admin
white-list=false white-list=false
sync-chunk-writes=false sync-chunk-writes=false
spawn-protection=1 spawn-protection=-1

View file

@ -1,5 +1,5 @@
get_pufferfish_server() { get_pufferfish_server() {
if [[ -z "$RAM" ]]; then if [[ -z "$MC_VERSION" ]]; then
MC_VERSION="1.20" MC_VERSION="1.20"
fi fi
majorVersion=$MC_VERSION majorVersion=$MC_VERSION
@ -10,11 +10,40 @@ get_pufferfish_server() {
shopt -s nullglob shopt -s nullglob
if [ -f "pufferfish.jar" ]; then if [ -f "server.jar" ]; then
rm "pufferfish.jar" rm "server.jar"
fi fi
wget --quiet -O pufferfish.jar -T 60 $PUFFERFISH_BUILD_DOWNLOAD_URL wget --quiet -O server.jar -T 60 $PUFFERFISH_BUILD_DOWNLOAD_URL
}
get_patina_server() {
if [[ -z "$MC_VERSION" ]]; then
MC_VERSION="1.20.4"
fi
PATINA_BUILD_DOWNLOAD_URL="https://github.com/PatinaMC/Patina/raw/releases/${MC_VERSION}/patina-paperclip-${MC_VERSION}-R0.1-SNAPSHOT-reobf.jar"
shopt -s nullglob
if [ -f "server.jar" ]; then
rm "server.jar"
fi
wget --quiet -O server.jar -T 60 $PATINA_BUILD_DOWNLOAD_URL
}
get_server() {
if [[ -z "$MC_SERVER" ]]; then
MC_SERVER="pufferfish"
fi
if [[ "$MC_SERVER" = "pufferfish" ]]; then
get_pufferfish_server
fi
if [[ "$MC_SERVER" = "patina" ]]; then
get_patina_server
fi
} }
if [[ ! -e "/localcache/conf-saved.txt" ]]; then if [[ ! -e "/localcache/conf-saved.txt" ]]; then
@ -24,11 +53,11 @@ fi
cd /usr/src/mcfiles/ || exit cd /usr/src/mcfiles/ || exit
if [[ ! -e "pufferfish.jar" ]]; then if [[ ! -e "server.jar" ]]; then
get_pufferfish_server get_server
else else
if [[ "$FORCE_REINSTALL" -eq 1 ]]; then if [[ "$FORCE_REINSTALL" -eq 1 ]]; then
get_pufferfish_server get_server
fi fi
fi fi
@ -36,6 +65,6 @@ if [[ -z "$RAM" ]]; then
RAM="1G" RAM="1G"
fi fi
java -Xms$RAM -Xmx$RAM -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 -jar pufferfish.jar nogui java -Xms$RAM -Xmx$RAM -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 -jar server.jar nogui
sleep 10 sleep 10