getWorlds() not listing my world.

Discussion in 'Plugin Development' started by A2020, Sep 26, 2019.

  1. Offline

    A2020

    So I'm creating a World after running a command.

    I want to check if the World already exists so I don't create it again (Maybe this is not an issue)

    I'm using Bukkit.getWorlds() to list of the worlds, but my World isn't on the list.

    If after creating my world I teleport into it and then exit and stop the server, my world gets saved.

    Code:
    [12:53:07] [Server thread/INFO]: Saving players
    [12:53:07] [Server thread/INFO]: Saving worlds
    [12:53:07] [Server thread/INFO]: Saving chunks for level 'world'/minecraft:overworld
    [12:53:08] [Server thread/INFO]: ThreadedAnvilChunkStorage (world): All chunks are saved
    [12:53:08] [Server thread/INFO]: Saving chunks for level 'world_nether'/minecraft:the_nether
    [12:53:08] [Server thread/INFO]: ThreadedAnvilChunkStorage (DIM-1): All chunks are saved
    [12:53:08] [Server thread/INFO]: Saving chunks for level 'world_the_end'/minecraft:the_end
    [12:53:08] [Server thread/INFO]: ThreadedAnvilChunkStorage (DIM1): All chunks are saved
    [12:53:08] [Server thread/INFO]: Saving chunks for level 'SkyBlockZ'/minecraft:skyblockz
    [12:53:08] [Server thread/INFO]: ThreadedAnvilChunkStorage (SkyBlockZ): All chunks are saved
    [12:53:08] [Server thread/INFO]: ThreadedAnvilChunkStorage (world): All chunks are saved
    [12:53:08] [Server thread/INFO]: ThreadedAnvilChunkStorage (DIM-1): All chunks are saved
    [12:53:08] [Server thread/INFO]: ThreadedAnvilChunkStorage (DIM1): All chunks are saved
    [12:53:08] [Server thread/INFO]: ThreadedAnvilChunkStorage (SkyBlockZ): All chunks are saved
    When I relaunch the server, Bukkit.getWorlds() still doesn't list my world, if I try to force my teleport into it, wont work with a null error.

    Also, after restarting the server it put me on the Overworld at the coordinates of my own created world.

    What am I missing here? Should I run the createWorld() every time onEnable() or somewhere?

    I though createWorld() was overwriting an already saved world, but it's not the case as some blocks I placed were still there even after running that method again and again.

    PS: I also tried Bukkit.getWorld("SkyBlockZ") and still doesn't return my world. The world name is correct.
     
  2. Offline

    Sir_Jonn

    Create the world, don't worry it wont delete the files it'll simply just load it
     
    A2020 likes this.
  3. Offline

    A2020

    So I could just create the world onEnable, or should I do it at some other stage?

    Thanks for the response, gonna start experimenting with it ;)
     
  4. Offline

    Sir_Jonn

    Do it for your on enable so you don't need to call it again
     
    A2020 likes this.

Share This Page