Solved How to reset a world?

Discussion in 'Spigot Plugin Development' started by MrPowerGamerBR, Jun 24, 2016.

  1. Howdy! So, as the title says, I'm trying to reset a world (delete and recreate it), and, no, this isn't for resetting a adventure map, this is for resetting a survival resource/mining map, so I need it to be random every time.

    I already tried doing this, however some of the regions files aren't deleted.
    Code (Text):
            World w = Bukkit.getWorld("ResourceWorld");
            Bukkit.unloadWorld(w, false);
            try {
                FileUtils.cleanDirectory(new File("ResourceWorld").getAbsoluteFile());
                FileUtils.deleteDirectory(new File("ResourceWorld").getAbsoluteFile());
            } catch (IOException e) {
                // TODO Auto-generated catch block
    So... How can I do this?
  2. Are you sure that the world is being unloaded? Check if unloadWorld() returns true. If it returns false that means it could not be unloaded.
  3. It seems it isn't unloading correctly then. :(
  4. Solved... well, it requires Multiverse Core, but hey! It works!
    Code (Text):
            MultiverseCore multiverseCore = (MultiverseCore) getServer().getPluginManager().getPlugin("Multiverse-Core");
            // World Name, Use new seed, random seed, seed
            multiverseCore.regenWorld("ResourceWorld", true, false, "seed");
    If you are using newer Multiverse Core (My server is running MC 1.7.10) versions, you need to use multiverseCore.getMVWorldManager.regenWorld("ResourceWorld", true, false, "seed");