mirror of
https://github.com/itzg/docker-minecraft-server.git
synced 2026-02-26 19:06:25 +00:00
Add Leaf support (#3470)
Co-authored-by: Geoff Bourne <itzgeoff@gmail.com>
This commit is contained in:
@@ -278,6 +278,10 @@ case "${TYPE^^}" in
|
||||
exec "${SCRIPTS:-/}start-deployCrucible" "$@"
|
||||
;;
|
||||
|
||||
LEAF)
|
||||
exec "${SCRIPTS:-/}start-deployLeaf" "$@"
|
||||
;;
|
||||
|
||||
*)
|
||||
logError "Invalid TYPE: '$TYPE'"
|
||||
logError "Must be: VANILLA, FORGE, BUKKIT, SPIGOT, PAPER, FOLIA, PURPUR, FABRIC, QUILT,"
|
||||
@@ -286,4 +290,4 @@ case "${TYPE^^}" in
|
||||
exit 1
|
||||
;;
|
||||
|
||||
esac
|
||||
esac
|
||||
|
||||
51
scripts/start-deployLeaf
Normal file
51
scripts/start-deployLeaf
Normal file
@@ -0,0 +1,51 @@
|
||||
#!/bin/bash
|
||||
|
||||
# shellcheck source=start-utils
|
||||
. "${SCRIPTS:-$(dirname "$0")}/start-utils"
|
||||
set -o pipefail
|
||||
set -e
|
||||
isDebugging && set -x
|
||||
|
||||
resolveVersion
|
||||
: "${LEAF_BUILD:=LATEST}"
|
||||
|
||||
# Docs at https://api.leafmc.one/docs/swagger-ui/index.html
|
||||
leafApiUrl="https://api.leafmc.one/v2/projects/leaf"
|
||||
leafDownloadsPage="https://www.leafmc.one/download"
|
||||
|
||||
if ! get --exists "${leafApiUrl}/versions/${VERSION}/builds"; then
|
||||
logError "Leaf builds do not exist for ${VERSION}"
|
||||
logError " check ${leafDownloadsPage} for available versions"
|
||||
logError " and set VERSION accordingly"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [[ "${LEAF_BUILD^^}" == "LATEST" ]]; then
|
||||
# Get the latest build number from the API, which will be the last object in the builds array
|
||||
if ! buildNumber=$(
|
||||
get --json-path '$.builds[-1].build' "${leafApiUrl}/versions/${VERSION}/builds"
|
||||
); then
|
||||
logError "failed to list Leaf builds for ${VERSION}"
|
||||
exit 1
|
||||
fi
|
||||
LEAF_BUILD="${buildNumber}"
|
||||
fi
|
||||
|
||||
if ! filename=$(
|
||||
get --json-path='$.downloads.primary.name' --json-value-when-missing="" "${leafApiUrl}/versions/${VERSION}/builds/${LEAF_BUILD}"
|
||||
); then
|
||||
logError "Failed to retrieve download filename"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
SERVER="/data/$filename"
|
||||
|
||||
if ! get --skip-existing --log-progress-each -o "${SERVER}" "${leafApiUrl}/versions/${VERSION}/builds/${LEAF_BUILD}/downloads/${filename}"; then
|
||||
logError "Failed to download"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
export FAMILY=SPIGOT
|
||||
export SERVER
|
||||
|
||||
exec "${SCRIPTS:-/}start-spiget" "$@"
|
||||
Reference in New Issue
Block a user