World Reset to original?

Discussion in 'Plugin Development' started by frogman6102, Dec 30, 2014.

Thread Status:
Not open for further replies.
  1. Offline

    frogman6102

    Hello! I'm making a minigame plugin and I want a world named, arena_ship, to be unloaded to a state of which it isn't destroyed. So kinda like reseting it. Any ideas?
     
  2. Offline

    mine-care

    @frogman6102
    first of all, make sure autosave is disabled in the world you want to restore.
    When the game is done, unload the world without saving.
    load it again. It should be fine :) In any way keep a backup of the world
     
    Feindbild likes this.
  3. Offline

    frogman6102

    @mine-care What code could I use for this? I don't have a clue upon how to unload and load it again?
     
  4. Offline

    Skionz

  5. Offline

    frogman6102

    @Skionz Doesn't work. It reloads a whole nother world every single time the server ends, even if the unloadWorld method isn't called???

    Code:
    public static void unloadWorld(String worldname){
           
           
            World w = Bukkit.getWorld(worldname);
           
            Bukkit.unloadWorld(w, false);
           
           
           
            WorldCreator wc = new WorldCreator(worldname);
            wc.createWorld();
       
        }
     
  6. Offline

    Funergy

  7. Offline

    Ivan

    You're right, when there's still a player in that world. Unfortunately that resource wont take care of that. Be sure to teleport all the players out of that particular world (and to be safe you can loop over it's loaded chunks and call .unloadChunk(), but that might be done by unloadWorld). You can double check if a world unloaded successfully since .unloadWorld() returns a boolean success.
     
  8. Offline

    frogman6102

    @Funergy Cool! I have it down and ready. But, I have one issue. Will this delete everything? I need an arena to regenerate. Will this happen or will it regenerate a whole new world without regards to my previous build? And how do I load up the world again?
     
Thread Status:
Not open for further replies.

Share This Page