[SPIGOT-6756] In the BlockBreakEvent class, the method isDropItem() always return true Created: 14/Oct/21  Updated: 16/Oct/21  Resolved: 16/Oct/21

Status: Resolved
Project: Spigot
Component/s: None
Affects Version/s: None
Fix Version/s: None

Type: Bug Priority: Minor
Reporter: Ohnrei Assignee: Unassigned
Resolution: Fixed Votes: 0
Labels: bug, event, spigot

Attachments: Text File classes.txt     File testBug.jar    
Version: Spigot-API 1.17.1-R0.1-SNAPSHOT API
Guidelines Read: Yes

 Description   

The method isDropItem() of the class BlockBreakEvent should gets whether or not the block will drop items, but always return true regardless of the resultat (e.g mining diamand_ore with a wooden_axe, aka the wrong tool,  dont drop item at all, but isDropItem() return true).

encs : a  minimal reproduction plugin that show "The block drop a item" when isDropItem() is true and "The block dont drop a item" when isDropItem() is false, and the classes i make it.

 

 



 Comments   
Comment by md_5 [ 16/Oct/21 ]

I have clarified the javadocs

Comment by Ohnrei [ 15/Oct/21 ]

It's look like i misunderstood the  JavaDoc. Thank you.

Comment by md_5 [ 15/Oct/21 ]

Yeah the method is more of a 'should attempt to drop items'.
Perhaps you are after the BlockDropItemEvent?

Comment by Black Hole [ 14/Oct/21 ]

The JavaDoc of isDropItems() might be misleading. It should be "Gets whether or not the block will drop items, if it normally would."
Likewise the JavaDoc for setDropItems() states: "Sets whether or not the block will drop items as it normally would."

You might want to use Block.getDrops(ItemStack) to check if the block would normally drop items for the used tool.

Generated at Fri Apr 11 15:19:22 UTC 2025 using Jira 10.3.3#10030003-sha1:d220e3fefc8dfc6d47f522d3b9a20c1455e12b7b.