Solved Quick Question

Discussion in 'Plugin Development' started by ZodiacTheories, Jul 30, 2014.

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

    ZodiacTheories

    Hi, I have looked on the javadocs, couldn't find anything though. I was just wondering, how do you get the blocks from the BlockBreakEvent ? There is only a getExpDrops() or something like that method.

    Thanks - Zodiac
     
  2. Offline

    Traks

    BlockBreakEvent#getBlock(), BlockBreakEvent is a sub class of BlockEvent, which contains that method.
     
  3. Offline

    Skye

    I think BlockBreakEvent should inherit getBlock from BlockEvent.
     
  4. Offline

    Habbolant

    Code:java
    1. event.getBlock();

    That should work :)
     
  5. Offline

    ZodiacTheories

  6. Offline

    Habbolant

    I'm not sure, but maybe
    Code:java
    1. event.getBlock().getDrops();
    is what you need.
     
  7. Offline

    ZodiacTheories

    Habbolant

    Nothing happens when I e.getBlocks().getDrops().clear(); (e is my event variable)
     
  8. Offline

    Skye

    ZodiacTheories I don't think there's a method to get the drops because it can figured out from the block that is being broken. You could always cancel the event, remove the block, and use World's dropItemNaturally to make it look like something else dropped from the block.
     
  9. Offline

    ZodiacTheories

    Skye

    I am making a plugin which makes it so that when a block is broken, they don't get any drops, but they run a command
     
  10. Offline

    Habbolant

    Does this work for you?
    Code:java
    1. event.setCancelled(true);
    2. event.getBlock().setType(Material.AIR);
    3. event.getPlayer().chat("/commandyouwanttouse");
     
  11. Offline

    ZodiacTheories

    Habbolant

    Nooo spoon feeding :p I only had the problem with the drops, thanks for the solution though :)
     
    Habbolant likes this.
Thread Status:
Not open for further replies.

Share This Page