Program: 20660
Project: 20660
Buggy source:
@Override public void onEntityDeath(EntityDeathEvent event){
  Entity defender=event.getEntity();
  Player attacker=kills.get(defender.getEntityId());
  kills.remove(defender);
  Properties prop=plugin.getConfigManager().getProperties();
  if (defender instanceof Player) {
    Hero heroDefender=plugin.getHeroManager().getHero((Player)defender);
    int exp=heroDefender.getExperience();
    int level=prop.getLevel(exp);
    if (level < prop.maxLevel) {
      int currentLevelExp=prop.getExperience(level);
      int nextLevelExp=prop.getExperience(level + 1);
      int expLoss=(int)((nextLevelExp - currentLevelExp) * 0.05);
      if (exp - expLoss < currentLevelExp) {
        expLoss=exp - currentLevelExp;
      }
      heroDefender.setExperience(exp - expLoss);
      Messaging.send(heroDefender.getPlayer(),"String_Node_Str" + expLoss + "String_Node_Str");
    }
  }
  if (attacker != null) {
    Hero hero=plugin.getHeroManager().getHero(attacker);
    HeroClass playerClass=hero.getPlayerClass();
    Set<ExperienceType> expSources=playerClass.getExperienceSources();
    if (expSources.contains(ExperienceType.KILLING)) {
      if (defender instanceof LivingEntity) {
        int addedExp=0;
        if (defender instanceof Player) {
          prop.playerDeaths.put((Player)defender,defender.getLocation());
          addedExp=prop.playerKillingExp;
        }
 else {
          CreatureType type=null;
          try {
            Class<?>[] interfaces=defender.getClass().getInterfaces();
            for (            Class<?> c : interfaces) {
              if (LivingEntity.class.isAssignableFrom(c)) {
                type=CreatureType.fromName(c.getSimpleName());
                break;
              }
            }
          }
 catch (          IllegalArgumentException e) {
          }
          if (type != null) {
            if (!(prop.creatureKillingExp.containsKey(type))) {
              return;
            }
            addedExp=prop.creatureKillingExp.get(type);
          }
        }
        int exp=hero.getExperience();
        int currentLevel=prop.getLevel(exp);
        int newLevel=prop.getLevel(exp + addedExp);
        if (currentLevel == prop.maxLevel) {
          return;
        }
        ExperienceGainEvent expEvent;
        if (newLevel == currentLevel) {
          expEvent=new ExperienceGainEvent(attacker,addedExp);
        }
 else {
          expEvent=new LevelEvent(attacker,addedExp,newLevel,currentLevel);
        }
        plugin.getServer().getPluginManager().callEvent(expEvent);
        if (expEvent.isCancelled()) {
          return;
        }
        addedExp=expEvent.getExp();
        if (addedExp != 0) {
          hero.setExperience(exp + addedExp);
          if (hero.isVerbose()) {
            Messaging.send(attacker,"String_Node_Str",playerClass.getName(),String.valueOf(addedExp));
          }
          if (newLevel != currentLevel) {
            Messaging.send(attacker,"String_Node_Str",String.valueOf(newLevel),playerClass.getName());
            if (newLevel >= prop.maxLevel) {
              hero.setExperience(prop.getExperience(prop.maxLevel));
              hero.getMasteries().add(playerClass.getName());
              Messaging.broadcast(plugin,"String_Node_Str",attacker.getName(),playerClass.getName());
            }
          }
        }
      }
    }
  }
}

Fixed version (ground truth):
@Override public void onEntityDeath(EntityDeathEvent event){
  Entity defender=event.getEntity();
  Player attacker=kills.get(defender.getEntityId());
  kills.remove(defender.getEntityId());
  Properties prop=plugin.getConfigManager().getProperties();
  if (defender instanceof Player) {
    Hero heroDefender=plugin.getHeroManager().getHero((Player)defender);
    int exp=heroDefender.getExperience();
    int level=prop.getLevel(exp);
    if (level < prop.maxLevel) {
      int currentLevelExp=prop.getExperience(level);
      int nextLevelExp=prop.getExperience(level + 1);
      int expLoss=(int)((nextLevelExp - currentLevelExp) * 0.05);
      if (exp - expLoss < currentLevelExp) {
        expLoss=exp - currentLevelExp;
      }
      heroDefender.setExperience(exp - expLoss);
      Messaging.send(heroDefender.getPlayer(),"String_Node_Str" + expLoss + "String_Node_Str");
    }
  }
  if (attacker != null) {
    Hero hero=plugin.getHeroManager().getHero(attacker);
    HeroClass playerClass=hero.getPlayerClass();
    Set<ExperienceType> expSources=playerClass.getExperienceSources();
    if (expSources.contains(ExperienceType.KILLING)) {
      if (defender instanceof LivingEntity) {
        int addedExp=0;
        if (defender instanceof Player) {
          prop.playerDeaths.put((Player)defender,defender.getLocation());
          addedExp=prop.playerKillingExp;
        }
 else {
          CreatureType type=null;
          try {
            Class<?>[] interfaces=defender.getClass().getInterfaces();
            for (            Class<?> c : interfaces) {
              if (LivingEntity.class.isAssignableFrom(c)) {
                type=CreatureType.fromName(c.getSimpleName());
                break;
              }
            }
          }
 catch (          IllegalArgumentException e) {
          }
          if (type != null) {
            if (!(prop.creatureKillingExp.containsKey(type))) {
              return;
            }
            addedExp=prop.creatureKillingExp.get(type);
          }
        }
        int exp=hero.getExperience();
        int currentLevel=prop.getLevel(exp);
        int newLevel=prop.getLevel(exp + addedExp);
        if (currentLevel == prop.maxLevel) {
          return;
        }
        ExperienceGainEvent expEvent;
        if (newLevel == currentLevel) {
          expEvent=new ExperienceGainEvent(attacker,addedExp);
        }
 else {
          expEvent=new LevelEvent(attacker,addedExp,newLevel,currentLevel);
        }
        plugin.getServer().getPluginManager().callEvent(expEvent);
        if (expEvent.isCancelled()) {
          return;
        }
        addedExp=expEvent.getExp();
        if (addedExp != 0) {
          hero.setExperience(exp + addedExp);
          if (hero.isVerbose()) {
            Messaging.send(attacker,"String_Node_Str",playerClass.getName(),String.valueOf(addedExp));
          }
          if (newLevel != currentLevel) {
            Messaging.send(attacker,"String_Node_Str",String.valueOf(newLevel),playerClass.getName());
            if (newLevel >= prop.maxLevel) {
              hero.setExperience(prop.getExperience(prop.maxLevel));
              hero.getMasteries().add(playerClass.getName());
              Messaging.broadcast(plugin,"String_Node_Str",attacker.getName(),playerClass.getName());
            }
          }
        }
      }
    }
  }
}