Area Restoration

Discussion in 'Plugin Development' started by mattrick, Feb 2, 2014.

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

    mattrick

    Hi guys, I've been trying to get this to work for a few hours now, I just can't seem to get it to work. I'm trying to restore an area in my minigame arena after the game completes. So basically I need a way to store broken blocks, and when the arena ends, restore that arena's blocks. I've already been searching for a while, and tried out some of the resources, but I still can't seem to get any of them to work. Any ideas?

    Figured it out. No need to help! :)

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

    Jugglernaught

    mattrick
    How did you do it? I also want to learn how to do this, but I haven't done much research. Just curious.
     
  3. Offline

    Wizehh

    Jurn turn off auto-saving for that world, then restart the server.
     
  4. Offline

    Jugglernaught

    Wizehh
    Is there a way to reload a world from a previous save? Say have a template and whenever the game is over, have a plugin delete that world that the game was played on and is now partially destroyed, the copy and rename the template world ready for the next game?
     
  5. Offline

    mattrick

    Jugglernaught
    I'll post my code once I get back to my computer

    Wizehh
    That method is quite hacky, and may not always work. My way is pretty simple and efficient.
     
  6. Offline

    Jugglernaught

    mattrick
    Sweet! Thanks. Looking forward to seeing it [cake]

    mattrick
    So how did you do it?

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

    mattrick

    Jugglernaught
    Sorry, I haven't been able to get on my computer lately, I should be back on it tonight.

    Jugglernaught
    I still haven't been able to get on my computer, but I'll try to help from my memory.
    First you should instantiate an empty List<BlockState>. Then whenever a block is broken add it using block.getState(). Then when your want to restore the blocks, loop through the block list, get the blocks location and set that to the correct block.

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

    xTrollxDudex

  9. Offline

    mattrick

  10. Offline

    xTrollxDudex

    mattrick
    Keep in mind that a BlockState is a snapshot of a block before it is updated, if you that snapshot, it resets the block back to the snapshot the BlockState represents. In simple terms, yes.
     
    mattrick likes this.
  11. Offline

    mattrick

Thread Status:
Not open for further replies.

Share This Page