1.12.2 [Bukkit.getServer.getWorld("WorldName")] Is world name just the name of a folder?

Discussion in 'Spigot Plugin Development' started by AcidicViper, Feb 16, 2020.

  1. The title pretty much explains it all, I'm doing Bukkit.getServer().getWorld("WorldName") and it's returning null. So any help is appreciated. Thanks.

    (As you can tell not well versed in this)
     
  2. Check if really exists the world with that name. Where you start your server launcher see that, a carpert with the correct name.
     
  3. a carpet with the correct name? I went and I listed Bukkit.GetWorlds and it doesn't apear on there. How do I add this world?
     
  4. If the carpet with the name of that world no exists, you have to create/add it. With some code you create a new world or change your default world with the name that you want. I don't know that exactly you want with that name but, well, do it like I said.
     
  5. First of all, I have no clue what the carpet is that you keep mentioning. Secondly, I want the world to have the builds. So creating a new world isn't an option, how do I get the world from the Server files even though the server doesn't recognize that it's a world when I use Bukkit.getWorlds();
     
  6. My question is, are you sure that the world exists?
     
  7. its
    Code (Java):
    Bukkit.getWorld("worldname")
    do not include getServer()

    edit: You said Bukkit.getWorlds() doesn't list the world? are you loading it? You don't just upload the files and thats it, you have to load it on plugin enable
     
  8. An important thing to remember is that only one world gets automatically loaded by the server at startup: the "level" specified in your server.properties file. The server will also load its various dimensions (i.e. the nether & end) if those are enabled. Every other world must be loaded by a plugin, so people typically install something like Multiverse to accommodate their world needs.

    In order to load other worlds yourself, however, you must "create" them (which will, according to the JavaDocs, actually just load the worlds if their folders already exist).

    See:
    Code (Java):

    Bukkit.createWorld(new WorldCreator("ExistingWorldNameHere"));
     
    That's the simplest way to get a world loaded, but you can specify quite a few options like the world's seed and generator via the WorldCreator instance's methods as well.
     
  9. I think he means "folder" in spanish it is "carpeta" so he could be confused.
    And yes it is the name of a folder but the world needs to be loaded for that method to work