NMS IndexOutOfBoundsException from World Deletion

Discussion in 'Plugin Development' started by exload, Aug 20, 2013.

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

    exload

    So yes another issue.. Basically what causes it is I teleport all players out of the world then delete the world and this crashes the server with the following error: http://pastebin.com/fhypKBzi

    I am unsure as to why this is happening. There is no other entities in the world. Mobs cannot spawn and all players are teleported out of the world. Also, all drops are cleared before the world is deleted.

    I can show you the code for what exactly is happening, however, it is a bit hard to understand at first with reading exactly what all the methods do.

    Anyways, any ideas?
     
  2. Offline

    Saposhiente

    It looks like the server is trying to do the game tick (that is, progress time forward one step) after you've already deleted one of the things the server needs in order to do the game tick in that world. I can't be more specific without code.
     
  3. Offline

    The_Doctor_123

    Did you unload chunks or make sure they were unloaded when deleting? Might help to do so. I'm not any professional when it comes to worlds, chunks, and stuff though.
     
  4. Offline

    exload

    Okay so basically this is what happens when a player dies:
    • Checks to see if the player is in an arena
    • Checks to see if the arena is running
    • Ensures the person who killed the player is in the same world as the player who died
    • Fires an arena specific death method (Code)
      • If the arena match is over THEN (Code)
        • Set the arena to not run
        • Teleports the players to another world
        • Records any stats that need to be recorded
        • Removed all the players from the arena
        • Unloads the world
        • Deletes the world
    The problems occur only when the match ends.
     
  5. Offline

    Saposhiente

    Make sure to Bukkit.getServer().unloadWorld(world, false);
     
  6. Offline

    exload

    I forgot to add in the list that I also unloaded the world :p Anyways.. I also do that
     
  7. Offline

    Saposhiente

    Try unloading the world without deleting it and see if you get the same error.
     
  8. Offline

    exload

    Okay so this is interesting.. the plugin gets through all the steps with no error and then the error occurs after this in the PlayerDeathListener
    Code:java
    1. if(!arena.isRunning())
    2. {
    3. System.out.println("9");
    4. return;
    5. }
    6. System.out.println("10");

    Nothing happens after that method. In other words, 10 is never printed to the console.

    Also, if I comment out this method from running when the match is over the error disappears.

    Code:java
    1. public void endTeleportAction()
    2. {
    3. //later should teleport all players to the realm gates or whatever we end up calling them
    4. //Location loc = Bukkit.getWorld("spawn").getSpawnLocation();
    5. ZoneWorld postWorld = ZoneWorldAPI.getWorld(getPostGameSpawn().getWorld());
    6. System.out.println("123");
    7. if(postWorld != null)
    8. {
    9. System.out.println("11");
    10. if(!world.isLoaded())
    11. {
    12. world.load();
    13. System.out.println("22");
    14. }
    15. System.out.println("33");
    16. }else
    17. {
    18. System.out.println("NULL POST WORLD");
    19. }
    20.  
    21. for(Player p : players)
    22. {
    23. System.out.println(p.getName());
    24. ArenaAPI.resetPlayerState(p);
    25. p.teleport(getPostGameSpawn());
    26. }
    27. }

    But obviously I need that method to teleport the players to the other world..

    And the other funny thing about this is that if I let that method run, it all runs through (all debug println show) and the error doesnt occur until what I said above ^^

    Ignore the debugging println :p

    bump.. still having this issue

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: Jun 4, 2016
Thread Status:
Not open for further replies.

Share This Page