Bukkit API, How to Edit time to Break a block

Discussion in 'Plugin Development' started by Cody Boker, Apr 25, 2011.

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

    Cody Boker

    I'm trying to restrict access to breaking blocks for some users by using time.
    It looks good on paper but after looking through the API it says nothing about
    durability of the block or time necessary for a block to break.
    What I don't seem to understand is I know that there is a difference between a pickaxe against
    stone and a shovel against stone as well as a gold vs wooden pickaxes against stone.
    I know there is a difference. But how would you change that? Figured it was onBlockDamage but that just spam the crap out of my server with "You damaged <block.getName()>"
    I debug like that. What of it?
    Anyway need to change the amount of time it takes to break a block and what term I should be using. Thank you.


    BTW, I have read through the forums but hard to figure out the word for the event... block break... w/e
     
  2. Offline

    matter123

    well you could cancel half of the block damage events
     
  3. Yeah just put something like this in the on block break function:

    Code:
    if(breakReduce >= 3){
        event.setCancelled(true);
        breakReduce = 0;
    } else {
        breakReduce++;
    }
    
    Then just declare breakReduce somewhere in your class:
    Code:
    public static int breakReduce;
     
Thread Status:
Not open for further replies.

Share This Page