Best way to restore a world from a backup folder without restarting the server?

Discussion in 'Plugin Development' started by nickguletskii, Mar 12, 2011.

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

    nickguletskii

    Currently I am trying to move the player to another world, copy over all of the chunks and put the player back into the original world.

    What is the best way to restore a world? Wouldn't block-by-block copying be very slow?

    Thanks in advance.
    [MERGETIME="1300003862"][/MERGETIME]
    So... I guess I will have to go through all blocks?
     
  2. Offline

    Bubby4j

    Is the backup in the format that worlds are stored in? If so, I'd think you could just copy/overwrite that world's files into that world's folder, but I'd think that world must be unloaded first.
     
  3. Offline

    Edward Hand

    Overwriting worlds players are currently playing it would be a bad thing, as you have clearly realised.

    Your world-moving idea is pretty good though. You could do it fairly seamlessly by just having two worlds. Say everyone is playing on World1. Copy the backup to World2 and then move people seamlessly over to that and delete world1. From then on you make world2 the default world for joining players. Next time you restore you do it in reverse. Copy the backup to world1, move over and delete world2 and back and forth ad-infinitum.
    There are issues such as with plugins which have world-specific properties like the newest permissions plugin, but that would just require some ingenuity.

    Just a thought.
     
  4. Offline

    nickguletskii

    Yeah, but I already have implemented chunk saving (conversion from noserialized chunks to serialized lists of object arrays FTL!). Quite speedy. The problem with multiworld is that the files are locked (at least I think so)...
     
  5. Offline

    Raphfrk

    There is a getLoadedChunks method. You could unload all chunks with save = true and safe = false. This should allow you unload the spawn area.

    Also, after you load a new chunk, you need to refresh the chunk so that player gets sent the new chunk.
     
Thread Status:
Not open for further replies.

Share This Page