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

InventoryClickEvent does not get correctly cancelled when action is HOTBAR_SWAP

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Invalid
    • Icon: Minor Minor
    • None
    • None
    • None
      • No other plugins and code except described below.
    • CraftBukkit version git-Spigot-17d78db-f8d4da0 (MC: 1.16.3) (Implementing API version 1.16.3-R0.1-SNAPSHOT)
    • Yes

      How to replicate

      • Create a custom inventory with the following code

       

      Inventory inventory = Bukkit.getServer().createInventory(player, 54, "DemoGui");
      inventory.setItem(0, new ItemStack(Material.APPLE));
      player.openInventory(inventory);
      

      • Cancel every type of InventoryClickEvent 

       

       

      @EventHandler
      public void inventoryClickEvent(InventoryClickEvent event) {
          event.setCancelled(true);
          System.out.println(event.getAction().toString() + " cancelled.");
      }
      
      • Observe that clicking on the apple with your mouse is correctly cancelled and the item does not move.

       

      • Move your mouse of the item and press "F"
      • Observe that the inventory item is copied to the offhand slot

      Expected behaviour:

      The item does not get copied to the offhand slot if the InventoryClickEvent is cancelled.

       

       

        1. gui-3.PNG
          gui-3.PNG
          33 kB
        2. gui-2.PNG
          gui-2.PNG
          32 kB
        3. gui-1.PNG
          gui-1.PNG
          4 kB

            Unassigned Unassigned
            Shynixn Shynixn
            Votes:
            1 Vote for this issue
            Watchers:
            5 Start watching this issue

              Created:
              Updated:
              Resolved: