Solved Problems with setDropItems

Discussion in 'Plugin Development' started by phoenix75576486, Jun 7, 2025 at 1:09 PM.

  1. Offline

    phoenix75576486

    im new to making plugins and i cant seem to get this code to work


    @EventHandler(priority = EventPriority.HIGH)
    public void OnBreak(BlockBreakEvent event){
    SendInfo("player broke a block");
    String name = event.getPlayer().getName();
    SendInfo("player:"+name+"with type:"+users.get(name).get("type")+"broke a block");

    if(event.getBlock().getType()==Material.ANCIENT_DEBRIS && users.get(name).get("type")!=1 && event.getPlayer().getInventory().getItemInMainHand().getType().equals(Material.IRON_PICKAXE)){
    SendInfo("player:"+name+" was found with type:"+users.get(name).get("type")+"breaking ancient debris");
    event.setDropItems(true);
    }
    }

    the event seem to get registered fine and in the server log it does say that a player with the necessary conditions has destroyed the ancient debris but it still doesnt drop the item
     
  2. Offline

    timtower Administrator Administrator Moderator

    Event runs, but the normal flow does not set any drops probably. So there is nothing to drop
     
  3. Offline

    phoenix75576486

    Thanks, that was actually the reason! I set it to drop the item manually now and it works just fine thank you very much.
     

Share This Page