Unloading and then regenerating a world

Discussion in 'Plugin Development' started by Eballer48, Aug 7, 2012.

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

    Eballer48

    I need to unload a world and then regenerate the world while the server is still running, is this possible because it's not the main world?

    Code:java
    1.  
    2. public void test123() {
    3.  
    4. World world = Bukkit.getServer().getWorld(MAIN_WORLD_NAME);
    5.  
    6. for (Player p : Bukkit.getOnlinePlayers()) {
    7. p.teleport(new Location(world, world.getSpawnLocation().getX(), world.getSpawnLocation().getY(), world.getSpawnLocation().getZ()));
    8. p.kickPlayer(ChatColor.AQUA + "Kick message");
    9. }
    10.  
    11. Bukkit.getServer().unloadWorld(WORLD, true);
    12. deleteDir(new File(WORLD_NAME));
    13. WorldCreator wc = new WorldCreator(WORLD_NAME);
    14. wc.environment(Environment.NORMAL);
    15. wc.createWorld();
    16. }
    17.  


    Console is flooded with errors when I try to run this code..
     
  2. Offline

    stelar7

    might be an idea to post the errors, so we can tell you where they are...
     
  3. Offline

    Eballer48

    Please don't be a smart ass.. there are literally over 300 errors.. hence why I say the console is 'flooded'.

    Edit:
    Console can't even fit all the errors.. but here is what it could:
    Code:
    ver.java:451)
    10:23:40 [SEVERE]       at net.minecraft.server.ThreadServerApplication.run(Sour
    ceFile:492)
    10:23:40 [SEVERE] net.minecraft.server.WorldConlictException: Failed to check se
    ssion lock, aborting
    10:23:40 [SEVERE]       at net.minecraft.server.WorldNBTStorage.checkSession(Wor
    ldNBTStorage.java:77)
    10:23:40 [SEVERE]       at net.minecraft.server.World.m(World.java:2717)
    10:23:40 [SEVERE]       at net.minecraft.server.ChunkRegionLoader.a(ChunkRegionL
    oader.java:77)
    10:23:40 [SEVERE]       at net.minecraft.server.ChunkProviderServer.saveChunk(Ch
    unkProviderServer.java:161)
    10:23:40 [SEVERE]       at net.minecraft.server.ChunkProviderServer.unloadChunks
    (ChunkProviderServer.java:243)
    10:23:40 [SEVERE]       at net.minecraft.server.World.doTick(World.java:1739)
    10:23:40 [SEVERE]       at net.minecraft.server.MinecraftServer.w(MinecraftServe
    r.java:546)
    10:23:40 [SEVERE]       at net.minecraft.server.MinecraftServer.run(MinecraftSer
    ver.java:451)
    10:23:40 [SEVERE]       at net.minecraft.server.ThreadServerApplication.run(Sour
    ceFile:492)
    10:23:40 [SEVERE] net.minecraft.server.WorldConlictException: Failed to check se
    ssion lock, aborting
    10:23:40 [SEVERE]       at net.minecraft.server.WorldNBTStorage.checkSession(Wor
    ldNBTStorage.java:77)
    10:23:40 [SEVERE]       at net.minecraft.server.World.m(World.java:2717)
    10:23:40 [SEVERE]       at net.minecraft.server.ChunkRegionLoader.a(ChunkRegionL
    oader.java:77)
    10:23:40 [SEVERE]       at net.minecraft.server.ChunkProviderServer.saveChunk(Ch
    unkProviderServer.java:161)
    10:23:40 [SEVERE]       at net.minecraft.server.ChunkProviderServer.unloadChunks
    (ChunkProviderServer.java:243)
    10:23:40 [SEVERE]       at net.minecraft.server.World.doTick(World.java:1739)
    10:23:40 [SEVERE]       at net.minecraft.server.MinecraftServer.w(MinecraftServe
    r.java:546)
    10:23:40 [SEVERE]       at net.minecraft.server.MinecraftServer.run(MinecraftSer
    ver.java:451)
    10:23:40 [SEVERE]       at net.minecraft.server.ThreadServerApplication.run(Sour
    ceFile:492)
    10:23:40 [SEVERE] net.minecraft.server.WorldConlictException: Failed to check se
    ssion lock, aborting
    10:23:40 [SEVERE]       at net.minecraft.server.WorldNBTStorage.checkSession(Wor
    ldNBTStorage.java:77)
    10:23:40 [SEVERE]       at net.minecraft.server.World.m(World.java:2717)
    10:23:40 [SEVERE]       at net.minecraft.server.ChunkRegionLoader.a(ChunkRegionL
    oader.java:77)
    10:23:40 [SEVERE]       at net.minecraft.server.ChunkProviderServer.saveChunk(Ch
    unkProviderServer.java:161)
    10:23:40 [SEVERE]       at net.minecraft.server.ChunkProviderServer.unloadChunks
    (ChunkProviderServer.java:243)
    10:23:40 [SEVERE]       at net.minecraft.server.World.doTick(World.java:1739)
    10:23:40 [SEVERE]       at net.minecraft.server.MinecraftServer.w(MinecraftServe
    r.java:546)
    10:23:40 [SEVERE]       at net.minecraft.server.MinecraftServer.run(MinecraftSer
    ver.java:451)
    10:23:40 [SEVERE]       at net.minecraft.server.ThreadServerApplication.run(Sour
    ceFile:492)
    10:23:40 [SEVERE] net.minecraft.server.WorldConlictException: Failed to check se
    ssion lock, aborting
    10:23:40 [SEVERE]       at net.minecraft.server.WorldNBTStorage.checkSession(Wor
    ldNBTStorage.java:77)
    10:23:40 [SEVERE]       at net.minecraft.server.World.m(World.java:2717)
    10:23:40 [SEVERE]       at net.minecraft.server.ChunkRegionLoader.a(ChunkRegionL
    oader.java:77)
    10:23:40 [SEVERE]       at net.minecraft.server.ChunkProviderServer.saveChunk(Ch
    unkProviderServer.java:161)
    10:23:40 [SEVERE]       at net.minecraft.server.ChunkProviderServer.unloadChunks
    (ChunkProviderServer.java:243)
    10:23:40 [SEVERE]       at net.minecraft.server.World.doTick(World.java:1739)
    10:23:40 [SEVERE]       at net.minecraft.server.MinecraftServer.w(MinecraftServe
    r.java:546)
    10:23:40 [SEVERE]       at net.minecraft.server.MinecraftServer.run(MinecraftSer
    ver.java:451)
    10:23:40 [SEVERE]       at net.minecraft.server.ThreadServerApplication.run(Sour
    ceFile:492)
    10:23:40 [SEVERE] net.minecraft.server.WorldConlictException: Failed to check se
    ssion lock, aborting
    10:23:40 [SEVERE]       at net.minecraft.server.WorldNBTStorage.checkSession(Wor
    ldNBTStorage.java:77)
    10:23:40 [SEVERE]       at net.minecraft.server.World.m(World.java:2717)
    10:23:40 [SEVERE]       at net.minecraft.server.ChunkRegionLoader.a(ChunkRegionL
    oader.java:77)
    10:23:40 [SEVERE]       at net.minecraft.server.ChunkProviderServer.saveChunk(Ch
    unkProviderServer.java:161)
    10:23:40 [SEVERE]       at net.minecraft.server.ChunkProviderServer.unloadChunks
    (ChunkProviderServer.java:243)
    10:23:40 [SEVERE]       at net.minecraft.server.World.doTick(World.java:1739)
    10:23:40 [SEVERE]       at net.minecraft.server.MinecraftServer.w(MinecraftServe
    r.java:546)
    10:23:40 [SEVERE]       at net.minecraft.server.MinecraftServer.run(MinecraftSer
    ver.java:451)
    10:23:40 [SEVERE]       at net.minecraft.server.ThreadServerApplication.run(Sour
    ceFile:492)
    10:23:40 [SEVERE] net.minecraft.server.WorldConlictException: Failed to check se
    ssion lock, aborting
    10:23:40 [SEVERE]       at net.minecraft.server.WorldNBTStorage.checkSession(Wor
    ldNBTStorage.java:77)
    10:23:40 [SEVERE]       at net.minecraft.server.World.m(World.java:2717)
    10:23:40 [SEVERE]       at net.minecraft.server.ChunkRegionLoader.a(ChunkRegionL
    oader.java:77)
    10:23:40 [SEVERE]       at net.minecraft.server.ChunkProviderServer.saveChunk(Ch
    unkProviderServer.java:161)
    10:23:40 [SEVERE]       at net.minecraft.server.ChunkProviderServer.unloadChunks
    (ChunkProviderServer.java:243)
    10:23:40 [SEVERE]       at net.minecraft.server.World.doTick(World.java:1739)
    10:23:40 [SEVERE]       at net.minecraft.server.MinecraftServer.w(MinecraftServe
    r.java:546)
    10:23:40 [SEVERE]       at net.minecraft.server.MinecraftServer.run(MinecraftSer
    ver.java:451)
    10:23:40 [SEVERE]       at net.minecraft.server.ThreadServerApplication.run(Sour
    ceFile:492)
    10:23:40 [SEVERE] net.minecraft.server.WorldConlictException: Failed to check se
    ssion lock, aborting
    10:23:40 [SEVERE]       at net.minecraft.server.WorldNBTStorage.checkSession(Wor
    ldNBTStorage.java:77)
    10:23:40 [SEVERE]       at net.minecraft.server.World.m(World.java:2717)
    10:23:40 [SEVERE]       at net.minecraft.server.ChunkRegionLoader.a(ChunkRegionL
    oader.java:77)
    10:23:40 [SEVERE]       at net.minecraft.server.ChunkProviderServer.saveChunk(Ch
    unkProviderServer.java:161)
    10:23:40 [SEVERE]       at net.minecraft.server.ChunkProviderServer.unloadChunks
    (ChunkProviderServer.java:243)
    10:23:40 [SEVERE]       at net.minecraft.server.World.doTick(World.java:1739)
    10:23:40 [SEVERE]       at net.minecraft.server.MinecraftServer.w(MinecraftServe
    r.java:546)
    10:23:40 [SEVERE]       at net.minecraft.server.MinecraftServer.run(MinecraftSer
    ver.java:451)
    10:23:40 [SEVERE]       at net.minecraft.server.ThreadServerApplication.run(Sour
    ceFile:492)
    10:23:40 [SEVERE] net.minecraft.server.WorldConlictException: Failed to check se
    ssion lock, aborting
    10:23:40 [SEVERE]       at net.minecraft.server.WorldNBTStorage.checkSession(Wor
    ldNBTStorage.java:77)
    10:23:40 [SEVERE]       at net.minecraft.server.World.m(World.java:2717)
    10:23:40 [SEVERE]       at net.minecraft.server.ChunkRegionLoader.a(ChunkRegionL
    oader.java:77)
    10:23:40 [SEVERE]       at net.minecraft.server.ChunkProviderServer.saveChunk(Ch
    unkProviderServer.java:161)
    10:23:40 [SEVERE]       at net.minecraft.server.ChunkProviderServer.unloadChunks
    (ChunkProviderServer.java:243)
    10:23:40 [SEVERE]       at net.minecraft.server.World.doTick(World.java:1739)
    10:23:40 [SEVERE]       at net.minecraft.server.MinecraftServer.w(MinecraftServe
    r.java:546)
    10:23:40 [SEVERE]       at net.minecraft.server.MinecraftServer.run(MinecraftSer
    ver.java:451)
    10:23:40 [SEVERE]       at net.minecraft.server.ThreadServerApplication.run(Sour
    ceFile:492)
    10:23:40 [SEVERE] net.minecraft.server.WorldConlictException: Failed to check se
    ssion lock, aborting
    10:23:40 [SEVERE]       at net.minecraft.server.WorldNBTStorage.checkSession(Wor
    ldNBTStorage.java:77)
    10:23:40 [SEVERE]       at net.minecraft.server.World.m(World.java:2717)
    10:23:40 [SEVERE]       at net.minecraft.server.ChunkRegionLoader.a(ChunkRegionL
    oader.java:77)
    10:23:40 [SEVERE]       at net.minecraft.server.ChunkProviderServer.saveChunk(Ch
    unkProviderServer.java:161)
    10:23:40 [SEVERE]       at net.minecraft.server.ChunkProviderServer.unloadChunks
    (ChunkProviderServer.java:243)
    10:23:40 [SEVERE]       at net.minecraft.server.World.doTick(World.java:1739)
    10:23:40 [SEVERE]       at net.minecraft.server.MinecraftServer.w(MinecraftServe
    r.java:546)
    10:23:40 [SEVERE]       at net.minecraft.server.MinecraftServer.run(MinecraftSer
    ver.java:451)
    10:23:40 [SEVERE]       at net.minecraft.server.ThreadServerApplication.run(Sour
    ceFile:492)
    10:23:40 [SEVERE] net.minecraft.server.WorldConlictException: Failed to check se
    ssion lock, aborting
    10:23:40 [SEVERE]       at net.minecraft.server.WorldNBTStorage.checkSession(Wor
    ldNBTStorage.java:77)
    10:23:40 [SEVERE]       at net.minecraft.server.World.m(World.java:2717)
    10:23:40 [SEVERE]       at net.minecraft.server.ChunkRegionLoader.a(ChunkRegionL
    oader.java:77)
    10:23:40 [SEVERE]       at net.minecraft.server.ChunkProviderServer.saveChunk(Ch
    unkProviderServer.java:161)
    10:23:40 [SEVERE]       at net.minecraft.server.ChunkProviderServer.unloadChunks
    (ChunkProviderServer.java:243)
    10:23:40 [SEVERE]       at net.minecraft.server.World.doTick(World.java:1739)
    10:23:40 [SEVERE]       at net.minecraft.server.MinecraftServer.w(MinecraftServe
    r.java:546)
    10:23:40 [SEVERE]       at net.minecraft.server.MinecraftServer.run(MinecraftSer
    ver.java:451)
    10:23:40 [SEVERE]       at net.minecraft.server.ThreadServerApplication.run(Sour
    ceFile:492)
    10:23:40 [SEVERE] net.minecraft.server.WorldConlictException: Failed to check se
    ssion lock, aborting
    10:23:40 [SEVERE]       at net.minecraft.server.WorldNBTStorage.checkSession(Wor
    ldNBTStorage.java:77)
    10:23:40 [SEVERE]       at net.minecraft.server.World.m(World.java:2717)
    10:23:40 [SEVERE]       at net.minecraft.server.ChunkRegionLoader.a(ChunkRegionL
    oader.java:77)
    10:23:40 [SEVERE]       at net.minecraft.server.ChunkProviderServer.saveChunk(Ch
    unkProviderServer.java:161)
    10:23:40 [SEVERE]       at net.minecraft.server.ChunkProviderServer.unloadChunks
    (ChunkProviderServer.java:243)
    10:23:40 [SEVERE]       at net.minecraft.server.World.doTick(World.java:1739)
    10:23:40 [SEVERE]       at net.minecraft.server.MinecraftServer.w(MinecraftServe
    r.java:546)
    10:23:40 [SEVERE]       at net.minecraft.server.MinecraftServer.run(MinecraftSer
    ver.java:451)
    10:23:40 [SEVERE]       at net.minecraft.server.ThreadServerApplication.run(Sour
    ceFile:492)
    10:23:40 [SEVERE] net.minecraft.server.WorldConlictException: Failed to check se
    ssion lock, aborting
    10:23:40 [SEVERE]       at net.minecraft.server.WorldNBTStorage.checkSession(Wor
    ldNBTStorage.java:77)
    10:23:40 [SEVERE]       at net.minecraft.server.World.m(World.java:2717)
    10:23:40 [SEVERE]       at net.minecraft.server.ChunkRegionLoader.a(ChunkRegionL
    oader.java:77)
    10:23:40 [SEVERE]       at net.minecraft.server.ChunkProviderServer.saveChunk(Ch
    unkProviderServer.java:161)
    10:23:40 [SEVERE]       at net.minecraft.server.ChunkProviderServer.unloadChunks
    (ChunkProviderServer.java:243)
    10:23:40 [SEVERE]       at net.minecraft.server.World.doTick(World.java:1739)
    10:23:40 [SEVERE]       at net.minecraft.server.MinecraftServer.w(MinecraftServe
    r.java:546)
    10:23:40 [SEVERE]       at net.minecraft.server.MinecraftServer.run(MinecraftSer
    ver.java:451)
    10:23:40 [SEVERE]       at net.minecraft.server.ThreadServerApplication.run(Sour
    ceFile:492)
    10:23:40 [SEVERE] net.minecraft.server.WorldConlictException: Failed to check se
    ssion lock, aborting
    10:23:40 [SEVERE]       at net.minecraft.server.WorldNBTStorage.checkSession(Wor
    ldNBTStorage.java:77)
    10:23:40 [SEVERE]       at net.minecraft.server.World.m(World.java:2717)
    10:23:40 [SEVERE]       at net.minecraft.server.ChunkRegionLoader.a(ChunkRegionL
    oader.java:77)
    10:23:40 [SEVERE]       at net.minecraft.server.ChunkProviderServer.saveChunk(Ch
    unkProviderServer.java:161)
    10:23:40 [SEVERE]       at net.minecraft.server.ChunkProviderServer.unloadChunks
    (ChunkProviderServer.java:243)
    10:23:40 [SEVERE]       at net.minecraft.server.World.doTick(World.java:1739)
    10:23:40 [SEVERE]       at net.minecraft.server.MinecraftServer.w(MinecraftServe
    r.java:546)
    10:23:40 [SEVERE]       at net.minecraft.server.MinecraftServer.run(MinecraftSer
    ver.java:451)
    10:23:40 [SEVERE]       at net.minecraft.server.ThreadServerApplication.run(Sour
    ceFile:492)
    10:23:40 [SEVERE] net.minecraft.server.WorldConlictException: Failed to check se
    ssion lock, aborting
    10:23:40 [SEVERE]       at net.minecraft.server.WorldNBTStorage.checkSession(Wor
    ldNBTStorage.java:77)
    10:23:40 [SEVERE]       at net.minecraft.server.World.m(World.java:2717)
    10:23:40 [SEVERE]       at net.minecraft.server.ChunkRegionLoader.a(ChunkRegionL
    oader.java:77)
    10:23:40 [SEVERE]       at net.minecraft.server.ChunkProviderServer.saveChunk(Ch
    unkProviderServer.java:161)
    10:23:40 [SEVERE]       at net.minecraft.server.ChunkProviderServer.unloadChunks
    (ChunkProviderServer.java:243)
    10:23:40 [SEVERE]       at net.minecraft.server.World.doTick(World.java:1739)
    10:23:40 [SEVERE]       at net.minecraft.server.MinecraftServer.w(MinecraftServe
    r.java:546)
    10:23:40 [SEVERE]       at net.minecraft.server.MinecraftServer.run(MinecraftSer
    ver.java:451)
    10:23:40 [SEVERE]       at net.minecraft.server.ThreadServerApplication.run(Sour
    ceFile:492)
    10:23:40 [SEVERE] net.minecraft.server.WorldConlictException: Failed to check se
    ssion lock, aborting
    10:23:40 [SEVERE]       at net.minecraft.server.WorldNBTStorage.checkSession(Wor
    ldNBTStorage.java:77)
    10:23:40 [SEVERE]       at net.minecraft.server.World.m(World.java:2717)
    10:23:40 [SEVERE]       at net.minecraft.server.ChunkRegionLoader.a(ChunkRegionL
    oader.java:77)
    10:23:40 [SEVERE]       at net.minecraft.server.ChunkProviderServer.saveChunk(Ch
    unkProviderServer.java:161)
    10:23:40 [SEVERE]       at net.minecraft.server.ChunkProviderServer.unloadChunks
    (ChunkProviderServer.java:243)
    10:23:40 [SEVERE]       at net.minecraft.server.World.doTick(World.java:1739)
    10:23:40 [SEVERE]       at net.minecraft.server.MinecraftServer.w(MinecraftServe
    r.java:546)
    10:23:40 [SEVERE]       at net.minecraft.server.MinecraftServer.run(MinecraftSer
    ver.java:451)
    10:23:40 [SEVERE]       at net.minecraft.server.ThreadServerApplication.run(Sour
    ceFile:492)
    10:23:40 [SEVERE] net.minecraft.server.WorldConlictException: Failed to check se
    ssion lock, aborting
    10:23:40 [SEVERE]       at net.minecraft.server.WorldNBTStorage.checkSession(Wor
    ldNBTStorage.java:77)
    10:23:40 [SEVERE]       at net.minecraft.server.World.m(World.java:2717)
    10:23:40 [SEVERE]       at net.minecraft.server.World.A(World.java:258)
    10:23:40 [SEVERE]       at net.minecraft.server.World.save(World.java:248)
    10:23:40 [SEVERE]       at net.minecraft.server.World.doTick(World.java:1749)
    10:23:40 [SEVERE]       at net.minecraft.server.MinecraftServer.w(MinecraftServe
    r.java:546)
    10:23:40 [SEVERE]       at net.minecraft.server.MinecraftServer.run(MinecraftSer
    ver.java:451)
    10:23:40 [SEVERE]       at net.minecraft.server.ThreadServerApplication.run(Sour
    ceFile:492)
    10:23:40 [SEVERE] Unexpected exception
    net.minecraft.server.WorldConlictException: Failed to check session lock, aborti
    ng
            at net.minecraft.server.WorldNBTStorage.checkSession(WorldNBTStorage.jav
    a:77)
            at net.minecraft.server.World.m(World.java:2717)
            at net.minecraft.server.World.A(World.java:258)
            at net.minecraft.server.World.save(World.java:248)
            at net.minecraft.server.World.doTick(World.java:1749)
            at net.minecraft.server.MinecraftServer.w(MinecraftServer.java:546)
            at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:451)
            at net.minecraft.server.ThreadServerApplication.run(SourceFile:492)
    >
    
     
  4. Offline

    Firefly

    This is because you are doing something to the world folder. It may be because it hasn't fully unloaded the world yet by the time you delete the folder.
     
  5. Offline

    Eballer48

    Alright.. so how do I fix this?

    Edit:
    I removed the delete world code and figured out it has something to do with unloading the world..
     
  6. Offline

    Kodfod

    Code:JAVA
    1. for (Player p : Bukkit.getOnlinePlayers()) {
    2. p.teleport((Entity) new Location(Bukkit.getWorld("world"), Bukkit.getWorld("world").getSpawnLocation().getX(), Bukkit.getWorld("world").getSpawnLocation().getY(), Bukkit.getWorld("world").getSpawnLocation().getZ()));
    3. p.kickPlayer(ChatColor.AQUA + "Kick message");
    4. }
    5.  
    6. Bukkit.unloadWorld("world", false);
    7.  
    8. Bukkit.setWhitelist(true);
    9.  
    10. getServer().getScheduler().scheduleSyncDelayedTask(this, new Runnable() {
    11.  
    12. public void run() {
    13. deleteDir(new File("world"));
    14. WorldCreator wc = new WorldCreator("world");
    15. wc.environment(Environment.NORMAL);
    16. wc.createWorld();
    17. Bukkit.setWhitelist(false);
    18. }
    19. }, 200L);


    The delay should fix the problem since it gives time for the world to unload. and the white list is just so people dont try to join while regen is happening.
     
  7. Offline

    Eballer48

    Code:
    10:50:16 [INFO] BlahBerrys [/127.0.0.1:52278] logged in with entity id 6051 at (
    [world_hungergames] 202.0, 73.0, 252.0)
    10:50:20 [INFO] Let the games begin! May the odds be ever in your favor.
    10:50:20 [INFO] 2 minutes of invincibility remaining!
    10:50:23 [INFO] [HungerCraft] Attempting to restart the games...
    10:50:23 [SEVERE] Could not pass event PlayerQuitEvent to HungerCraft
    org.bukkit.event.EventException
            at org.bukkit.plugin.java.JavaPluginLoader$1.execute(JavaPluginLoader.ja
    va:304)
            at org.bukkit.plugin.RegisteredListener.callEvent(RegisteredListener.jav
    a:62)
            at org.bukkit.plugin.SimplePluginManager.fireEvent(SimplePluginManager.j
    ava:477)
            at org.bukkit.plugin.SimplePluginManager.callEvent(SimplePluginManager.j
    ava:462)
            at net.minecraft.server.ServerConfigurationManager.disconnect(ServerConf
    igurationManager.java:181)
            at net.minecraft.server.NetServerHandler.disconnect(NetServerHandler.jav
    a:147)
            at org.bukkit.craftbukkit.entity.CraftPlayer.kickPlayer(CraftPlayer.java
    :215)
            at net.HungerCraftGames.HcMain.HcMain.restartGames(HcMain.java:368)
            at net.HungerCraftGames.HcMain.HcCommand.onCommand(HcCommand.java:72)
            at org.bukkit.command.PluginCommand.execute(PluginCommand.java:40)
            at org.bukkit.command.SimpleCommandMap.dispatch(SimpleCommandMap.java:16
    6)
            at org.bukkit.craftbukkit.CraftServer.dispatchCommand(CraftServer.java:4
    84)
            at net.minecraft.server.NetServerHandler.handleCommand(NetServerHandler.
    java:811)
            at net.minecraft.server.NetServerHandler.chat(NetServerHandler.java:771)
     
            at net.minecraft.server.NetServerHandler.a(NetServerHandler.java:754)
            at net.minecraft.server.Packet3Chat.handle(Packet3Chat.java:34)
            at net.minecraft.server.NetworkManager.b(NetworkManager.java:246)
            at net.minecraft.server.NetServerHandler.a(NetServerHandler.java:102)
            at net.minecraft.server.NetworkListenThread.a(NetworkListenThread.java:8
    2)
            at net.minecraft.server.MinecraftServer.w(MinecraftServer.java:559)
            at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:451)
            at net.minecraft.server.ThreadServerApplication.run(SourceFile:492)
    Caused by: java.lang.ArrayIndexOutOfBoundsException: 1
            at net.HungerCraftGames.HcMain.HcListener.onPlayerQuit(HcListener.java:2
    02)
            at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
            at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
            at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
            at java.lang.reflect.Method.invoke(Unknown Source)
            at org.bukkit.plugin.java.JavaPluginLoader$1.execute(JavaPluginLoader.ja
    va:302)
            ... 21 more
    10:50:23 [INFO] [HungerCraft] Games reset/restarted successfully!
    10:50:34 [SEVERE] net.minecraft.server.WorldConlictException: Failed to check se
    ssion lock, aborting
    10:50:34 [SEVERE]       at net.minecraft.server.WorldNBTStorage.checkSession(Wor
    ldNBTStorage.java:77)
    10:50:34 [SEVERE]       at net.minecraft.server.World.m(World.java:2717)
    10:50:34 [SEVERE]       at net.minecraft.server.World.A(World.java:258)
    10:50:34 [SEVERE]       at net.minecraft.server.World.save(World.java:248)
    10:50:34 [SEVERE]       at net.minecraft.server.World.doTick(World.java:1749)
    10:50:34 [SEVERE]       at net.minecraft.server.MinecraftServer.w(MinecraftServe
    r.java:546)
    10:50:34 [SEVERE]       at net.minecraft.server.MinecraftServer.run(MinecraftSer
    ver.java:451)
    10:50:34 [SEVERE]       at net.minecraft.server.ThreadServerApplication.run(Sour
    ceFile:492)
    10:50:34 [SEVERE] Unexpected exception
    net.minecraft.server.WorldConlictException: Failed to check session lock, aborti
    ng
            at net.minecraft.server.WorldNBTStorage.checkSession(WorldNBTStorage.jav
    a:77)
            at net.minecraft.server.World.m(World.java:2717)
            at net.minecraft.server.World.A(World.java:258)
            at net.minecraft.server.World.save(World.java:248)
            at net.minecraft.server.World.doTick(World.java:1749)
            at net.minecraft.server.MinecraftServer.w(MinecraftServer.java:546)
            at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:451)
            at net.minecraft.server.ThreadServerApplication.run(SourceFile:492)
    >
    
     
  8. Offline

    stelar7

    Caused by: java.lang.ArrayIndexOutOfBoundsException: 1
    HcListener.java:202
     
  9. Offline

    Eballer48

    Thats got to do with my onPlayerQuit event.. shouldn't be interfering with the world being unloaded and then regenerated..
     
  10. Offline

    stelar7

    should still fix that...
     
  11. Offline

    Eballer48

    Got it all fixed except now when the timer runs out I still get this error.. its an issue with deleting the world.
    Code:
    22:04:39 [SEVERE] net.minecraft.server.WorldConlictException: Failed to check se
    ssion lock, aborting
    22:04:39 [SEVERE]      at net.minecraft.server.WorldNBTStorage.checkSession(Wor
    ldNBTStorage.java:77)
    22:04:39 [SEVERE]      at net.minecraft.server.World.m(World.java:2717)
    22:04:39 [SEVERE]      at net.minecraft.server.World.A(World.java:258)
    22:04:39 [SEVERE]      at net.minecraft.server.World.save(World.java:248)
    22:04:39 [SEVERE]      at net.minecraft.server.World.doTick(World.java:1749)
    22:04:39 [SEVERE]      at net.minecraft.server.MinecraftServer.w(MinecraftServe
    r.java:546)
    22:04:39 [SEVERE]      at net.minecraft.server.MinecraftServer.run(MinecraftSer
    ver.java:451)
    22:04:39 [SEVERE]      at net.minecraft.server.ThreadServerApplication.run(Sour
    ceFile:492)
    22:04:39 [SEVERE] Unexpected exception
    net.minecraft.server.WorldConlictException: Failed to check session lock, aborti
    ng
            at net.minecraft.server.WorldNBTStorage.checkSession(WorldNBTStorage.jav
    a:77)
            at net.minecraft.server.World.m(World.java:2717)
            at net.minecraft.server.World.A(World.java:258)
            at net.minecraft.server.World.save(World.java:248)
            at net.minecraft.server.World.doTick(World.java:1749)
            at net.minecraft.server.MinecraftServer.w(MinecraftServer.java:546)
            at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:451)
            at net.minecraft.server.ThreadServerApplication.run(SourceFile:492)
    >
    

    Meh code

    Code:java
    1.  
    2. public void restartGames() {
    3. World world = Bukkit.getServer().getWorld(MAIN_WORLD_NAME);
    4.  
    5. for (Player p : Bukkit.getOnlinePlayers()) {
    6. p.teleport(new Location(world, world.getSpawnLocation().getX(), world.getSpawnLocation().getY(), world.getSpawnLocation().getZ()));
    7. p.kickPlayer(ChatColor.AQUA + RESTART_MESSAGE);
    8. }
    9.  
    10. Bukkit.unloadWorld(MAIN_WORLD_NAME, true);
    11.  
    12. getServer().getScheduler().scheduleSyncDelayedTask(this, new Runnable() {
    13.  
    14. public void run() {
    15. deleteDir(new File(MAIN_WORLD_NAME));
    16. WorldCreator wc = new WorldCreator(MAIN_WORLD_NAME);
    17. wc.environment(Environment.NORMAL);
    18. wc.createWorld();
    19. }
    20. }, 200L);
    21.  
    22.  
    23. RESTARTING = false;
    24. }
    25.  
     
  12. Offline

    travja

    All I can say is try giving it more time to unload the world... Either that or it's trying to load a file that already exists and therefore giving the error, I was messing around with Multiverse the other day and couldn't make a new world because it had the same name as another file in my servers directory..
     
  13. Offline

    Builder4Free

    Excessive bumping isn't allowed. At least I don't think it is...
     
  14. Offline

    stelar7

    minimum 12 hours between each bump
     
Thread Status:
Not open for further replies.

Share This Page