Auto world restoration after set amount of time

Discussion in 'Plugin Development' started by willies952002, May 15, 2012.

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

    willies952002

    IN THIS POST: GRIEF = PRANK :D

    I'm in the process of developing a plugin that would allow players to us a command such as "/lg grief" to legally grief (prank) another player's house. To do this, I thought a way that if the griefed player used the command "/lg undo" in the area that is damaged by the grief to reset it or have it reset automaticaly after a certain amount of time. The major problem I have is finding the way to make the timing routine and having the world or maybe the chunk in the area that was grief to be saved in a file then be reloaded when the command is given.

    Thanks,
    -William Surgeon
     
  2. Offline

    Nitnelave

    for the timing routine, you should use bukkit's scheduler. You can record each block separately, with the time it was broken, and then check every second or 10 sec if it should be reset (if a given amount of time has passed). As for the blocks, I would advise that either you keep them in memory (blockstates) and you force replace them when you deactivate your plugin, or for each block, you find the relevant info, and store it accordingly (but it may be very complicated, with lots of exceptions). If you need to, you can look at my plugin's source, because this is basically what I do, but for Creepers (and all kinds of explosions)
     
  3. Offline

    willies952002

    thanks very much, this should help a lot XD
    -William Surgeon
     
  4. Offline

    Double0negative

    You never want to store important info like block data to memory. If anything happens to the server (crash, dosent shut down properly, etc) all the blocks will be lost forever. imo a SQL database would be best suited for this,
     
Thread Status:
Not open for further replies.

Share This Page