Bukkit/CraftBukkit — pull request #712 by taufiqkh (2012-03-08 11:40:02+00:00)
Title: Check top inventory type when determining inventory event type

Currently, net.minecraft.server.NetServerHandler.a(Packet102WindowClick packet102windowclick) checks that inventory instanceof CraftingInventory to determine whether or not a window click occurred while a crafting window was open. However, inventory is an instance of the abstract class InventoryView, its only subclass being CraftInventoryView and neither of these implement the CraftingInventory interface.

This pull request changes this to check whether inventory.getTopInventory() is an instance of CraftingInventory. This is done under the assumption that the top inventory is the only one that may be a crafting inventory. Should this behaviour change in future versions, or through plugin modifications, both top and bottom inventories may need to be checked.

Testing was performed manually - as the change was made in a class with a number of interdependencies, no automated tests were added.