Uploaded image for project: 'Spigot'
  1. Spigot
  2. SPIGOT-5632

Dropping an item while targetting air causes a PlayerInteractEvent

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Duplicate
    • Icon: Major Major
    • None
    • None
    • Ubuntu 18.04
      Java 13

    • version git-Spigot-a03b1fd-fc318cc (MC: 1.15.2)
    • Yes

      Dropping an item while not targeting a block causes spigot to publish a PlayerInteractEvent to the event handlers.

      This bug, at least in my opinion, is rather game breaking for most plugins which now execute logic when the player drops as well as at the intended point when the player actually left clicks the air.

      Steps to reproduce:

      • Get the latest version of spigot
      • Register a listener for the PlayerInteractEvent in a plugin
      • InGame; Drop an itemstack from your inventory hotbar using the hotkey 'q' (if configured so) while NOT looking at a block.
      • Your plugin's listener now received a PlayerInteractEvent with the Action LEFT_CLICK_AIR.

      Notes:
      As I currently do not have the time to actually fix this myself I did some digging anyway.
      My current guess on the culprit (I repeat, guess) would be:

      1.15.2 plays a player arm swing animation whenever the player drops an item.
      This causes PlayerConnection#a(PacketPlayInArmAnimation) to be executed, which is used to even catch any LEFT_CLICK_AIR interactions.
      This method currently does not know if the animation was played because the player left clicked or dropped an item and therefore calls both.

            Unassigned Unassigned
            LynxPlay Bjarne Koll
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: