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

PlayerInteractAtEntityEvent issues

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Duplicate
    • Icon: Minor Minor
    • None
    • None
    • This server is running CraftBukkit version git-Spigot-56f8471-7554e08 (MC: 1.14.4) (Implementing API version 1.14.4-R0.1-SNAPSHOT)
    • Yes

      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.

       

            Unassigned Unassigned
            xthegamercodes@gmail.com Noah Stone
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: