Block Drops

Discussion in 'Plugin Development' started by lucaazalim, Apr 15, 2014.

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

    lucaazalim

    Hello, how I can cancel the block drops? The code below does not work. What am I doing wrong?

    Code:java
    1. package me.lucaazalim;
    2.  
    3. import org.bukkit.event.EventHandler;
    4. import org.bukkit.event.Listener;
    5. import org.bukkit.event.block.BlockBreakEvent;
    6. import org.bukkit.plugin.java.JavaPlugin;
    7.  
    8. public class Main extends JavaPlugin implements Listener {
    9.  
    10. public void onEnable() {
    11. getServer().getPluginManager().registerEvents(this, this);
    12. }
    13.  
    14. @EventHandler
    15. public void onBreak(BlockBreakEvent event) {
    16.  
    17. event.getBlock().getDrops().clear();
    18.  
    19. }
    20.  
    21. }
    22.  


    Tks.
     
  2. Offline

    multikus

  3. Offline

    lucaazalim

    This form isn't correct, and poor in performance issues.
     
  4. Offline

    Fhbgsdhkfbl

    lucaazalim
    What you're trying to do is make a block disappear after its broken/destroyed?
     
  5. Offline

    lucaazalim

    Fhbgsdhkfbl I want that when the player breaks a block, it does not drop any loot. And then I want to modify this loot.

    Likes when the player breaks glassBlock.


    Works nice, but I thing that's not a correctly form. (Sorry, I'm from brazil)

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: Jun 7, 2016
Thread Status:
Not open for further replies.

Share This Page