Solved Need help with block break event

Discussion in 'Plugin Development' started by _feedDz, May 27, 2014.

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

    _feedDz

    i want to set the drops to something else when a block breaks but its not working.
    my code is long so here is the pastebin. i did this all in one class as you can tell :)
    thanks in advance for the help
    http://pastebin.com/TYGeHtSn
     
  2. Offline

    Seadragon91

    event.getBlock() -> event.getBlock().getType()
     
  3. Code:
    //Check if the event isnt canceled
    if (event.isCancelled()) {
     
    //drop custom items (and change the if(....){ thing to yours)
    if(event.getPlayer().getItemInHand()==Material.DIAMOND_PICKAXE){
     
    event.getPlayer().getWorld().dropItem(event.getPlayer().getLocation(), new ItemStack(Material.IRON_INGOT));
    }
    //Cancel the block break
    event.setCancelled(true);
     
    //Set the Block to air
    event.getBlock().setType(Material.AIR);
    }
     
  4. Offline

    _feedDz

    still not solved and i debuged it. the results were that it is not calling any of the if statements like if(event.getBlock().getType() == Material.IRON_ORE)){
    }
    its just not reading anything inside that
     
Thread Status:
Not open for further replies.

Share This Page