Load specific world in a Minecraft server at startup?

Load specific world in a Minecraft server at startup? - Creative group of colleagues during work process

I set up a home Minecraft server for my son (Spigot server, running on Debian). This is great because he can't boot it on his own, which helps control his play time (and means that I "have" to play when he does - which is fun!). The server is only accessible from our LAN, which means he can play free from fears of griefing or not knowing who he's up against.

He would like to invite some friends over to play some time. This leaves me with a dilemma: Do we let his friends into our world, and risk that one will break something we built or take resources we have built up? Or is it better to fully back up our world, and generate (and save) a new one specifically for times when friends come to visit?

He's put quite a bit of time into our world, we've built bases all over and have a good system of Nether portals to travel between them. I know he'd be excited to show off his wolves and horses, and the bases we made, and places we explored. But he'd also be upset if a base was broken, or if items like diamonds or magic armor or etc. were taken by friends and remained in their inventory when they quit so that he couldn't access them any more.

A new world would prevent this - but would also mean he would be starting at zero, and couldn't show off what he's done so far. Using our world would mean he CAN show off stuff, and that we could hand out a "welcome kit" for visitors with some armor, weapons, and food, which would be nice.

Is there some kind of command line switch that would get a Spigot server to load a specific saved world on boot? Can I have it load more than one world, and select the one I want at login? (It's an ultracompact PC, so I'm worried about the overhead of having multiple worlds loaded and running at once!) Other suggestions? If a world backup is best, how do I go about making a COMPLETE backup of our world and generate a new one for sharing? If I lost our world he'd be utterly crushed!



Best Answer

Is there some kind of command line switch that would get a Spigot server to load a specific saved world on boot?

You can use the server.properties file, which is loaded at server's boot, more precisely the level-name option.

You said you were using Debian, you can totally go with a simple script :

You can consider creating a file named startSpecificMap.sh under the root directory of your server (where is located your start.sh and server.properties)

startSpecificMap.sh :

#!/bin/bash

if [ "$#" -ne 1 ]; then
    echo "Usage : $0 map-name" >&2
    exit 1
fi
name=$1
sed "s/\(level-name=*\)[^ ]*/\1$name/" server.properties > server.properties.tmp && mv server.properties.tmp server.properties
./start.sh # replace this with your own start script name if necessary

this script replace the content of level-name=worldname in server.properties with a given name

To fullfil you needs you just have to make a copy of the original map, and name it something else. Then instead of running ./start.sh you use ./startSpecificMap [mapName] where mapName could be the original map or the copy you made.

Then you would have only 1 map loaded at a time and can switch with a single reboot.




Pictures about "Load specific world in a Minecraft server at startup?"

Load specific world in a Minecraft server at startup? - Planet Earth
Load specific world in a Minecraft server at startup? - Person Holding World Globe Facing Mountain
Load specific world in a Minecraft server at startup? - This picture shows an american astronaut in his space and extravehicular activity suite working outside of a spacecraft. In the background parts of a space shuttle are visible. In the far background of the picture planet earth with it's blue color and whi



How do you import a world into a Minecraft server?

Uploading your world to the server
  • Stop your server.
  • Access your server files via an FTP client such as Filezilla.
  • Find the world folder that you want to upload.
  • Drag it over to the home directory of the server.
  • Wait for the world to fully update from FileZilla, make sure no files are failing to transfer.


  • How do you preload a Minecraft world?

    First, you need to set up a world border that contains the area you wish to pre-generate. You can do this using the Minecraft /worldborder command, or Nucleus /world border command. Pre-generation is started using the /world border gen command.

    How do I put singleplayer world on my server?

    Delete the folder names "world" in the server's folder and move your singleplayer world into the server's folder and rename it to "world" all lower-case. Then run the "Run" file and the server should start up. You will need to use Hamachi to have your friends join, or you can port-forward.

    How do I start my Minecraft server on startup?

    Setup Minecraft server to start automatically
  • Triggers tab. Click New and create a trigger. ...
  • Actions tab. Click New and create a new Start a Program type action. ...
  • Conditions tab. Clear all checkboxes.
  • Settings tab. Check Allow task to be run on demand. ...
  • Now just click OK to save all changes.




  • How to Pregenerate your Minecraft world




    Sources: Stack Exchange - This article follows the attribution requirements of Stack Exchange and is licensed under CC BY-SA 3.0.

    Images: Helena Lopes, Pixabay, Porapak Apichodilok, Pixabay