[SPIGOT-5721] Cancelling the PlayerDropItemEvent Causes Item Duplication from /give Created: 05/May/20 Updated: 06/May/20 Resolved: 06/May/20 |
|
| Status: | Resolved |
| Project: | Spigot |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | None |
| Type: | Bug | Priority: | Minor |
| Reporter: | Nathan Wolf | Assignee: | Unassigned |
| Resolution: | Duplicate | Votes: | 0 |
| Labels: | None | ||
| Environment: |
Mac OS, Linux |
||
| Issue Links: |
|
||||||||
| Version: | git-Spigot-2040c4c-94cb030 (MC: 1.15.2) (Implementing API version 1.15.2-R0.1-SNAPSHOT) | ||||||||
| Guidelines Read: | Yes | ||||||||
| Description |
|
For what I assume are obscure Mojang reasons, the vanilla /give command is implemented by forcing the player to drop an item that they then immediately pick up (I think?) Unfortunately this causes some bad interaction with plugins that cancel drop events, as cancelling the drop event will cause the item to be given to the player, as well as the player getting the item (somehow?) anyway. Steps to reproduce:
I tried to trace through this code myself but I got a little lost and can't figure out how the player is actually getting the item even if the drop event is cancelled. I was hoping to find a simple fix for this, but other than re-working the vanilla give command (which I assume is not an option, and definitely not a desirable option) I couldn't really see where to fix the problem. In my opinion, the bigger issue here is that the /give command is going to fire a drop event in a way a plugin probably doesn't expect, since the player is effectively dropping an item that they never had in their inventory in the first place. Maybe the event could be skipped somehow in this one case? Thanks for your time. |