MassiveCraft/Factions — pull request #178 by Tahkeh (2012-11-03 11:58:50+00:00)
Title: Protecting Beacon and Anvil use by default and protecting Hanging entities from explosions

Protect beacon and anvil use by default. This is pretty straightforward.

Protecting Hanging entities from explosions—painting explosion protection was never a feature in Factions, but it is especially important in 1.4.2 with the addition of item frames; someone can lure a creeper to an item frame and get whatever is inside which may be very valuable (e.g. a diamond in a frame to indicate a chest where diamonds are stored).

Unfortunately, Bukkit does not throw a HangingBreakByEntityEvent when it is destroyed by an explosion, so I've copied and pasted code from the onEntityExplode method to check if that location protects fireballs, creepers, or TNT. In other words, if any type of explosion is blocked at all in the territory, the Hanging entity will not be destroyed.