[SPIGOT-5904] PlayerDropItemEvent fires PlayerInteractEvent Action LEFT_CLICK_AIR Created: 30/Jun/20 Updated: 30/Jun/20 Resolved: 30/Jun/20 |
|
Status: | Resolved |
Project: | Spigot |
Component/s: | None |
Affects Version/s: | None |
Fix Version/s: | None |
Type: | Bug | Priority: | Minor |
Reporter: | Silas Rinehart | Assignee: | Unassigned |
Resolution: | Duplicate | Votes: | 0 |
Labels: | 1.15.2, LEFT_CLICK_AIR, PlayerDropItemEvent, PlayerInteractEvent, spigot | ||
Environment: |
Minecraft 1.15.2, Spigot 1.15.2 |
Attachments: |
![]() |
||||||||
Issue Links: |
|
||||||||
Version: | CraftBukkit version git-Spigot-99063f-be6aaf0 (MC: 1.15.2) (Implementing API version 1.15.2-R0.1-SNAPSHOT) | ||||||||
Guidelines Read: | Yes |
Description |
Hello, I have created a plugin (attached) that reproduces what I believe to be a bug. Whenever I call the PlayerDropItemEvent, it seems to sometimes call the PlayerInteractEvent LEFT_CLICK_AIR action. In Minecraft, if I am looking in the air (not at a block that is close enough to break) and I drop an item, the PlayerInteractEvent is fired in addition to the PlayerDropItemEvent. In the reproduction plugin of the bug, I have the following code in the main class: public void onEnable() { PluginManager pm = getServer().getPluginManager(); pm.registerEvents(this, this); } @EventHandler public void gunUseEvent(PlayerInteractEvent event) { Action action = event.getAction(); Player player = event.getPlayer(); player.sendMessage("Action: " + action); } @EventHandler public void onItemDrop(PlayerDropItemEvent event) { Player player = event.getPlayer(); player.sendMessage("dropped"); } gunUseEvent is what one of the methods is called in my actual plugin. Whenever I am looking at air in Minecraft and drop an item, my chat output is: dropped And when I look at the ground, my chat output is: dropped In addition, in my actual plugin, if I am right clicking with a my gun item (which shoots it), every once and a while the LEFT_CLICK_AIR action will be thrown (causing the gun to be in scope mode) - without even left clicking. I'm guessing these bugs (if they are bugs) are somehow linked. Hopefully that is enough detail to get this figured out and hopefully I am not just misunderstanding how these events work. Thanks for taking a look at this and God bless! |
Comments |
Comment by Silas Rinehart [ 30/Jun/20 ] |
Ah I see. Thanks for the link! |