[SPIGOT-6229] Clarify PlayerItemBreakEvent Created: 08/Nov/20 Updated: 09/Nov/20 Resolved: 09/Nov/20 |
|
| Status: | Resolved |
| Project: | Spigot |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | None |
| Type: | Bug | Priority: | Minor |
| Reporter: | HexedHero | Assignee: | Unassigned |
| Resolution: | Fixed | Votes: | 0 |
| Labels: | None | ||
| Version: | N/A |
| Guidelines Read: | Yes |
| Description |
|
On the Javadocs this event says "The item that's breaking will exist in the inventory with a stack size of 0. After the event, the item's durability will be reset to 0." but this isn't exactly accurate and I suggest it should say something like "After this event, the item's amount will be set to (item amount)-1 and its durability will be reset to 0"
The current text sounds like in the event the amount of the items is 0 and you should be able to set its amount to 1 to cancel this event but this is not the case and you need to do event.getBrokenItem().setAmount(2); since after the event it takes 1 away from the amount. |