Solved BlockBreakEvent

Discussion in 'Plugin Development' started by ewrs, Aug 21, 2018.

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

    ewrs

    Hello. I have a problem. When the block is destroyed, the drop is not deleted. Why???

    @EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
    public void onBlockBreak(BlockBreakEvent event){
    if(event.getBlock().getType().equals(Material.DIAMOND_ORE)) {
    event.getPlayer().sendMessage("Test");
    event.getBlock().getDrops().clear(); #Not Worked
    }
    }


    Sorry for my english, he's not the best.
     
  2. Offline

    Zombie_Striker

    @ewrs
    You should use "event.setDroppedItems(false)" to stop the block from dropping items.
     
  3. Offline

    ewrs

    Thank you very much. (Always help me :) )
     
Thread Status:
Not open for further replies.

Share This Page