Bukkit/CraftBukkit — pull request #874 by xGhOsTkiLLeRx (2012-08-26 17:53:44+00:00)
Title: Added a PlayerConsumeItemEvent and a method to update the health and foodbar

Corresponding Bukkit PR:

Please be kind, this is my first (real) pull request.
This event is called when the eating/drinking of an item is over and the effects would apply.

If the player consumes food, you are able to change the nutrition value.
Cancelling is possible, too!

The event is called before FoodLevelChangeEvent

If anything is missing, please tell me! :)

Hope to see this pulled

Side note:
The updateFoodAndHealth methods sends a new packet to the player, because the client would change the foodbar, even if the event is cancelled.
(Same effect appears if you cancel FoodLevelChange!)
I marked it as deprecated since this isn't the nicest way to handle it.

All changes were tested and worked correctly :)