-
Bug
-
Resolution: Invalid
-
Minor
-
None
-
None
-
Windows
openjdk
-
1.16.1-R0.1-latest
-
Yes
If someone hold a item, then click quickly in solts. InventoryClickEvent.getCursor() will return a wrong result.
Test Code
@EventHandler public void onInventoryClick(InventoryClickEvent e) { Inventory inventory = e.getInventory(); if (e.getRawSlot() < inventory.getSize()) { System.out.println(e.getCursor()); if (e.getCursor() != null && e.getCursor().getType() == Material.DIRT) { e.setCancelled(true); } } }
Console:
[23:34:03 INFO]: ItemStack{DIRT x 1} [23:34:03 INFO]: ItemStack{DIRT x 1} [23:34:03 INFO]: ItemStack{DIRT x 1} [23:34:04 INFO]: ItemStack{DIRT x 1} [23:34:04 INFO]: ItemStack{DIRT x 1} [23:34:04 INFO]: ItemStack{DIRT x 1} [23:34:04 INFO]: ItemStack{AIR x 0}
Then the item was placed successfully in the solt