File tree Expand file tree Collapse file tree 1 file changed +21
-3
lines changed
Expand file tree Collapse file tree 1 file changed +21
-3
lines changed Original file line number Diff line number Diff line change @@ -455,6 +455,26 @@ enableWorld() {
455455 setMSCSValue " $1 " " mscs-enabled" " true"
456456}
457457
458+ # ---------------------------------------------------------------------------
459+ # Import a world.
460+ #
461+ # @param 1 The location of the world to import.
462+ # @param 2 The name of the new imported world.
463+ # @param 3 The port of the new imported world.
464+ # @param 4 The IP address of the new imported world.
465+ # ---------------------------------------------------------------------------
466+ importWorld () {
467+ local NAME
468+ mkdir -p " $WORLDS_LOCATION /$2 "
469+ cp -R $1 /* $WORLDS_LOCATION /$2
470+ chown $( id -un) :$( id -gn) -R $WORLDS_LOCATION /$2
471+ NAME=$( getServerPropertiesValue $2 ' level-name' )
472+ if [ -d $WORLDS_LOCATION /$2 /$NAME ]; then
473+ mv $WORLDS_LOCATION /$2 /$NAME $WORLDS_LOCATION /$2 /$2
474+ fi
475+ createWorld " $2 " " $3 " " $4 "
476+ }
477+
458478# ---------------------------------------------------------------------------
459479# Grab the list of enabled worlds.
460480#
@@ -2511,9 +2531,7 @@ case "$COMMAND" in
25112531 fi
25122532 # Import the world.
25132533 printf " Importing Minecraft world: $2 "
2514- mkdir -p " $WORLDS_LOCATION /$2 "
2515- cp -R $1 /* $WORLDS_LOCATION /$2
2516- createWorld " $2 " " $3 " " $4 "
2534+ importWorld " $1 " " $2 " " $3 " " $4 "
25172535 printf " .\n"
25182536 ;;
25192537 rename)
You can’t perform that action at this time.
0 commit comments