Regenerating world/or area

Discussion in 'Spigot Plugin Development' started by LeOllie, Apr 15, 2017.

  1. Hello,

    I have a plugin that destroys blocks. I was just curious how best to go about regenerating the destroyed blocks on that world or in a region.

    Thank you in advance,

    LeOllie
     
  2. Add these blocks to a list that is outside the method whenever they are destroyed. It should include the block and a time stamp of when it was destroyed. If you want the data as well you'll need to probably create a custom class that saves the data or blockstate as well.

    Create a timer to iterate over the broken blocks and check the timestamp. If it is time to regenerate just simply restore the block and remove it from the list.

    In your on disable method iterate over all blocks and restore them regardless of the timestamp


    Sent from my iPhone using Tapatalk
     
  3. Thank you! I'll give it a try