mirror of
https://github.com/itzg/docker-minecraft-server.git
synced 2026-02-27 11:26:24 +00:00
For backward compatibility, allow MODS to list plugins for those server types (#2200)
This commit is contained in:
@@ -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 [[ "$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 usesMods && usesPlugins; then
|
||||
if [[ "$MODS" ]]; then
|
||||
mkdir -p "$MODS_OUT_DIR"
|
||||
mc-image-helper mcopy \
|
||||
--glob=*.jar \
|
||||
--scope=var-list \
|
||||
--to="$MODS_OUT_DIR" \
|
||||
"$MODS"
|
||||
fi
|
||||
if [[ "$PLUGINS" ]]; then
|
||||
mkdir -p "$PLUGINS_OUT_DIR"
|
||||
mc-image-helper mcopy \
|
||||
--glob=*.jar \
|
||||
--scope=var-list \
|
||||
--to="$PLUGINS_OUT_DIR" \
|
||||
"$PLUGINS"
|
||||
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 [[ "$MODS_FILE" ]]; then
|
||||
mkdir -p "$MODS_OUT_DIR"
|
||||
mc-image-helper mcopy \
|
||||
--file-is-listing \
|
||||
--scope=file-list \
|
||||
--to="$MODS_OUT_DIR" \
|
||||
"$MODS_FILE"
|
||||
fi
|
||||
if [[ "$PLUGINS_FILE" ]]; then
|
||||
mkdir -p "$PLUGINS_OUT_DIR"
|
||||
mc-image-helper mcopy \
|
||||
--file-is-listing \
|
||||
--scope=file-list \
|
||||
--to="$PLUGINS_OUT_DIR" \
|
||||
"$PLUGINS_FILE"
|
||||
fi
|
||||
|
||||
elif usesPlugins || usesMods; then
|
||||
outDir="$MODS_OUT_DIR"
|
||||
if usesPlugins; then
|
||||
mkdir -p "$PLUGINS_OUT_DIR"
|
||||
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="$PLUGINS_OUT_DIR" \
|
||||
"$PLUGINS_FILE"
|
||||
else
|
||||
log "ERROR: TYPE=$TYPE does not support plugins"
|
||||
exit 1
|
||||
--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,29 +27,24 @@ 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)
|
||||
mkdir -p "${COPY_PLUGINS_DEST}"
|
||||
log "Copying any plugins from ${COPY_PLUGINS_SRC} to ${COPY_PLUGINS_DEST}"
|
||||
mc-image-helper \
|
||||
${subcommand} $updateArg \
|
||||
--replace-env-file-suffixes="${REPLACE_ENV_SUFFIXES}" \
|
||||
--replace-env-excludes="${REPLACE_ENV_VARIABLES_EXCLUDES}" \
|
||||
--replace-env-exclude-paths="${REPLACE_ENV_VARIABLES_EXCLUDE_PATHS}" \
|
||||
--replace-env-prefix="${REPLACE_ENV_VARIABLE_PREFIX}" \
|
||||
"${COPY_PLUGINS_SRC}" "${COPY_PLUGINS_DEST}"
|
||||
;;
|
||||
esac
|
||||
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 \
|
||||
${subcommand} $updateArg \
|
||||
--replace-env-file-suffixes="${REPLACE_ENV_SUFFIXES}" \
|
||||
--replace-env-excludes="${REPLACE_ENV_VARIABLES_EXCLUDES}" \
|
||||
--replace-env-exclude-paths="${REPLACE_ENV_VARIABLES_EXCLUDE_PATHS}" \
|
||||
--replace-env-prefix="${REPLACE_ENV_VARIABLE_PREFIX}" \
|
||||
"${COPY_PLUGINS_SRC}" "${COPY_PLUGINS_DEST}"
|
||||
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 \
|
||||
|
||||
Reference in New Issue
Block a user