Rollback blocks between two points

Discussion in 'Plugin Development' started by AbstractionPvP, Jan 19, 2015.

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

    AbstractionPvP

    Hello,

    I was wondering how I would go about storing two sets of coordinates, and resetting the exact blocks as they were before. Any help is appreciated. Thanks!
     
  2. Offline

    Zandor300

    On BlockBreakEvent or/and BlockPlaceEvent check if the block is inside the region. If so, save the BlockState to an ArrayList. Then when you want to reset, just do "yourBlockState.getBlock().setType(youtBlockState.getType());" and "youBlockState.getBlock().setData(yourBlockState.getData().getData());" and that will reset the region with all the last blockupdates. (Be sure to clear the arraylist after you have resetted the region.

    I hope this helped.

    EDIT:
    You get your BlockState by doing "yourBlock.getState();".
     
Thread Status:
Not open for further replies.

Share This Page