[SPIGOT-5259] Client still displays bow drawing animation despite PlayerInteractEvent being canceled. Created: 09/Aug/19  Updated: 07/Sep/19  Resolved: 07/Sep/19

Status: Resolved
Project: Spigot
Component/s: None
Affects Version/s: None
Fix Version/s: None

Type: Bug Priority: Minor
Reporter: Orch Face Assignee: Unassigned
Resolution: Invalid Votes: 1
Labels: PlayerInteractEvent, bow
Environment:

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)

 


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

 Description   

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



 Comments   
Comment by md_5 [ 07/Sep/19 ]

Client change.
The bow draw is still cancelled visually for other players on the server.

Comment by md_5 [ 10/Aug/19 ]

>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.

 

There's a good change the client changed in that respect , not the server....

Generated at Fri Mar 14 15:13:12 UTC 2025 using Jira 10.3.3#10030003-sha1:d220e3fefc8dfc6d47f522d3b9a20c1455e12b7b.