-
Bug
-
Resolution: Duplicate
-
Minor
-
None
-
None
-
Windows 7 Professional
For 1.16.4 testing: OpenJDK 64-Bit Server VM AdoptOpenJDK (build 15+36, mixed mode, sharing)
For 1.15.2 testing: OpenJDK 64-Bit Server VM AdoptOpenJDK (build 14+36, mixed mode, sharing)
-
This server is running CraftBukkit version git-Spigot-628435a-6917945 (MC: 1.16.4) (Implementing API version 1.16.4-R0.1-SNAPSHOT)
-
Yes
When opening an inventory, a player can swap an item within that inventory with the item in their off-hand by pressing the corresponding keybind (by default 'F'). Doing this fires an InventoryClickEvent. When cancelling this corresponding InventoryClickEvent, however, the item that was attempted to be swapped is correctly returned to the original spot in the inventory, but a 'ghost item' stays in the player's off-hand. This item doesn't have any functionality and the moment the player tries to interact with it, it disappears, yet is visible until such an interaction is made.
It seems to me like this ghost item is undesired behavior and should not be present, hence why I think this is a bug.
Attached below is a reproduction plugin that shows this behavior. The code that was used for this reproduction plugin can be viewed here: https://pastie.io/vydxbs.java.
Reproduction steps:
- Stop the server if it's currently enabled by executing the stop command (either from the console or as a player with operator level 4 or higher).
- Put the reproduction plugin that is attached below on the server by placing the file in the dedicated plugins folder.
- Start the server.
- Open the example inventory by executing the /gui command as a player.
- Hover with your cursor over the stone in the top left corner of the opened inventory.
- Press 'F' (or the corresponding key for swapping items).
- The actual stone now stays in the top left corner of the inventory, but a ghost item is now also visible in the off-hand.
This bug affects Spigot 1.16.4 (git-Spigot-628435a-6917945 (MC: 1.16.4) (Implementing API version 1.16.4-R0.1-SNAPSHOT)); and CraftBukkit 1.16.4 (git-Bukkit-6917945 (MC: 1.16.4) (Implementing API version 1.16.4-R0.1-SNAPSHOT)). This bug does not affect Spigot 1.15.2 (git-Spigot-a99063f-be6aaf0 (MC: 1.15.2) (Implementing API version 1.15.2-R0.1-SNAPSHOT)); and CraftBukkit 1.15.2 (git-Bukkit-be6aaf0 (MC: 1.15.2) (Implementing API version 1.15.2-R0.1-SNAPSHOT)).
- duplicates
-
SPIGOT-6145 InventoryClickEvent does not get correctly cancelled when action is HOTBAR_SWAP
- Resolved