Load specific world in a Minecraft server at startup?
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!
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.