[Solved] PlayerInteractEvent drop bug question

Discussion in 'Spigot Discussion' started by Weber588, Jan 15, 2020.

Thread Status:
Not open for further replies.
  1. Edit: The reason it differs is that when right clicking on a block (chest, sign etc), a raycast is done, and it is assumed that if no block is hit the action was a punch action, and doesn't filter out the right click actions based on those packets (as there is no guarantee of packet order). Just in time event sending would use delays which would cause all the left click player interact events to fire at the end of the tick, which would cause lag. It seems there currently isn't a way to consistently do this within one tick, but the two tick solution still works and we can only hope Mojang makes a convenient change.

    Hi, please let me know if this in inappropriate or is in the wrong forum section.

    The background: In 1.15, Mojang added several instances of the player swinging their arm with various actions. One of them is dropping items. This isn't an issue in and of itself, but it does pose an issue to how Spigot handles the LEFT_CLICK_AIR type of PlayerInteractEvent.

    So from what I can gather from this bug report, LEFT_CLICK_AIR is done by analyzing the animation packet (since no other packet is sent), and determines if it was done in response to punching the air or opening a chest or something. In the past, it did that successfully: opening a chest doesn't fire this event, because something was done under the hood to prevent it from firing erroneously. Great! However, with this update, this wasn't done - dropping wasn't taken into account, and this is what I'm posting about.

    There's a possible fix found here (which developers can use in the mean time) but it would be far better implemented in inside the event factory - Would it not make sense to have this hard coded into spigot itself, since LEFT_CLICK_AIR is no longer a valid description of that event? This is already done with the animation for a player opening a chest, or right clicking a sign, so why not for dropping too?

    In that bug report, md_5 said outright there's nothing that can be done about it. If that's true, then consider this post a request for someone to help me understand why it can be done with the animation packet for right clicking but not the animation packet for dropping (which, I assume, are identical?)

    Please forgive me if I'm missing something or lack an underlying understanding of the differences between the animation for each event - but seeing the response to the issue blew my mind. I truly don't know why the two would be different, and why the proposed solution here wouldn't work in spigot itself (just without the tick needed since we don't control the event factory).

    It would be immensely useful for either DROP to become a type of PlayerInteractEvent.Action, or for that event to just not fire at all for drops. But I would love to discuss either why it's not possible in the same way as right click animations, or why it shouldn't be done and is useful to have it fire without a way to tell the difference between left click air and drop.

    Thanks in advance!
    #1 Weber588, Jan 15, 2020
    Last edited: Jan 15, 2020
Thread Status:
Not open for further replies.