[SPIGOT-2960] InventoryClickEvent - Action should be HOTBAR_SWAP Created: 26/Dec/16  Updated: 27/Dec/16  Resolved: 27/Dec/16

Status: Resolved
Project: Spigot
Component/s: None
Affects Version/s: None
Fix Version/s: None

Type: Bug Priority: Minor
Reporter: Benjamin Heusser Assignee: Unassigned
Resolution: Fixed Votes: 0
Labels: Craftbukkit
Environment:

Windows 8.1


Attachments: PNG File 294beb6d2f07e300e364098124c0f390.png    

 Description   

Situation & Action:
The player has opened a double chest and his own inventory is full (there is no empty space left). He then moves his cursor over an item in the chest part of the inventory and presses a hotkey (1-9) on his keyboard. The two items will switch and the player connection fires the InventoryClickEvent.

Problem:
In this special case, we land on this line and the InventoryAction is set to NOTHING.

This poses a problem with our protection plugin, we evaluate whether the player is giving or taking from/to and inventory according to the InventoryAction and check if he is allowed to perform this action. Swaps are usually both: giving and taking.
In a case where the chest part is protected, one should not be allowed to swap these two items if they don't own the chest.

Suggested Solution:
In my opinion, this is definitely not "nothing", but rather an actual "hotbar swap". The behaviour of this situation is exactly what the javadocs of "HOTBAR_SWAP" sais:
"The clicked slot and the picked hotbar slot are swapped."


Generated at Tue Apr 22 07:03:28 UTC 2025 using Jira 10.3.5#10030005-sha1:190c783f2bd6c69cd5accdb70f97e48812a78d14.