mirror of
https://github.com/itzg/docker-minecraft-server
synced 2024-11-10 06:14:14 +00:00
For backward compatibility, allow MODS to list plugins for those server types (#2200)
This commit is contained in:
parent
8a4dbb53e7
commit
c8ffbec928
4 changed files with 86 additions and 74 deletions
|
@ -14,18 +14,22 @@ The following are some supported mod platforms:
|
|||
|
||||
On the left, there are sections describing some download automation options.
|
||||
|
||||
## Mods vs Plugins
|
||||
|
||||
The terms "mods" and "plugins" can be quite confusing. Generally, the rule of thumb is that "mods" are used by the types that run client side to modify rendering, add new blocks, and add behaviors server, such as [Forge](../types-and-platforms/server-types/forge.md) and [Fabric](../types-and-platforms/server-types/fabric.md). "Plugins" are used by the types that **only run on servers** to add behaviors, commands, etc such as [Paper](../types-and-platforms/server-types/paper.md) (which derives from [Bukkit/Spigot](../types-and-platforms/server-types/bukkit-spigot.md)). There are also some types that are [hybrids](../types-and-platforms/server-types/hybrids.md), such as Magma, that use both "mods" and "plugins"
|
||||
|
||||
## Optional plugins, mods, and config attach points
|
||||
|
||||
There are optional volume paths that can be attached to supply content to be copied into the data area:
|
||||
|
||||
`/plugins`
|
||||
: contents are synchronized into `/data/plugins` for Bukkit related server types. The source can be changed by setting `COPY_PLUGINS_SRC`. The destination can be changed by setting `COPY_PLUGINS_DEST`. Set `SYNC_SKIP_NEWER_IN_DESTINATION=false` if you want files from `/plugins` to take precedence over newer files in `/data/plugins`.
|
||||
: content in this directory is synchronized into `/data/plugins` for server types that use plugins, [as described above](#mods-vs-plugins). For special cases, the source can be changed by setting `COPY_PLUGINS_SRC` and destination by setting `COPY_PLUGINS_DEST`.
|
||||
|
||||
`/mods`
|
||||
: contents are synchronized into `/data/mods` for Fabric and Forge related server types. The source can be changed by setting `COPY_MODS_SRC`. The destination can be changed by setting `COPY_MODS_DEST`.
|
||||
: content in this directory is synchronized into `/data/mods` for server types that use mods, [as described above](#mods-vs-plugins). For special cases, the source can be changed by setting `COPY_MODS_SRC` and destination by setting `COPY_MODS_DEST`.
|
||||
|
||||
`/config`
|
||||
: contents are synchronized into `/data/config` by default, but can be changed with `COPY_CONFIG_DEST`. The source can be changed by setting `COPY_CONFIG_SRC`. For example, `-v ./config:/config -e COPY_CONFIG_DEST=/data` will allow you to copy over files like `bukkit.yml` and so on directly into the server directory. Set `SYNC_SKIP_NEWER_IN_DESTINATION=false` if you want files from `/config` to take precedence over newer files in `/data/config`.
|
||||
: contents are synchronized into `/data/config` by default, but can be changed with `COPY_CONFIG_DEST`. For example, `-v ./config:/config -e COPY_CONFIG_DEST=/data` will allow you to copy over files like `bukkit.yml` and so on directly into the server directory. The source can be changed by setting `COPY_CONFIG_SRC`. Set `SYNC_SKIP_NEWER_IN_DESTINATION=false` if you want files from `/config` to take precedence over newer files in `/data/config`.
|
||||
|
||||
By default, the [environment variable processing](../configuration/interpolating.md) is performed on synchronized files that match the expected suffixes in `REPLACE_ENV_SUFFIXES` (by default "yml,yaml,txt,cfg,conf,properties,hjson,json,tml,toml") and are not excluded by `REPLACE_ENV_VARIABLES_EXCLUDES` and `REPLACE_ENV_VARIABLES_EXCLUDE_PATHS`. This processing can be disabled by setting `REPLACE_ENV_DURING_SYNC` to `false`.
|
||||
|
||||
|
@ -37,7 +41,9 @@ For example: `-e REMOVE_OLD_MODS=TRUE -e REMOVE_OLD_MODS_INCLUDE="*.jar" -e REMO
|
|||
|
||||
These paths work well if you want to have a common set of modules in a separate location, but still have multiple worlds with different server requirements in either persistent volumes or a downloadable archive.
|
||||
|
||||
> For more flexibility with mods/plugins preparation, you can declare directories to use in [the `MODS` variable](#modsplugins-list)
|
||||
!!! information ""
|
||||
For more flexibility with mods/plugins preparation, you can declare other directories, files, and URLs to use in [the `MODS` / `PLUGINS` variables](#modsplugins-list).
|
||||
|
||||
|
||||
## Zip file modpack
|
||||
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
apiVersion: kustomize.config.k8s.io/v1beta1
|
||||
kind: Kustomization
|
||||
resources:
|
||||
- statefulset.yml
|
||||
- service.yml
|
|
@ -22,8 +22,8 @@ CURSE_URL_BASE=${CURSE_URL_BASE:-https://minecraft.curseforge.com/projects}
|
|||
|
||||
# Remove old mods/plugins
|
||||
if isTrue "${REMOVE_OLD_MODS}" && [ -z "${MODS_FILE}" ]; then
|
||||
removeOldMods /data/mods
|
||||
removeOldMods /data/plugins
|
||||
removeOldMods "$MODS_OUT_DIR"
|
||||
removeOldMods "$PLUGINS_OUT_DIR"
|
||||
rm -f "$sum_file"
|
||||
fi
|
||||
|
||||
|
@ -66,13 +66,13 @@ if [[ "$MODPACK" ]]; then
|
|||
fi
|
||||
|
||||
if [ "$FAMILY" = "SPIGOT" ]; then
|
||||
mkdir -p /data/plugins
|
||||
if ! unzip -o -d /data/plugins /tmp/modpack.zip; then
|
||||
mkdir -p "$PLUGINS_OUT_DIR"
|
||||
if ! unzip -o -d "$PLUGINS_OUT_DIR" /tmp/modpack.zip; then
|
||||
log "ERROR: failed to unzip the modpack from ${MODPACK}"
|
||||
fi
|
||||
else
|
||||
mkdir -p /data/mods
|
||||
if ! unzip -o -d /data/mods /tmp/modpack.zip; then
|
||||
mkdir -p "$MODS_OUT_DIR"
|
||||
if ! unzip -o -d "$MODS_OUT_DIR" /tmp/modpack.zip; then
|
||||
log "ERROR: failed to unzip the modpack from ${MODPACK}"
|
||||
fi
|
||||
fi
|
||||
|
@ -81,58 +81,65 @@ fi
|
|||
}
|
||||
|
||||
function handleListings() {
|
||||
if usesMods && usesPlugins; then
|
||||
if [[ "$MODS" ]]; then
|
||||
if usesMods; then
|
||||
mkdir -p "$MODS_OUT_DIR"
|
||||
mc-image-helper mcopy \
|
||||
--glob=*.jar \
|
||||
--scope=var-list \
|
||||
--to="$MODS_OUT_DIR" \
|
||||
"$MODS"
|
||||
else
|
||||
log "ERROR: TYPE=$TYPE does not support mods"
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
if [[ "$PLUGINS" ]]; then
|
||||
if usesPlugins; then
|
||||
mkdir -p "$PLUGINS_OUT_DIR"
|
||||
mc-image-helper mcopy \
|
||||
--glob=*.jar \
|
||||
--scope=var-list \
|
||||
--to="$PLUGINS_OUT_DIR" \
|
||||
"$PLUGINS"
|
||||
else
|
||||
log "ERROR: TYPE=$TYPE does not support plugins"
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
|
||||
if [[ "$MODS_FILE" ]]; then
|
||||
if usesMods; then
|
||||
mkdir -p "$MODS_OUT_DIR"
|
||||
mc-image-helper mcopy \
|
||||
--file-is-listing \
|
||||
--scope=file-list \
|
||||
--to="$MODS_OUT_DIR" \
|
||||
"$MODS_FILE"
|
||||
else
|
||||
log "ERROR: TYPE=$TYPE does not support mods"
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
if [[ "$PLUGINS_FILE" ]]; then
|
||||
if usesPlugins; then
|
||||
mkdir -p "$PLUGINS_OUT_DIR"
|
||||
mc-image-helper mcopy \
|
||||
--file-is-listing \
|
||||
--scope=file-list \
|
||||
--to="$PLUGINS_OUT_DIR" \
|
||||
"$PLUGINS_FILE"
|
||||
else
|
||||
log "ERROR: TYPE=$TYPE does not support plugins"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
elif usesPlugins || usesMods; then
|
||||
outDir="$MODS_OUT_DIR"
|
||||
if usesPlugins; then
|
||||
outDir="$PLUGINS_OUT_DIR"
|
||||
fi
|
||||
|
||||
if [[ "$MODS" || "$PLUGINS" ]]; then
|
||||
mkdir -p "$outDir"
|
||||
mc-image-helper mcopy \
|
||||
--glob=*.jar \
|
||||
--scope=var-list \
|
||||
--to="$outDir" \
|
||||
"$MODS" "$PLUGINS"
|
||||
fi
|
||||
|
||||
if [[ "$MODS_FILE" || "$PLUGINS_FILE" ]]; then
|
||||
mkdir -p "$outDir"
|
||||
mc-image-helper mcopy \
|
||||
--file-is-listing \
|
||||
--scope=file-list \
|
||||
--to="$outDir" \
|
||||
"$MODS_FILE" "$PLUGINS_FILE"
|
||||
fi
|
||||
|
||||
fi
|
||||
}
|
||||
|
||||
|
|
|
@ -10,6 +10,8 @@
|
|||
: "${REPLACE_ENV_VARIABLES_EXCLUDES:=}"
|
||||
: "${REPLACE_ENV_VARIABLES_EXCLUDE_PATHS:=}"
|
||||
: "${DEBUG:=false}"
|
||||
: "${MODS_OUT_DIR:=/data/mods}"
|
||||
: "${PLUGINS_OUT_DIR:=/data/plugins}"
|
||||
|
||||
set -e
|
||||
isDebugging && set -x
|
||||
|
@ -25,11 +27,9 @@ else
|
|||
fi
|
||||
|
||||
: "${COPY_PLUGINS_SRC:="/plugins"}"
|
||||
: "${COPY_PLUGINS_DEST:="/data/plugins"}"
|
||||
: "${COPY_PLUGINS_DEST:=${PLUGINS_OUT_DIR}}"
|
||||
|
||||
if [ -d "${COPY_PLUGINS_SRC}" ]; then
|
||||
case ${FAMILY} in
|
||||
SPIGOT|HYBRID)
|
||||
if usesPlugins && [ -d "${COPY_PLUGINS_SRC}" ]; then
|
||||
mkdir -p "${COPY_PLUGINS_DEST}"
|
||||
log "Copying any plugins from ${COPY_PLUGINS_SRC} to ${COPY_PLUGINS_DEST}"
|
||||
mc-image-helper \
|
||||
|
@ -39,15 +39,12 @@ if [ -d "${COPY_PLUGINS_SRC}" ]; then
|
|||
--replace-env-exclude-paths="${REPLACE_ENV_VARIABLES_EXCLUDE_PATHS}" \
|
||||
--replace-env-prefix="${REPLACE_ENV_VARIABLE_PREFIX}" \
|
||||
"${COPY_PLUGINS_SRC}" "${COPY_PLUGINS_DEST}"
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
|
||||
# If any modules have been provided, copy them over
|
||||
: "${COPY_MODS_SRC:="/mods"}"
|
||||
: "${COPY_MODS_DEST:="/data/mods"}"
|
||||
: "${COPY_MODS_DEST:=${MODS_OUT_DIR}}"
|
||||
|
||||
if [ -d "${COPY_MODS_SRC}" ]; then
|
||||
if usesMods && [ -d "${COPY_MODS_SRC}" ]; then
|
||||
log "Copying any mods from ${COPY_MODS_SRC} to ${COPY_MODS_DEST}"
|
||||
mc-image-helper \
|
||||
${subcommand} $updateArg \
|
||||
|
|
Loading…
Reference in a new issue