block destroyed

Discussion in 'Plugin Development' started by 1337, Jan 22, 2011.

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

    1337

    how to tell if a block has been compleaty destroyed not just damaged?
     
  2. Offline

    eisental

    You can use event.getDamageLevel() in your BlockListener like this:

    Code:
                public void onBlockDamage(BlockDamageEvent event) {
                    if (event.getDamageLevel()==BlockDamageLevel.BROKEN)
                        // it's broken, do something.
                }
    
     
  3. Offline

    1337

    thank you :)
    --- merged: Jan 22, 2011 11:24 PM ---
    also how do i get the block that was destoryed , i mean what it was like coal or diamond?
     
  4. Offline

    Archelaus

    Code:
    public void onBlockDamage(BlockDamageEvent event) {
                    if (event.getDamageLevel()==BlockDamageLevel.BROKEN
                         && event.getBlock().getType == Material.COAL_ORE)
                        // it's broken, do something.
                }
     
  5. Offline

    1337

    thank you and well done on getting plugin dev status rightledred :)
     
  6. Offline

    Archelaus

    Thanks. I think I misunderstood you, to get the block you do event.getBlock.getType()
     
  7. Offline

    1337

    thats what you told me to do isnt it?
     
  8. Offline

    Archelaus

    What I did was check if it was coal, I thought you wanted get the block name itself.
     
  9. Offline

    1337

    no i wanted to check what it was thanks it worked
     
Thread Status:
Not open for further replies.

Share This Page