mirror of
https://github.com/itzg/docker-minecraft-server.git
synced 2026-07-13 03:55:09 +00:00
Add Leaf support (#3470)
Co-authored-by: Geoff Bourne <itzgeoff@gmail.com>
This commit is contained in:
@@ -85,6 +85,23 @@ Extra variables:
|
|||||||
- `USE_FLARE_FLAGS=false` : set to true to add appropriate flags for the built-in [Flare](https://blog.airplane.gg/flare) profiler
|
- `USE_FLARE_FLAGS=false` : set to true to add appropriate flags for the built-in [Flare](https://blog.airplane.gg/flare) profiler
|
||||||
- `PURPUR_DOWNLOAD_URL=<url>` : set URL to download Purpur from custom URL.
|
- `PURPUR_DOWNLOAD_URL=<url>` : set URL to download Purpur from custom URL.
|
||||||
|
|
||||||
|
### Leaf
|
||||||
|
|
||||||
|
A [Leaf server](https://www.leafmc.one/) is a Paper fork focused on performance improvements and low-level optimizations for smoother gameplay.
|
||||||
|
|
||||||
|
To use a Leaf server, set the environment variable `TYPE` to `"LEAF"`.
|
||||||
|
|
||||||
|
-e TYPE=LEAF
|
||||||
|
|
||||||
|
!!! note
|
||||||
|
|
||||||
|
The `VERSION` variable is used to select the Minecraft version to run.
|
||||||
|
To specify a particular Leaf build, use `LEAF_BUILD`.
|
||||||
|
|
||||||
|
By default the latest build will be used; however, a specific build number can be selected by setting `LEAF_BUILD`, such as
|
||||||
|
|
||||||
|
-e VERSION=1.21.4 -e LEAF_BUILD=441
|
||||||
|
|
||||||
### Folia
|
### Folia
|
||||||
|
|
||||||
A [Folia server](https://papermc.io/software/folia) can be used by setting the environment variable `TYPE` to "FOLIA".
|
A [Folia server](https://papermc.io/software/folia) can be used by setting the environment variable `TYPE` to "FOLIA".
|
||||||
|
|||||||
@@ -278,6 +278,10 @@ case "${TYPE^^}" in
|
|||||||
exec "${SCRIPTS:-/}start-deployCrucible" "$@"
|
exec "${SCRIPTS:-/}start-deployCrucible" "$@"
|
||||||
;;
|
;;
|
||||||
|
|
||||||
|
LEAF)
|
||||||
|
exec "${SCRIPTS:-/}start-deployLeaf" "$@"
|
||||||
|
;;
|
||||||
|
|
||||||
*)
|
*)
|
||||||
logError "Invalid TYPE: '$TYPE'"
|
logError "Invalid TYPE: '$TYPE'"
|
||||||
logError "Must be: VANILLA, FORGE, BUKKIT, SPIGOT, PAPER, FOLIA, PURPUR, FABRIC, QUILT,"
|
logError "Must be: VANILLA, FORGE, BUKKIT, SPIGOT, PAPER, FOLIA, PURPUR, FABRIC, QUILT,"
|
||||||
@@ -286,4 +290,4 @@ case "${TYPE^^}" in
|
|||||||
exit 1
|
exit 1
|
||||||
;;
|
;;
|
||||||
|
|
||||||
esac
|
esac
|
||||||
|
|||||||
@@ -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