Bukkit/CraftBukkit — pull request #1279 by modwizcode (2013-12-05 16:51:47+00:00)
Title: [C] Provide an event for item frames that get damaged while holding an item. Fixes BUKKIT-5020

The Issue:

The way 1.7 handles item frame damage is that an item is dropped and the frame is not broken if the frame has a non-null item reference. The event for a hanging entity getting broken is only fired when no item is contained in the frame or the frame breaks for another reason. Without an event being fired when the item is dropped and the frame is not broken, plugins have no way to protect or react to players removing the item from an item frame.

Justification for PR:

With this PR, an EntityDamageEvent of some sort will be fired depending on the cause of the damage. This allows plugins to react to the damage by simply handling a normal damage event, possibly using existing code to handle other entity damage.

PR Breakdown:

This PR causes the damage event to be fired when an item frame containing an item gets damaged. The event can then be cancelled or reacted to in other ways by plugins.

Testing results and materials:
Any plugin handling entity damage events will now respond to item frames dropping items.

JIRA Ticket:
BUKKIT-5020 - https://bukkit.atlassian.net/browse/BUKKIT-5020