NPE Thrown, no apparent fix

Discussion in 'Plugin Development' started by Haribo98, Sep 20, 2013.

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

    Haribo98

    Code:
    Code:java
    1. public void load() {
    2. new File("loaded").delete();
    3. FileUtil.copy(new File(worldName), new File("loaded"));
    4.  
    5. WorldCreator wc = new WorldCreator("loaded");
    6. World world = wc.createWorld();
    7.  
    8. for(Location loc : spawns) {
    9. loc.setWorld(world);
    10. world.loadChunk(world.getChunkAt(loc));
    11. }
    12.  
    13. p1.setWorld(world);
    14. p2.setWorld(world);
    15. }


    When it loads the world, which has been copied from FileUtil, successfully (from what I can see), it throws a strange NPE which I've been stumped over for quite a while now. Any suggestions?

    Edit: Now getting a CME -
    Code:java
    1. world = SurvivalGames.getInstance().getServer().createWorld(wc);
     
  2. Offline

    caseif

    Code:
    us.mcarcade.survivalgames.api.GameMap.load(GameMap.java:142)
    Czech that line. :)
     
  3. Offline

    Haribo98

    I edited it since then, now I'm getting a CME on:
    Code:java
    1. world = SurvivalGames.getInstance().getServer().createWorld(wc);
     
  4. Offline

    caseif

    Haribo98 Make sure to Tahg me if you want me to see that you replied. As for your CME, you're loading the chunk that the location is in while iterating it, which apparently changes the Location object. However, this should be easy, albeit annoying, to work around.
     
  5. Offline

    Haribo98

    AngryNerd That bit is fine, it's the loading of the world, which is throwing it now.
    Code:java
    1. WorldCreator wc = new WorldCreator("loaded" + worldName);
    2. ServerLog.info("Load World");
    3. world = wc.createWorld();


    I decided to comment every line that happens, so I can see where the error occurs.
    I'll see how that turns out, then I can specify almost exactly where the error is.

    AngryNerd Aaaand... We're back to the original error... >.>
    http://pastebin.com/1vyhC0Xr

    GameMap:151
    Code:java
    1. world = wc.createWorld();


    Edit; I'm off to bed, I'll look back in the morning with a fresh mind. Although I can't really see how Bukkit loading a world has anything to do with me P:

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: Jun 4, 2016
  6. Offline

    caseif

    Haribo98 Ehm... I've got nothing. My only recommendation would be to remove your WorldCreator code and replace it with an example you find on the Internet to see if it fixes the problem.
     
Thread Status:
Not open for further replies.

Share This Page