custom server support && made paper default

This commit is contained in:
mrkrk 2024-08-31 15:21:46 +03:00 committed by GitHub
parent f76d287811
commit bbf7a8b2c0
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -10,6 +10,7 @@ get_paper_server() {
if [[ -z "$MC_VERSION" ]]; then if [[ -z "$MC_VERSION" ]]; then
MC_VERSION="1.21.1" MC_VERSION="1.21.1"
fi fi
majorVersion=$MC_VERSION majorVersion=$MC_VERSION
PAPER_BUILD_JSON=$(curl -X GET -s "https://api.papermc.io/v2/projects/paper/versions/${MC_VERSION}/builds") PAPER_BUILD_JSON=$(curl -X GET -s "https://api.papermc.io/v2/projects/paper/versions/${MC_VERSION}/builds")
PAPER_BUILD_FILENAME=$(jq -n "$PAPER_BUILD_JSON" | jq -jc '.builds[-1].downloads.application.name') PAPER_BUILD_FILENAME=$(jq -n "$PAPER_BUILD_JSON" | jq -jc '.builds[-1].downloads.application.name')
@ -25,6 +26,7 @@ get_pufferfish_server() {
if [[ -z "$MC_VERSION" ]]; then if [[ -z "$MC_VERSION" ]]; then
MC_VERSION="1.21" MC_VERSION="1.21"
fi fi
majorVersion=$MC_VERSION majorVersion=$MC_VERSION
PUFFERFISH_BUILD_JSON=$(curl -X GET -s "https://ci.pufferfish.host/job/Pufferfish-${majorVersion}/lastSuccessfulBuild/api/json") PUFFERFISH_BUILD_JSON=$(curl -X GET -s "https://ci.pufferfish.host/job/Pufferfish-${majorVersion}/lastSuccessfulBuild/api/json")
PUFFERFISH_BUILD_URL=$(jq -n "$PUFFERFISH_BUILD_JSON" | jq -jc '.url // empty' ) PUFFERFISH_BUILD_URL=$(jq -n "$PUFFERFISH_BUILD_JSON" | jq -jc '.url // empty' )
@ -48,9 +50,17 @@ get_purpur_server() {
wget --quiet -O server.jar -T 60 $PURPUR_BUILD_DOWNLOAD_URL wget --quiet -O server.jar -T 60 $PURPUR_BUILD_DOWNLOAD_URL
} }
get_custom_server() {
if [[ -z "$CUSTOM_BUILD_URL" ]]; then
get_paper_server
else
wget --quiet -O server.jar -T 60 $CUSTOM_BUILD_URL
fi
}
get_server() { get_server() {
if [[ -z "$MC_SERVER" ]]; then if [[ -z "$MC_SERVER" ]]; then
MC_SERVER="purpur" MC_SERVER="paper"
fi fi
if [[ "$MC_SERVER" = "pufferfish" ]]; then if [[ "$MC_SERVER" = "pufferfish" ]]; then
@ -62,6 +72,9 @@ get_server() {
if [[ "$MC_SERVER" = "paper" ]]; then if [[ "$MC_SERVER" = "paper" ]]; then
get_paper_server get_paper_server
fi fi
if [[ "$MC_SERVER" = "custom" ]]; then
get_custom_server
fi
} }
if [[ ! -e "/localcache/conf-saved.txt" ]]; then if [[ ! -e "/localcache/conf-saved.txt" ]]; then