For backward compatibility, allow MODS to list plugins for those server types (#2200)

This commit is contained in:
Geoff Bourne
2023-06-11 11:00:39 -05:00
committed by GitHub
parent 8a4dbb53e7
commit c8ffbec928
4 changed files with 86 additions and 74 deletions

View File

@@ -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
}