mirror of
https://github.com/itzg/docker-minecraft-server.git
synced 2026-03-03 13:26:26 +00:00
New logger with color and specific types. Code cleanup (#3108)
This commit is contained in:
@@ -27,7 +27,7 @@ if [[ "$WORLD" ]] && ( isTrue "${FORCE_WORLD_COPY}" || [ ! -d "$worldDest" ] );
|
||||
if isURL "$WORLD"; then
|
||||
log "Downloading world from $WORLD"
|
||||
if ! get -o /tmp/world.bin "$WORLD"; then
|
||||
log "ERROR: failed to download world from $WORLD"
|
||||
logError "Failed to download world from $WORLD"
|
||||
exit 1
|
||||
fi
|
||||
WORLD=/tmp/world.bin
|
||||
@@ -39,14 +39,14 @@ if [[ "$WORLD" ]] && ( isTrue "${FORCE_WORLD_COPY}" || [ ! -d "$worldDest" ] );
|
||||
# Stage contents so that the correct subdirectory can be picked off
|
||||
mkdir -p /tmp/world-data
|
||||
if ! extract "$WORLD" /tmp/world-data; then
|
||||
log "ERROR extracting world from $WORLD"
|
||||
logError "Extracting world from $WORLD"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
baseDirs=$(find /tmp/world-data -name "level.dat" -exec dirname "{}" \;)
|
||||
|
||||
if ! [[ $baseDirs ]]; then
|
||||
log "ERROR world content is not valid since level.dat could not be found"
|
||||
logError "World content is not valid since level.dat could not be found"
|
||||
exit 2
|
||||
fi
|
||||
|
||||
@@ -60,24 +60,24 @@ if [[ "$WORLD" ]] && ( isTrue "${FORCE_WORLD_COPY}" || [ ! -d "$worldDest" ] );
|
||||
else
|
||||
baseDir="$(echo "$baseDirs" | sed -n ${WORLD_INDEX:-1}p)"
|
||||
baseName=$(basename "$baseDir")
|
||||
log "WARN multiple levels found, picking: $baseName"
|
||||
logWarning "Multiple levels found, picking: $baseName"
|
||||
fi
|
||||
elif [[ $count -gt 0 ]]; then
|
||||
baseDir="$baseDirs"
|
||||
else
|
||||
log "ERROR invalid world content"
|
||||
logError "Invalid world content"
|
||||
exit 1
|
||||
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"
|
||||
logWarning "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"
|
||||
logWarning "Found End dimension in both $baseDir and ${baseDir}_the_end, picking ${baseDir}_the_end"
|
||||
rm -r "$baseDir/DIM1"
|
||||
fi
|
||||
fi
|
||||
@@ -116,7 +116,7 @@ if [[ "$WORLD" ]] && ( isTrue "${FORCE_WORLD_COPY}" || [ ! -d "$worldDest" ] );
|
||||
log "Cloning world directory from $WORLD ..."
|
||||
rsync --recursive --delete "${WORLD%/}"/ "$worldDest"
|
||||
else
|
||||
log "ERROR: world file/directory $WORLD is missing"
|
||||
logError "World file/directory $WORLD is missing"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
|
||||
Reference in New Issue
Block a user