Solved [Urgent] Breaking Block Regeneration

Discussion in 'Plugin Development' started by Zer0DZN, Jul 4, 2014.

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

    Zer0DZN

    Well, if i break a block the block will regen in 15 seconds, but I want a specified block, exemple a wood block!
     
  2. Zer0DZN I didnt quite understood, mind give bit more detail? if I understood correctly, you want to break a block, and turn it into wood block, then return it to the block it was before? if so - BlockBreakEvent set your block to wood, and run task to change it in 15 seconds to the other block.
     
  3. Offline

    RingOfStorms

    in block break event
    final BlockState restorePoint = event.getBlock().getState();
    event.getBlock().setType(Material.AIR);
    Then in a delayed task that is set for 15 seconds
    restorePoint.update(true, false); //forces the update with no physics
     
  4. Offline

    teej107

    Zer0DZN Check to see if the material is a wood block then execute your code. I can't help you much since you weren't that descriptive but I'm assuming you got the block regen working.
     
  5. Offline

    Jugglernaught

    Zer0DZN

    You can go about this a few ways. Hopefully you know about Hashmaps and Threads. If not, there should be other posts elsewhere that explain them, so just search them. If not, create a new post. Anyways, you might be able to have a block break event that puts a block data (not just the name, I'd, or meta but the block itself) into the HashMap then have an int value afterwards. You then have a Thread that is always going checking the thread, removing one from all ints, then running an if statement to check for values of zero. Anyways, this thread would run once every second, then if the values are zero, it would get the block location, get the block meta, then get the block, and put the meta on the block and put the block at the location.


    Hope this helps! Don't forget to tag me if you have a response
     
  6. Offline

    fireblast709

    Someone_Like_You likes this.
  7. Offline

    Zer0DZN

    ok thanks I'll see what I
     
  8. Offline

    mythbusterma

    Seems like a lot of effort when you could just schedule a delayed task, also don't recommend doing things that aren't thread safe, and you can't store an instance of a Block, it doesn't work. Use BlockState instead.
     
  9. Offline

    Zer0DZN

    Thanks :)
     
Thread Status:
Not open for further replies.

Share This Page