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

InventoryClickEvent has wrong getCurrentItem() for numerical switch between hot-bar and offhand slot

XMLWordPrintable

      The problem:

      When using InventoryClickEvent to monitor a numerical switch between the hot-bar and offhand slot (survival mode) the getCurrentItem() method gives always back ItemStack{AIR x 0} instead of the ItemStack that should be switched.

       

      What is the problem (explained): 

      When you switch an item *from the hot-bar to the offhand slo*t (survival inventory), the InventoryAction is HOTBAR_SWAP, no problem here, but the getCurrentItem() method returns ItemStack{AIR x 0} instead of the used ItemStack for the move.

       

      Example (for the problem):

      You have a Material.SLIME_BALL (as ItemStack ofc) in slot 8 (9 on your keyboard) and if you hover over the offhand slot (in the inventory) and press '9' (on your keyboard) the slime ball will switch from being in the ninth slot to the offhand slot. BUT getCurrentItem() does not show the SLIME_BALL.

      What should happen like any other InventoryAction is that getCurrentItem() for the transaction (in this case SWAP_HOTBAR) is indeed the used ItemStack.

            Unassigned Unassigned
            tomudding Tom Udding
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: