[SPIGOT-5387] PlayerInteractAtEntityEvent issues Created: 27/Oct/19  Updated: 28/Oct/19  Resolved: 28/Oct/19

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

Type: Bug Priority: Minor
Reporter: Noah Stone Assignee: Unassigned
Resolution: Duplicate Votes: 0
Labels: 1.14, bug, spigot

Issue Links:
Duplicate
duplicates SPIGOT-3609 Cancelling PlayerInteractAtEntityEven... Resolved
Version: This server is running CraftBukkit version git-Spigot-56f8471-7554e08 (MC: 1.14.4) (Implementing API version 1.14.4-R0.1-SNAPSHOT)
Guidelines Read: Yes

 Description   

When using PlayerInteractAtEntityEvent, it does not cancel the interaction with regards to opening the Wandering Trader and regular Villager gui. Even when cancelled, the gui will still open.

Further, the event will fire twice when clicking on Villagers while not doing so for wandering traders.

Here is the code I used to detect the bug:

@EventHandler public void onVillagerClick(PlayerInteractAtEntityEvent event) { 
    event.setCancelled(true); 
    Bukkit.broadcastMessage("isCanceled: " +   event.isCancelled()); 
}

The Bukkit#broadcastMessage successfully broadcasts that the event is cancelled, but the opening of the gui stays.

This is a fresh build of the BuildTools.

For those looking for a solution, I added a BukkitRunnable#runTaskLater to close the gui one tick later which closes the villager gui almost immediately.

 



 Comments   
Comment by md_5 [ 28/Oct/19 ]

See duplicate ticket and Javadoc.

 

https://hub.spigotmc.org/stash/projects/SPIGOT/repos/bukkit/commits/cef79e55153e438d9ef4b87f4de45cd59233f01e

Comment by Black Hole [ 27/Oct/19 ]

If it's called twice then the client sent 2 packets, one for each hand.

Please try to handle the PlayerInteractEntityEvent, too.

Generated at Sat Dec 13 13:39:17 UTC 2025 using Jira 10.3.13#10030013-sha1:56dd970ae30ebfeda3a697d25be1f6388b68a422.