mirror of
https://github.com/itzg/docker-minecraft-server.git
synced 2024-06-07 19:40:43 +00:00
parent
90907f7b1e
commit
c8eb0f5874
@ -674,6 +674,19 @@ will be deleted when the container is deleted.
|
||||
you should use an IP address or a globally resolveable FQDN, or else the
|
||||
name of a linked container.
|
||||
|
||||
### Cloning world from a container path
|
||||
|
||||
The `WORLD` option can also be used to reference a directory that will be used
|
||||
as a source to clone the world directory.
|
||||
|
||||
For example, the following would initially clone the world's content
|
||||
from `/worlds/basic`. Also notice in the example that you can use a
|
||||
read-only volume attachment to ensure the clone source remains pristine.
|
||||
|
||||
```
|
||||
docker run ... -v $HOME/worlds:/worlds:ro -e WORLD=/worlds/basic
|
||||
```
|
||||
|
||||
### Downloadable mod/plugin pack for Forge, Bukkit, and Spigot Servers
|
||||
|
||||
Like the `WORLD` option above, you can specify the URL of a "mod pack"
|
||||
|
@ -1,5 +1,7 @@
|
||||
#!/bin/bash
|
||||
|
||||
worldDest=/data/$LEVEL
|
||||
|
||||
# If supplied with a URL for a world, download it and unpack
|
||||
if [[ "$WORLD" ]]; then
|
||||
case "X$WORLD" in
|
||||
@ -9,25 +11,34 @@ case "X$WORLD" in
|
||||
echo "Unzipping world"
|
||||
unzip -o -q /data/world.zip
|
||||
rm -f /data/world.zip
|
||||
if [ ! -d /data/world ]; then
|
||||
if [ ! -d $worldDest ]; then
|
||||
echo World directory not found
|
||||
for i in /data/*/level.dat; do
|
||||
if [ -f "$i" ]; then
|
||||
d=`dirname "$i"`
|
||||
echo Renaming world directory from $d
|
||||
mv -f "$d" /data/world
|
||||
mv -f "$d" $worldDest
|
||||
fi
|
||||
done
|
||||
fi
|
||||
if [ "$TYPE" = "SPIGOT" ]; then
|
||||
# Reorganise if a Spigot server
|
||||
echo "Moving End and Nether maps to Spigot location"
|
||||
[ -d "/data/world/DIM1" ] && mv -f "/data/world/DIM1" "/data/world_the_end"
|
||||
[ -d "/data/world/DIM-1" ] && mv -f "/data/world/DIM-1" "/data/world_nether"
|
||||
[ -d "$worldDest/DIM1" ] && mv -f "$worldDest/DIM1" "/data/${LEVEL}_the_end"
|
||||
[ -d "$worldDest/DIM-1" ] && mv -f "$worldDest/DIM-1" "/data/${LEVEL}_nether"
|
||||
fi
|
||||
;;
|
||||
*)
|
||||
echo "Invalid URL given for world: Must be HTTP or HTTPS and a ZIP file"
|
||||
if [[ -d $WORLD ]]; then
|
||||
if [[ ! -d $worldDest ]]; then
|
||||
echo "Cloning world directory from $WORLD ..."
|
||||
cp -r $WORLD $worldDest
|
||||
else
|
||||
echo "Skipping clone from $WORLD since $worldDest exists"
|
||||
fi
|
||||
else
|
||||
echo "Invalid URL given for world: Must be HTTP or HTTPS and a ZIP file"
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
|
Loading…
Reference in New Issue
Block a user