Check if world exists (even it is unloaded) ?

Discussion in 'Plugin Development' started by blablubbabc, Jan 27, 2013.

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

    blablubbabc

    Hey,
    I currently encounterd that .getWorld(worldName) return null, if the world is not loaded (even if it exists).

    So I now use: createWorld(WorldCreator sutff) to load the world. This function loads the world if it exists and generates a new one if it doesn't.

    But what I want is: Load the world, IF it exists. I don't want to create a new one, if it doesn't.. :(
    If it exists (but is unloaded, getWorld(String worldname) return null for it then) I want to load it, and if it doesn't exist I want to print some warning.

    Basicly: Is there a way to check if a world exists, but is unloaded?
     
  2. Offline

    _Waffles_

    you could check for the world file using file.exists()
     
    kittenchunks likes this.
  3. Offline

    blablubbabc

    You mean the folder? good idea :) Can I somehow easily check, if the folder is a "world-folder" ?
     
  4. Offline

    _Waffles_

    Well, all world folders have a level.dat inside it, so you could check for that.
     
Thread Status:
Not open for further replies.

Share This Page