mirror of
https://github.com/itzg/docker-minecraft-server.git
synced 2026-08-30 18:57:15 +00:00
Add Folia support (#2081)
This commit is contained in:
@@ -459,6 +459,24 @@ If you have attached a host directory to the `/data` volume, then you can instal
|
|||||||
|
|
||||||
[You can also auto-download plugins using `SPIGET_RESOURCES`.](#auto-downloading-spigotmcbukkitpapermc-plugins-with-spiget)
|
[You can also auto-download plugins using `SPIGET_RESOURCES`.](#auto-downloading-spigotmcbukkitpapermc-plugins-with-spiget)
|
||||||
|
|
||||||
|
### Running a Folia server
|
||||||
|
|
||||||
|
Enable Folia server mode by adding a `-e TYPE=FOLIA` to your command-line.
|
||||||
|
|
||||||
|
By default, the container will run the latest build of [Folia server](https://papermc.io/downloads) but you can also choose to run a specific build with `-e FOLIABUILD=26`.
|
||||||
|
|
||||||
|
docker run -d -v /path/on/host:/data \
|
||||||
|
-e TYPE=FOLIA \
|
||||||
|
-p 25565:25565 -e EULA=TRUE --name mc itzg/minecraft-server
|
||||||
|
|
||||||
|
If you are hosting your own copy of Folia you can override the download URL with `FOLIA_DOWNLOAD_URL=<url>`.
|
||||||
|
|
||||||
|
If you have attached a host directory to the `/data` volume, then you can install plugins via the `plugins` subdirectory. You can also [attach a `/plugins` volume](#optional-plugins-mods-and-config-attach-points). If you add plugins while the container is running, you'll need to restart it to pick those up.
|
||||||
|
|
||||||
|
[You can also auto-download plugins using `SPIGET_RESOURCES`.](#auto-downloading-spigotmcbukkitpapermc-plugins-with-spiget)
|
||||||
|
|
||||||
|
> NOTE: The Folia type inherits from the Paper type. Paper's variables will override the Folia ones.
|
||||||
|
|
||||||
### Running a Pufferfish server
|
### Running a Pufferfish server
|
||||||
|
|
||||||
A [Pufferfish](https://github.com/pufferfish-gg/Pufferfish) server, which is "a highly optimized Paper fork designed for large servers requiring both maximum performance, stability, and "enterprise" features."
|
A [Pufferfish](https://github.com/pufferfish-gg/Pufferfish) server, which is "a highly optimized Paper fork designed for large servers requiring both maximum performance, stability, and "enterprise" features."
|
||||||
|
|||||||
@@ -176,6 +176,10 @@ case "${TYPE^^}" in
|
|||||||
exec "${SCRIPTS:-/}start-deployPaper" "$@"
|
exec "${SCRIPTS:-/}start-deployPaper" "$@"
|
||||||
;;
|
;;
|
||||||
|
|
||||||
|
FOLIA)
|
||||||
|
exec "${SCRIPTS:-/}start-deployFolia" "$@"
|
||||||
|
;;
|
||||||
|
|
||||||
FORGE)
|
FORGE)
|
||||||
evaluateJavaCompatibilityForForge
|
evaluateJavaCompatibilityForForge
|
||||||
exec "${SCRIPTS:-/}start-deployForge" "$@"
|
exec "${SCRIPTS:-/}start-deployForge" "$@"
|
||||||
|
|||||||
@@ -0,0 +1,11 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
if [[ $FOLIA_DOWNLOAD_URL ]]; then
|
||||||
|
export PAPER_DOWNLOAD_URL="$FOLIA_DOWNLOAD_URL"
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [[ $FOLIABUILD ]]; then
|
||||||
|
export PAPERBUILD="$FOLIABUILD"
|
||||||
|
fi
|
||||||
|
|
||||||
|
PAPER_PROJECT="folia" PAPER_NAME="FoliaMC" exec ${SCRIPTS:-/}start-deployPaper "$@"
|
||||||
+20
-14
@@ -10,22 +10,28 @@ handleDebugMode
|
|||||||
ourScript="$0"
|
ourScript="$0"
|
||||||
ourArgs=("$@")
|
ourArgs=("$@")
|
||||||
|
|
||||||
|
# Check if we're running Folia.
|
||||||
|
if [[ -z $PAPER_PROJECT ]]; then
|
||||||
|
PAPER_PROJECT="paper"
|
||||||
|
PAPER_NAME="PaperMC"
|
||||||
|
fi
|
||||||
|
|
||||||
function handleMissingVersion() {
|
function handleMissingVersion() {
|
||||||
expectedVersion=${VANILLA_VERSION}
|
expectedVersion=${VANILLA_VERSION}
|
||||||
versions=$(curl -fsSL "https://papermc.io/api/v2/projects/paper" -H "accept: application/json")
|
versions=$(curl -fsSL "https://papermc.io/api/v2/projects/${PAPER_PROJECT}" -H "accept: application/json")
|
||||||
if [[ $VERSION = LATEST ]]; then
|
if [[ $VERSION = LATEST ]]; then
|
||||||
tries=0
|
tries=0
|
||||||
while ((tries++ < 5)); do
|
while ((tries++ < 5)); do
|
||||||
VANILLA_VERSION=$(echo "$versions" | jq -r ".versions[$((- tries))]")
|
VANILLA_VERSION=$(echo "$versions" | jq -r ".versions[$((- tries))]")
|
||||||
if [[ $(curl -fsSL "https://papermc.io/api/v2/projects/paper/versions/${VANILLA_VERSION}" -H "accept: application/json" \
|
if [[ $(curl -fsSL "https://papermc.io/api/v2/projects/${PAPER_PROJECT}/versions/${VANILLA_VERSION}" -H "accept: application/json" \
|
||||||
| jq '.builds[-1]') != null ]]; then
|
| jq '.builds[-1]') != null ]]; then
|
||||||
log "WARN: using ${VANILLA_VERSION} since that's the latest provided by PaperMC"
|
log "WARN: using ${VANILLA_VERSION} since that's the latest provided by ${PAPER_NAME}"
|
||||||
# re-execute the current script with the newly computed version
|
# re-execute the current script with the newly computed version
|
||||||
exec "$ourScript" "${ourArgs[@]}"
|
exec "$ourScript" "${ourArgs[@]}"
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
fi
|
fi
|
||||||
log "ERROR: ${expectedVersion} is not published by PaperMC"
|
log "ERROR: ${expectedVersion} is not published by ${PAPER_NAME}"
|
||||||
log " Set VERSION to one of the following: "
|
log " Set VERSION to one of the following: "
|
||||||
log " $(echo "$versions" | jq -r '.versions | join(", ")')"
|
log " $(echo "$versions" | jq -r '.versions | join(", ")')"
|
||||||
exit 1
|
exit 1
|
||||||
@@ -40,13 +46,13 @@ elif [[ $PAPER_DOWNLOAD_URL ]]; then
|
|||||||
zarg=(-z "$SERVER")
|
zarg=(-z "$SERVER")
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo "Preparing custom PaperMC jar from $PAPER_DOWNLOAD_URL"
|
echo "Preparing custom ${PAPER_NAME} jar from $PAPER_DOWNLOAD_URL"
|
||||||
|
|
||||||
curl -fsSL -o "$SERVER" "${zarg[@]}" "${PAPER_DOWNLOAD_URL}"
|
curl -fsSL -o "$SERVER" "${zarg[@]}" "${PAPER_DOWNLOAD_URL}"
|
||||||
else
|
else
|
||||||
# PaperMC API v2 docs : https://papermc.io/api/docs/swagger-ui/index.html?configUrl=/api/openapi/swagger-config
|
# Paper API v2 docs : https://papermc.io/api/docs/swagger-ui/index.html?configUrl=/api/openapi/swagger-config
|
||||||
|
|
||||||
build=${PAPERBUILD:=$(curl -fsSL "https://papermc.io/api/v2/projects/paper/versions/${VANILLA_VERSION}" -H "accept: application/json" \
|
build=${PAPERBUILD:=$(curl -fsSL "https://papermc.io/api/v2/projects/${PAPER_PROJECT}/versions/${VANILLA_VERSION}" -H "accept: application/json" \
|
||||||
| jq '.builds[-1]')}
|
| jq '.builds[-1]')}
|
||||||
case $? in
|
case $? in
|
||||||
0)
|
0)
|
||||||
@@ -55,7 +61,7 @@ else
|
|||||||
handleMissingVersion
|
handleMissingVersion
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
echo "ERROR: unknown error while looking up PaperMC version=${VANILLA_VERSION}"
|
echo "ERROR: unknown error while looking up ${PAPER_NAME} version=${VANILLA_VERSION}"
|
||||||
exit 1
|
exit 1
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
@@ -64,10 +70,10 @@ else
|
|||||||
handleMissingVersion
|
handleMissingVersion
|
||||||
fi
|
fi
|
||||||
|
|
||||||
export SERVER=$(curl -fsSL "https://papermc.io/api/v2/projects/paper/versions/${VANILLA_VERSION}/builds/${build}" -H "accept: application/json" \
|
export SERVER=$(curl -fsSL "https://papermc.io/api/v2/projects/${PAPER_PROJECT}/versions/${VANILLA_VERSION}/builds/${build}" -H "accept: application/json" \
|
||||||
| jq -r '.downloads.application.name')
|
| jq -r '.downloads.application.name')
|
||||||
if [ $? != 0 ]; then
|
if [ $? != 0 ]; then
|
||||||
echo "ERROR: failed to lookup PaperMC download file from version=${VANILLA_VERSION} build=${build}"
|
echo "ERROR: failed to lookup ${PAPER_NAME} download file from version=${VANILLA_VERSION} build=${build}"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@@ -75,18 +81,18 @@ else
|
|||||||
zarg=(-z "$SERVER")
|
zarg=(-z "$SERVER")
|
||||||
fi
|
fi
|
||||||
|
|
||||||
log "Removing old PaperMC versions ..."
|
log "Removing old ${PAPER_NAME} versions ..."
|
||||||
shopt -s nullglob
|
shopt -s nullglob
|
||||||
for f in paper-*.jar; do
|
for f in paper-*.jar; do
|
||||||
[[ $f != $SERVER ]] && rm $f
|
[[ $f != $SERVER ]] && rm $f
|
||||||
done
|
done
|
||||||
|
|
||||||
log "Downloading PaperMC $VANILLA_VERSION (build $build) ..."
|
log "Downloading ${PAPER_NAME} $VANILLA_VERSION (build $build) ..."
|
||||||
curl -fsSL -o "$SERVER" "${zarg[@]}" \
|
curl -fsSL -o "$SERVER" "${zarg[@]}" \
|
||||||
"https://papermc.io/api/v2/projects/paper/versions/${VANILLA_VERSION}/builds/${build}/downloads/${SERVER}" \
|
"https://papermc.io/api/v2/projects/${PAPER_PROJECT}/versions/${VANILLA_VERSION}/builds/${build}/downloads/${SERVER}" \
|
||||||
-H "accept: application/java-archive"
|
-H "accept: application/java-archive"
|
||||||
if [ $? != 0 ]; then
|
if [ $? != 0 ]; then
|
||||||
echo "ERROR: failed to download PaperMC from version=${VANILLA_VERSION} build=${build} download=${SERVER}"
|
echo "ERROR: failed to download ${PAPER_NAME} from version=${VANILLA_VERSION} build=${build} download=${SERVER}"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|||||||
Reference in New Issue
Block a user