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

ArrayIndexOutOfBoundsException in InventoryClickEvent.getCurrentItem()

XMLWordPrintable

    • This server is running CraftBukkit version git-Spigot-1d0aef7-b4bff6f (MC: 1.13-pre7) (Implementing API version 1.13-pre7-R0.1-SNAPSHOT)

      When opening an inventory (for example player inventory), taking any item into the hand and clicking in an non-slot part of the ui (not outside and not on a slot) will throw an exception when trying to getCurrentItem() in the InventoryClickEvent:

      @EventHandler
      public void onClick(InventoryClickEvent event) {
          event.getCurrentItem(); //throws exception
      }

      throws

      java.lang.ArrayIndexOutOfBoundsException: -1
              at java.util.ArrayList.elementData(Unknown Source) ~[?:1.8.0_172]
              at java.util.ArrayList.get(Unknown Source) ~[?:1.8.0_172]
              at net.minecraft.server.v1_13_R1.Container.getSlot(Container.java:110) ~[spigot-1.13-pre7.jar:git-Spigot-1d0aef7-b4bff6f]
              at org.bukkit.craftbukkit.v1_13_R1.inventory.CraftInventoryView.getItem(CraftInventoryView.java:65) ~[spigot-1.13-pre7.jar:git-Spigot-1d0aef7-b4bff6f]
              at org.bukkit.event.inventory.InventoryClickEvent.getCurrentItem(InventoryClickEvent.java:113) ~[spigot-1.13-pre7.jar:git-Spigot-1d0aef7-b4bff6f]
      

       

      PPS: Bug reports which do not 1) contain a declaration of independence in Vanilla and without plugins, or 2) in the case of plugin API bugs, contain a minimal reproduction case (source + jar please) will be closed. Bug reports must contain step by step instructions to reproduce the bug from a clean server install with no assumptions or prior knowledge. Also make sure you include the full output of /version in your report. Please copy and paste this statement to the bottom of your report to indicate that you have read and understood it.

      PPPS: Failure to include the above statement will result in a 24 hour ban from the forums.

            __0x277F Hex
            Brokkonaut Brokkonaut
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: