mirror of
https://github.com/itzg/docker-minecraft-server.git
synced 2026-11-03 15:39:21 +00:00
Support Spigot-style and vanilla-style world zips, for any server type (#1305)
This commit is contained in:
1 parent
1dd9a2e6e0
commit
b7bbe1b0a6
19 files changed
+163
-11
No files matched your search
+52
-11
@@ -37,11 +37,7 @@ if [[ "$WORLD" ]] && ( isTrue "${FORCE_WORLD_COPY}" || [ ! -d "$worldDest" ] );
|
|||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ "$FAMILY" = "SPIGOT" ]; then
|
baseDirs=$(find /tmp/world-data -name "level.dat" -exec dirname "{}" \;)
|
||||||
baseDirs=$(find /tmp/world-data -name "level.dat" -not -path "*_nether*" -not -path "*_the_end*" -exec dirname "{}" \;)
|
|
||||||
else
|
|
||||||
baseDirs=$(find /tmp/world-data -name "level.dat" -exec dirname "{}" \;)
|
|
||||||
fi
|
|
||||||
|
|
||||||
if ! [[ $baseDirs ]]; then
|
if ! [[ $baseDirs ]]; then
|
||||||
log "ERROR world content is not valid since level.dat could not be found"
|
log "ERROR world content is not valid since level.dat could not be found"
|
||||||
@@ -50,20 +46,65 @@ if [[ "$WORLD" ]] && ( isTrue "${FORCE_WORLD_COPY}" || [ ! -d "$worldDest" ] );
|
|||||||
|
|
||||||
count=$(echo "$baseDirs" | wc -l)
|
count=$(echo "$baseDirs" | wc -l)
|
||||||
if [[ $count -gt 1 ]]; then
|
if [[ $count -gt 1 ]]; then
|
||||||
baseDir="$(echo "$baseDirs" | sed -n ${WORLD_INDEX:-1}p)"
|
baseDirsNoSpigotSuffix=$(echo "$baseDirs" | sed -re 's:(_nether|_the_end)/?$::' | sort -u)
|
||||||
baseName=$(basename "$baseDir")
|
if [ $(echo "$baseDirsNoSpigotSuffix" | wc -l) -eq 1 ]; then
|
||||||
log "WARN multiple levels found, picking: $baseName"
|
baseDir="$baseDirsNoSpigotSuffix"
|
||||||
|
baseName=$(basename "$baseDir")
|
||||||
|
log "Found Spigot naming conventions, taking $baseName as main dimension"
|
||||||
|
else
|
||||||
|
baseDir="$(echo "$baseDirs" | sed -n ${WORLD_INDEX:-1}p)"
|
||||||
|
baseName=$(basename "$baseDir")
|
||||||
|
log "WARN multiple levels found, picking: $baseName"
|
||||||
|
fi
|
||||||
elif [[ $count -gt 0 ]]; then
|
elif [[ $count -gt 0 ]]; then
|
||||||
baseDir="$baseDirs"
|
baseDir="$baseDirs"
|
||||||
else
|
else
|
||||||
log "ERROR invalid world content"
|
log "ERROR invalid world content"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
if [ -d "${baseDir}_nether/DIM-1" ]; then
|
||||||
|
if [ -d "$baseDir/DIM-1" ]; then
|
||||||
|
log "WARN found Nether dimension in both $baseDir and ${baseDir}_nether, picking ${baseDir}_nether"
|
||||||
|
rm -r "$baseDir/DIM-1"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
if [ -d "${baseDir}_the_end/DIM1" ]; then
|
||||||
|
if [ -d "$baseDir/DIM1" ]; then
|
||||||
|
log "WARN found End dimension in both $baseDir and ${baseDir}_the_end, picking ${baseDir}_the_end"
|
||||||
|
rm -r "$baseDir/DIM1"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
log "Copying world..."
|
||||||
rsync --remove-source-files --recursive --delete "$baseDir/" "$worldDest"
|
rsync --remove-source-files --recursive --delete "$baseDir/" "$worldDest"
|
||||||
|
|
||||||
if [ "$FAMILY" = "SPIGOT" ]; then
|
if [ "$FAMILY" = "SPIGOT" ]; then
|
||||||
log "Copying end and nether ..."
|
if [ -d "${baseDir}_nether" ]; then
|
||||||
[ -d "${baseDir}_nether" ] && rsync --remove-source-files --recursive --delete "${baseDir}_nether/" "${worldDest}_nether"
|
log "Copying Spigot Nether..."
|
||||||
[ -d "${baseDir}_the_end" ] && rsync --remove-source-files --recursive --delete "${baseDir}_the_end/" "${worldDest}_the_end"
|
rsync --remove-source-files --recursive --delete "${baseDir}_nether/" "${worldDest}_nether"
|
||||||
|
elif [ -d "$worldDest/DIM-1" ]; then
|
||||||
|
log "Moving Nether to Spigot location..."
|
||||||
|
mkdir -p "${worldDest}_nether"
|
||||||
|
mv -f "$worldDest/DIM-1" "${worldDest}_nether/"
|
||||||
|
fi
|
||||||
|
if [ -d "${baseDir}_the_end" ]; then
|
||||||
|
log "Copying Spigot End..."
|
||||||
|
rsync --remove-source-files --recursive --delete "${baseDir}_the_end/" "${worldDest}_the_end"
|
||||||
|
elif [ -d "$worldDest/DIM1" ]; then
|
||||||
|
log "Moving End to Spigot location..."
|
||||||
|
mkdir -p "${worldDest}_the_end"
|
||||||
|
mv -f "$worldDest/DIM1" "${worldDest}_the_end/"
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
if [ -d "${baseDir}_nether/DIM-1" ]; then
|
||||||
|
log "Copying Spigot Nether to vanilla location..."
|
||||||
|
rsync --remove-source-files --recursive --delete "${baseDir}_nether/DIM-1" "${worldDest}/"
|
||||||
|
fi
|
||||||
|
if [ -d "${baseDir}_the_end/DIM1" ]; then
|
||||||
|
log "Copying Spigot End to vanilla location..."
|
||||||
|
rsync --remove-source-files --recursive --delete "${baseDir}_the_end/DIM1" "${worldDest}/"
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
elif [ -d "$WORLD" ]; then
|
elif [ -d "$WORLD" ]; then
|
||||||
log "Cloning world directory from $WORLD ..."
|
log "Cloning world directory from $WORLD ..."
|
||||||
|
|||||||
@@ -0,0 +1,15 @@
|
|||||||
|
version: "3"
|
||||||
|
|
||||||
|
services:
|
||||||
|
mc:
|
||||||
|
restart: "no"
|
||||||
|
image: ${IMAGE_TO_TEST:-itzg/minecraft-server}
|
||||||
|
environment:
|
||||||
|
EULA: "TRUE"
|
||||||
|
SETUP_ONLY: "TRUE"
|
||||||
|
VERSION: ${MINECRAFT_VERSION:-LATEST}
|
||||||
|
TYPE: "PAPER"
|
||||||
|
WORLD: /worlds/world-for-testing.zip
|
||||||
|
volumes:
|
||||||
|
- ./worlds:/worlds:ro
|
||||||
|
- ./data:/data
|
||||||
@@ -0,0 +1,5 @@
|
|||||||
|
mc-image-helper assert fileExists world/level.dat && \
|
||||||
|
mc-image-helper assert fileExists world_nether/DIM-1/some_spigot_nether_file && \
|
||||||
|
mc-image-helper assert fileExists world_the_end/DIM1/some_spigot_end_file && \
|
||||||
|
! mc-image-helper assert fileExists world_nether/DIM-1/some_vanilla_nether_file && \
|
||||||
|
! mc-image-helper assert fileExists world_the_end/DIM1/some_vanilla_end_file
|
||||||
Binary file not shown.
@@ -0,0 +1,14 @@
|
|||||||
|
version: "3"
|
||||||
|
|
||||||
|
services:
|
||||||
|
mc:
|
||||||
|
restart: "no"
|
||||||
|
image: ${IMAGE_TO_TEST:-itzg/minecraft-server}
|
||||||
|
environment:
|
||||||
|
EULA: "TRUE"
|
||||||
|
SETUP_ONLY: "TRUE"
|
||||||
|
VERSION: ${MINECRAFT_VERSION:-LATEST}
|
||||||
|
WORLD: /worlds/world-for-testing.zip
|
||||||
|
volumes:
|
||||||
|
- ./worlds:/worlds:ro
|
||||||
|
- ./data:/data
|
||||||
@@ -0,0 +1,5 @@
|
|||||||
|
mc-image-helper assert fileExists world/level.dat && \
|
||||||
|
mc-image-helper assert fileExists world/DIM-1/some_spigot_nether_file && \
|
||||||
|
mc-image-helper assert fileExists world/DIM1/some_spigot_end_file && \
|
||||||
|
! mc-image-helper assert fileExists world/DIM-1/some_vanilla_nether_file && \
|
||||||
|
! mc-image-helper assert fileExists world/DIM1/some_vanilla_end_file
|
||||||
BIN
Binary file not shown.
@@ -0,0 +1,15 @@
|
|||||||
|
version: "3"
|
||||||
|
|
||||||
|
services:
|
||||||
|
mc:
|
||||||
|
restart: "no"
|
||||||
|
image: ${IMAGE_TO_TEST:-itzg/minecraft-server}
|
||||||
|
environment:
|
||||||
|
EULA: "TRUE"
|
||||||
|
SETUP_ONLY: "TRUE"
|
||||||
|
VERSION: ${MINECRAFT_VERSION:-LATEST}
|
||||||
|
TYPE: "PAPER"
|
||||||
|
WORLD: /worlds/world-for-testing.zip
|
||||||
|
volumes:
|
||||||
|
- ./worlds:/worlds:ro
|
||||||
|
- ./data:/data
|
||||||
@@ -0,0 +1,4 @@
|
|||||||
|
mc-image-helper assert fileExists world/level.dat && \
|
||||||
|
mc-image-helper assert fileExists world/some_overworld_file && \
|
||||||
|
mc-image-helper assert fileExists world_nether/DIM-1/some_nether_file && \
|
||||||
|
mc-image-helper assert fileExists world_the_end/DIM1/some_end_file
|
||||||
Binary file not shown.
@@ -0,0 +1,14 @@
|
|||||||
|
version: "3"
|
||||||
|
|
||||||
|
services:
|
||||||
|
mc:
|
||||||
|
restart: "no"
|
||||||
|
image: ${IMAGE_TO_TEST:-itzg/minecraft-server}
|
||||||
|
environment:
|
||||||
|
EULA: "TRUE"
|
||||||
|
SETUP_ONLY: "TRUE"
|
||||||
|
VERSION: ${MINECRAFT_VERSION:-LATEST}
|
||||||
|
WORLD: /worlds/world-for-testing.zip
|
||||||
|
volumes:
|
||||||
|
- ./worlds:/worlds:ro
|
||||||
|
- ./data:/data
|
||||||
@@ -0,0 +1,4 @@
|
|||||||
|
mc-image-helper assert fileExists world/level.dat && \
|
||||||
|
mc-image-helper assert fileExists world/some_overworld_file && \
|
||||||
|
mc-image-helper assert fileExists world/DIM-1/some_nether_file && \
|
||||||
|
mc-image-helper assert fileExists world/DIM1/some_end_file
|
||||||
Binary file not shown.
@@ -0,0 +1,15 @@
|
|||||||
|
version: "3"
|
||||||
|
|
||||||
|
services:
|
||||||
|
mc:
|
||||||
|
restart: "no"
|
||||||
|
image: ${IMAGE_TO_TEST:-itzg/minecraft-server}
|
||||||
|
environment:
|
||||||
|
EULA: "TRUE"
|
||||||
|
SETUP_ONLY: "TRUE"
|
||||||
|
VERSION: ${MINECRAFT_VERSION:-LATEST}
|
||||||
|
TYPE: "PAPER"
|
||||||
|
WORLD: /worlds/world-for-testing.zip
|
||||||
|
volumes:
|
||||||
|
- ./worlds:/worlds:ro
|
||||||
|
- ./data:/data
|
||||||
@@ -0,0 +1,3 @@
|
|||||||
|
mc-image-helper assert fileExists world/level.dat && \
|
||||||
|
mc-image-helper assert fileExists world_nether/DIM-1/some_nether_file && \
|
||||||
|
mc-image-helper assert fileExists world_the_end/DIM1/some_end_file
|
||||||
Binary file not shown.
@@ -0,0 +1,14 @@
|
|||||||
|
version: "3"
|
||||||
|
|
||||||
|
services:
|
||||||
|
mc:
|
||||||
|
restart: "no"
|
||||||
|
image: ${IMAGE_TO_TEST:-itzg/minecraft-server}
|
||||||
|
environment:
|
||||||
|
EULA: "TRUE"
|
||||||
|
SETUP_ONLY: "TRUE"
|
||||||
|
VERSION: ${MINECRAFT_VERSION:-LATEST}
|
||||||
|
WORLD: /worlds/world-for-testing.zip
|
||||||
|
volumes:
|
||||||
|
- ./worlds:/worlds:ro
|
||||||
|
- ./data:/data
|
||||||
@@ -0,0 +1,3 @@
|
|||||||
|
mc-image-helper assert fileExists world/level.dat && \
|
||||||
|
mc-image-helper assert fileExists world/DIM-1/some_nether_file && \
|
||||||
|
mc-image-helper assert fileExists world/DIM1/some_end_file
|
||||||
Binary file not shown.
Reference in new issue
Block a user