mirror of
https://github.com/PaperMC/Paper.git
synced 2024-11-23 19:15:32 +01:00
Correct cancellation of InventoryClickEvent. Fixes BUKKIT-4331
Cancelling an InventoryClickEvent for a single click causes the click not to be processed by the clicked inventory. The server then doesn't correctly identify their second click as being a double click, causing an inconsistency between what the Player believes the inventory to be and what the server believes the inventory to be. This change forces an updateInventory call whenever an InventoryClickEvent whose action is NOTHING is cancelled. Both clicks are considered PICKUP_ALL, so updating the inventory after the second click fixes any inconsistencies that could arise between the client and the server.
This commit is contained in:
parent
93c0d7e6b5
commit
930a9e805c
@ -1287,7 +1287,7 @@ public class PlayerConnection extends Connection {
|
||||
action = InventoryAction.CLONE_STACK;
|
||||
} else {
|
||||
action = InventoryAction.NOTHING;
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
click = ClickType.UNKNOWN;
|
||||
@ -1376,6 +1376,7 @@ public class PlayerConnection extends Connection {
|
||||
}*/
|
||||
switch (action) {
|
||||
// Modified other slots
|
||||
case PICKUP_ALL:
|
||||
case MOVE_TO_OTHER_INVENTORY:
|
||||
case HOTBAR_MOVE_AND_READD:
|
||||
case HOTBAR_SWAP:
|
||||
@ -1384,7 +1385,6 @@ public class PlayerConnection extends Connection {
|
||||
this.player.updateInventory(this.player.activeContainer);
|
||||
break;
|
||||
// Modified cursor and clicked
|
||||
case PICKUP_ALL:
|
||||
case PICKUP_SOME:
|
||||
case PICKUP_HALF:
|
||||
case PICKUP_ONE:
|
||||
|
Loading…
Reference in New Issue
Block a user