From 930a9e805c453ff4ab924177e58fa4a5a8d70552 Mon Sep 17 00:00:00 2001 From: Nate Mortensen Date: Thu, 13 Jun 2013 17:49:21 -0600 Subject: [PATCH] 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. --- src/main/java/net/minecraft/server/PlayerConnection.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/java/net/minecraft/server/PlayerConnection.java b/src/main/java/net/minecraft/server/PlayerConnection.java index f1c2d48292..018c314f33 100644 --- a/src/main/java/net/minecraft/server/PlayerConnection.java +++ b/src/main/java/net/minecraft/server/PlayerConnection.java @@ -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: