Bukkit/CraftBukkit — pull request #984 by jrtc27 (2013-01-07 15:49:32+00:00)
Title: Fix cancelling PlayerDropItemEvent - Fixes BUKKIT-3313

Before, any item stack dropped from the hotbar with the drop key (optionally with Ctrl to drop the whole stack) would be removed from the player's inventory, and if the subsequent PlayerDropItemEvent was cancelled, the item stack would be re-added with PlayerInventory.addItem(ItemStack). However, this means that the stack can end up in a different slot. Instead, the slot contents and index from which the stack originates is saved, and if the event is cancelled, the slot contents are restored to what they were before the event if the slot contents are as they were before firing the event; if not, the item stack is added back to the player's inventory as before.