From 5c8498c8b73bd9bedb6aa530acb5b315ca318008 Mon Sep 17 00:00:00 2001 From: Nate Mortensen Date: Thu, 13 Jun 2013 16:03:39 -0600 Subject: [PATCH] Fix cancellation for InventoryDragEvent. Fixes BUKKIT-4332 Cancelling InventoryDragEvent causes the placed items to be lost. This is because the cursor is set to the result prior to the event taking place, so the items are removed from the cursor. When the event is cancelled, the items removed from the cursor aren't placed in the inventory, and are just lost. This change sets the cursor back to the original cursor when the event is cancelled. --- src/main/java/net/minecraft/server/Container.java | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/main/java/net/minecraft/server/Container.java b/src/main/java/net/minecraft/server/Container.java index d48282cf27..bb4c41aa9d 100644 --- a/src/main/java/net/minecraft/server/Container.java +++ b/src/main/java/net/minecraft/server/Container.java @@ -197,6 +197,8 @@ public abstract class Container { needsUpdate = true; } + } else { + playerinventory.setCarried(oldCursor); } if (needsUpdate && entityhuman instanceof EntityPlayer) {