Bukkit/CraftBukkit — pull request #973 by psycowithespn (2012-12-27 22:15:54+00:00)
Title: Update to new BlockItemSwitch packet standards, Fixes BUKKIT-3318

This pull adds in player.getInventory().setHeldItemSlot(int) which allows plugins to change the active item slot. The int needs to be validated otherwise the player can not interact using an item in their hand (ex. Flint and Steel) and no PlayerItemHeldEvents are sent. player.updateInventory() is updated to support changing the slot number.

It also allows PlayerItemHeldEvent to implement Cancellable, sending a BlockItemSwitch packet to the client of the old index.

Corresponding bukkit pull: https://github.com/Bukkit/Bukkit/pull/747