Dynamic World Loading

Discussion in 'Plugin Development' started by geekygenius, May 10, 2012.

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

    geekygenius

    Hey, so I was wondering how one would dynamically load/unload worlds at runtime. My end result is to have one world out of many loaded at a time. Anything about the topic of world loading is appreciated.
     
  2. Offline

    geekygenius

  3. Offline

    Father Of Time

    Using the createWorld() and unloadWorld() functions in the server class:

    Regardless if they are loaded into memory or not they always exist on the hard drive; so to add a world you call the first function with the world name to load the world into memory, then to unload it you call the second function with the worlds name and whether it should save before unloading (boolean).

    I've not ever unloaded a world, only loaded so this may not work 100% as I say, but I would imagine it will work fairly problem free from my experience with the create world classes.

    Hope this helps!
     
    Phasesaber likes this.
  4. Offline

    zombieman1000

    so this is a plugin right.Well you could add threads to load but im not very smart in this plugin
     
  5. Offline

    geekygenius

    Thanks! So, If I only want one world at a time, in the plugin.enable() I would unload every world. Then, because of how my plugin is designed I would load the world needed. When I needed to switch worlds, I would unload the current world, and load the next world, along with teleporting all the players to the new world. Does this sound right?
     
  6. Offline

    Cooliojazz

    Except for needing to load the new world, teleport the players, then unload the old world, yes.
     
    geekygenius likes this.
  7. Offline

    geekygenius

    Ok, thanks. Saved me a big headache!
     
  8. Offline

    joshua katz

Thread Status:
Not open for further replies.

Share This Page