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

Client still displays bow drawing animation despite PlayerInteractEvent being canceled.

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Invalid
    • Icon: Minor Minor
    • None
    • None
    • Minecraft Client Version: 1.14.4 (100% vanilla, no mods)

      Windows 10 Professional

      Ryzen Threadripper 1920X @ 3.60 GHz

      64GB RAM (32 Allocated to Spigot server)

       

    • This server is running CraftBukkit version git-Spigot-ea7e48b-54f4e7f (MC: 1.14.4) (Implementing API version 1.14.4-R0.1-SNAPSHOT)
    • Tester Plugin (only contains code mentioned in post)
    • Yes

      I am fully aware that the server cannot change client-side behavior. However, the reason I am posting this is because in 1.13 and below, the bow draw animation was canceled on the client if a PlayerInteractEvent was canceled on the server side. In 1.14, the client continues to draw the bow despite the fact that the event has been canceled.

       

      How to reproduce:

      Place this method in a registered listener class and try drawing a bow ingame:

      @EventHandler
          public void onRightClick(final PlayerInteractEvent e) {
              if (e.getAction() != Action.RIGHT_CLICK_AIR && e.getAction() != Action.RIGHT_CLICK_BLOCK) {
                  return;
              }
      if(e.getPlayer().getInventory().getItemInMainHand().getType()==Material.BOW){
              e.setCancelled(true);
      }
      }
      

      Also, the code below does not cancel the animation either:

      @EventHandler
          public void onRightClick(final PlayerInteractEvent e) {
              if (e.getAction() != Action.RIGHT_CLICK_AIR && e.getAction() != Action.RIGHT_CLICK_BLOCK) {
                  return;
              }
      if(e.getPlayer().getInventory().getItemInMainHand().getType()==Material.BOW){
              e.setCancelled(true);
      e.setUseItemInHand(Result.DENY);
      }
      }
      

      The code blocks above resulted in the expected behavior described below ONLY in Spigot 1.13.2 and below. Using Spigot 1.14, the exact same code blocks produced the actual behavior described below.

      Expected Behavior: Player has a bow in their main hand and holds down the 'use' key in order to continuously send block place packets to the server. The resulting PlayerInteractEvent is canceled and the bow draw animation is stopped. The bow drawing animation never plays and the client never has to release the 'use' key in order to continue firing PlayerInteractEvents.

       

      Actual Behavior: Player has a bow in their main hand and holds down the 'use' key in order to continuously send block place packets to the server. The resulting PlayerInteractEvent is canceled, the bow draw animation continues to play, and player must release the 'use' key in order to perform another right click action on the bow again. Each time the 'use' key is held down, only ONE PlayerInteractEvent is ever fired.

       

      See [this thread|https://www.spigotmc.org/threads/possible-bug-cannot-stop-bow-drawing.388876/] on Spigot forums for more info

            Unassigned Unassigned
            Orchface Orch Face
            Votes:
            1 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: