Buggy code:
public class StatisticianEntityListener extends EntityListener { private EDHPlayer edhPlayer ; public StatisticianEntityListener ( EDHPlayer passedEDH ) { } @ Override public void onEntityDeath ( EntityDeathEvent event ) { <START_BUG> if ( ( event . getEntity ( ) . getLastDamageCause ( ) ) == null ) { <END_BUG> Player playerVictim = null ; Player playerKiller = null ; DamageCause cause = event . getEntity ( ) . getLastDamageCause ( ) . getCause ( ) ; if ( ( event . getEntity ( ) ) instanceof Player ) { playerVictim = ( ( Player ) ( event . getEntity ( ) ) ) ; if ( ( event . getEntity ( ) . getLastDamageCause ( ) ) instanceof EntityDamageByEntityEvent ) { if ( ( ( ( EntityDamageByEntityEvent ) ( event . getEntity ( ) . getLastDamageCause ( ) ) ) . getDamager ( ) ) instanceof Arrow ) { Arrow arrow = ( ( Arrow ) ( ( ( EntityDamageByEntityEvent ) ( event . getEntity ( ) . getLastDamageCause ( ) ) ) . getDamager ( ) ) ) ; if ( ( arrow . getShooter ( ) ) instanceof Player ) { edhPlayer . PlayerKilledByPlayerProjectile ( ( ( Player ) ( arrow . getShooter ( ) ) ) , playerVictim , arrow , cause ) ; } else if ( ( arrow . getShooter ( ) ) instanceof Creature ) { edhPlayer . PlayerKilledByCreatureProjectile ( playerVictim , ( ( Creature ) ( arrow . getShooter ( ) ) ) , arrow , cause ) ; } } else if ( ( ( ( EntityDamageByEntityEvent ) ( event . getEntity ( ) . getLastDamageCause ( ) ) ) . getDamager ( ) ) instanceof Player ) { playerKiller = ( ( Player ) ( ( ( EntityDamageByEntityEvent ) ( event . getEntity ( ) . getLastDamageCause ( ) ) ) . getDamager ( ) ) ) ; edhPlayer . PlayerKilledByPlayer ( playerKiller , playerVictim , cause ) ; } else if ( ( ( ( EntityDamageByEntityEvent ) ( event . getEntity ( ) . getLastDamageCause ( ) ) ) . getDamager ( ) ) instanceof Explosive ) { edhPlayer . PlayerKilledByOtherCause ( playerVictim , event . getEntity ( ) . getLastDamageCause ( ) . getCause ( ) ) ; } else { if ( ( ( ( EntityDamageByEntityEvent ) ( event . getEntity ( ) . getLastDamageCause ( ) ) ) . getDamager ( ) ) instanceof Creature ) { edhPlayer . PlayerKilledByCreature ( playerVictim , ( ( Creature ) ( ( ( EntityDamageByEntityEvent ) ( event . getEntity ( ) . getLastDamageCause ( ) ) ) . getDamager ( ) ) ) , cause ) ; } else if ( ( ( ( EntityDamageByEntityEvent ) ( event . getEntity ( ) . getLastDamageCause ( ) ) ) . getDamager ( ) ) instanceof Slime ) { edhPlayer . PlayerKilledBySlime ( playerVictim , ( ( Slime ) ( ( ( EntityDamageByEntityEvent ) ( event . getEntity ( ) . getLastDamageCause ( ) ) ) . getDamager ( ) ) ) , cause ) ; } } } else if ( ( event . getEntity ( ) . getLastDamageCause ( ) ) instanceof EntityDamageByBlockEvent ) { edhPlayer . PlayerKilledByBlock ( playerVictim , ( ( EntityDamageByBlockEvent ) ( event . getEntity ( ) . getLastDamageCause ( ) ) ) . getDamager ( ) , cause ) ; } else { edhPlayer . PlayerKilledByOtherCause ( playerVictim , event . getEntity ( ) . getLastDamageCause ( ) . getCause ( ) ) ; } } else { if ( ( event . getEntity ( ) . getLastDamageCause ( ) ) instanceof EntityDamageByEntityEvent ) { if ( ( ( ( EntityDamageByEntityEvent ) ( event . getEntity ( ) . getLastDamageCause ( ) ) ) . getDamager ( ) ) instanceof Arrow ) { Arrow arrow = ( ( Arrow ) ( ( ( EntityDamageByEntityEvent ) ( event . getEntity ( ) . getLastDamageCause ( ) ) ) . getDamager ( ) ) ) ; if ( ( arrow . getShooter ( ) ) instanceof Player ) { playerKiller = ( ( Player ) ( arrow . getShooter ( ) ) ) ; if ( ( event . getEntity ( ) ) instanceof Creature ) { edhPlayer . PlayerKilledCreatureProjectile ( playerKiller , ( ( Creature ) ( event . getEntity ( ) ) ) , arrow , cause ) ; } else if ( ( event . getEntity ( ) ) instanceof Slime ) { edhPlayer . PlayerKilledSlimeProjectile ( playerKiller , ( ( Slime ) ( event . getEntity ( ) ) ) , arrow , cause ) ; } } } else if ( ( ( ( EntityDamageByEntityEvent ) ( event . getEntity ( ) . getLastDamageCause ( ) ) ) . getDamager ( ) ) instanceof Player ) { playerKiller = ( ( Player ) ( ( ( EntityDamageByEntityEvent ) ( event . getEntity ( ) . getLastDamageCause ( ) ) ) . getDamager ( ) ) ) ; if ( ( event . getEntity ( ) ) instanceof Creature ) { edhPlayer . PlayerKilledCreature ( playerKiller , ( ( Creature ) ( event . getEntity ( ) ) ) , cause ) ; } else if ( ( event . getEntity ( ) ) instanceof Slime ) { edhPlayer . PlayerKilledSlime ( playerKiller , ( ( Slime ) ( event . getEntity ( ) ) ) , cause ) ; } } } } } } }

Fix:
if ( ( event . getEntity ( ) . getLastDamageCause ( ) ) != null ) {