Upon hitting an entity or a block, a Fireball will fire two instances of ProjectileHitEvent on the same tick. This includes small fireballs, wither skulls, and likely every other subinterface.
This behavior is not exhibited with non-fireball projectiles such as arrows.
import org.bukkit.Bukkit; import org.bukkit.event.EventHandler; import org.bukkit.event.Listener; import org.bukkit.event.entity.ProjectileHitEvent; import org.bukkit.plugin.java.JavaPlugin; public final class SamplePlugin extends JavaPlugin implements Listener { @Override public void onEnable() { this.getServer().getPluginManager().registerEvents(this, this); } @EventHandler(ignoreCancelled = true) private void onSkullHit(final ProjectileHitEvent event) { if (event.getHitEntity() != null) { Bukkit.broadcastMessage(event.getEntityType().toString() + " hit an entity at " + event.getEntity().getWorld().getFullTime()); } if (event.getHitBlock() != null) { Bukkit.broadcastMessage(event.getEntityType().toString() + " hit a block at " + event.getEntity().getWorld().getFullTime()); } } }
Expected Output:
[12:43:19] [Server thread/INFO]: ARROW hit an entity at 6541 [12:43:20] [Server thread/INFO]: SMALL_FIREBALL hit a block at 6550 [12:43:25] [Server thread/INFO]: ARROW hit a block at 6654 [12:43:25] [Server thread/INFO]: SMALL_FIREBALL hit an entity at 6655
Actual Output:
[12:43:19] [Server thread/INFO]: ARROW hit an entity at 6541 [12:43:20] [Server thread/INFO]: SMALL_FIREBALL hit a block at 6550 [12:43:20] [Server thread/INFO]: SMALL_FIREBALL hit a block at 6550 [12:43:25] [Server thread/INFO]: ARROW hit a block at 6654 [12:43:25] [Server thread/INFO]: SMALL_FIREBALL hit an entity at 6655 [12:43:25] [Server thread/INFO]: SMALL_FIREBALL hit an entity at 6655