Solved deleteing chunks

Discussion in 'Plugin Development' started by lrdemolition, Aug 29, 2014.

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

    lrdemolition

    how would i unload and delete any loaded chunks inside a world. and then delete the world.

    heres my code so far:
    Code:
                for (Chunk c : Bukkit.getServer().getWorld("arena").getLoadedChunks()){
                        c.unload();
                    }
                    for (Chunk c : Bukkit.getServer().getWorld("arena_nether").getLoadedChunks()){
                        c.unload();
                    }
                   
                    Bukkit.getServer().unloadWorld("arena", false);
                    Bukkit.getServer().unloadWorld("arena_nether", false);
                    File f = (File) Bukkit.getWorld("arena").getWorldFolder();
                    File fn = (File) Bukkit.getWorld("arena_nether").getWorldFolder();
                    if (Bukkit.getWorld("arena").getWorldFolder().isDirectory()) {
                            for (File c : f.listFiles())
                              c.delete();
                            f.delete();
                    }
                    if (Bukkit.getWorld("arena_nether").getWorldFolder().isDirectory()) {
                        for (File c : fn.listFiles())
                          c.delete();
                        fn.delete();
                  }
    this deleates and create a new world, bu when u enter that world it looks corrupted because chunks loaded from the previous world are still there

    bump?

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

    Necrodoom

Thread Status:
Not open for further replies.

Share This Page