Bukkit/CraftBukkit — pull request #806 by authorblues (2012-06-28 15:47:25+00:00)
Title: Fire ExplosionPrimeEvent properly. Fixes BUKKIT-770

There are two events corresponding to explosions: ExplosionPrimeEvent, which is presumably meant to be fired when an explosion is primed (TNT primes and Creepers threaten); and EntityExplodeEvent, which fires when the explosion is triggered.

Historically, both of these events fire at the same time, making ExplosionPrimeEvent useless and incorrect. This pull request addresses [BUKKIT-770](https://bukkit.atlassian.net/browse/BUKKIT-770) and makes this event useful. As such, a few things have been changed:

* EntityFireball now no longer triggers ExplosionPrimeEvent, as this event doesn't make sense in that context
* EntityCreeper now triggers ExplosionPrimeEvent when they get near a player. This event can be cancelled, which will prevent the creeper from ever exploding, but since the animation for creepers threatening is client side, the player will still hear the fuse sound and see the flashing creeper.
* BlockTNT now triggers ExplosionPrimeEvent when the block is primed. Cancelling the event means that the TNT block does not disappear when it is manually primed (a block remains), but if the priming is the result of another explosion, a TNT block is dropped. This new reaction was discussed with Amaranth as a logical solution, but I would be willing to change this.