Loading worlds doesn't work...

Discussion in 'Spigot Plugin Development' started by Proudyy, Aug 6, 2018.

Thread Status:
Not open for further replies.
  1. Hey!
    I have a problem. If i want to load/import worlds from a stringlists file, it gives me an error.
    Later more to that. First of all my import method:
    Code (Text):
        void loadWorlds() {
            for (String w : FileManager.worldscfg.getStringList("Worlds")) {
                plugin.getServer().createWorld(new WorldCreator(w));
    I pasted this method into the onEnable() part and started my homeserver and it gives me this error:
    Of course you have to see also my file which concludes the worlds names:
    And my server folder exactly contains the world: 'SkyblockReloaded_' but it still spits out this error.. :/
    I beg u for help pls.
  2. That NullPointerException is thrown from within your function, not somewhere else. So one of the variables you're dereferencing must be null. I can't see line numbers, but it's in line 79. Figure out which it is, perhaps by printing them out, and go from there. My money is on FileManager.worldscfg. ;)
  3. Hehe, gimme a moment. :p
  4. So it means w has to be 0
    But the yml contains a string so why shall it be null??
  5. No, I think plugin is null. I see no constructor where that field is filled in. Pro tip: Make required fields final so you don't forget to initialize them ;)
  6. w8 i try this: getServer().createWorld(new WorldCreator(w));
    I hadn't even to write the plugin before because i were already in the main class Facepalm sry
  7. Oh yeah, I didn't even notice that this was the JavaPlugin class. Well, problem solved. :)
  8. Yup, is it possible to marry you?
    I mean i would sit on this ages and u solved it that fast, thank you very much! :love:
    • Funny Funny x 1
  9. Uhh how can i set a thread to solved? :eek:
Thread Status:
Not open for further replies.