New custom worlds not saving

Discussion in 'Spigot Plugin Development' started by Kingbluesapphire, May 17, 2016.

  1. I'm making a plugin which allows the users to create a new world, Im using this..
    Code (Text):

    WorldCreator wc = new WorldCreator(targetWorld);
                        wc.type(type);
                        wc.createWorld();
    To create the world, and it works it generates a working world but... then when i restart the server it doesn't save the new world i add only keeps the 3 default (World, Nether, End)

    Should i be running some code to save the world after i create it or something?
     
  2. You need to load the world or it won't be there on startup.
    You can load worlds by calling Bukkit#createWorld(String path) note that this will create a world with that name if you have the path wrong

    If you don't plan on keeping this plugin on your server, you might want to use multiverse or something similar to load the worlds for you.

    You can also call Bukkit#createWorld(WorldCreator c) to skip a step instead of calling WorldCreator#createWorld
     
  3. So I have to save all the worlds to a config and on startup call Bukkit#createWorld for each one? If so should I use a for loop and save them as a string list in a config?
     
  4. Yes, or use multiverse.