nus-yam/ex-repair huggingface dataset:
Program: 44332
Project: 44332
Buggy source:
public AbstractRewardSource(String section,ConfigurationSection config){
  if (config == null) {
    throw new IllegalArgumentException("String_Node_Str");
  }
  ConfigurationSection rewardConfig=config.getConfigurationSection(section);
  name=rewardConfig.getName();
  itemDrops=new ArrayList<AbstractItemDrop>();
  itemDrops.addAll(ItemDrop.parseConfig(rewardConfig));
  itemDrops.addAll(BookDrop.parseConfig(rewardConfig));
  itemDrops.addAll(LoreDrop.parseConfig(rewardConfig));
  entityDrops=EntityDrop.parseConfig(rewardConfig);
  jockeyDrops=new ArrayList<JockeyDrop>();
  for (  EntityDrop drop : JockeyDrop.parseConfig(rewardConfig)) {
    if (drop instanceof JockeyDrop) {
      jockeyDrops.add((JockeyDrop)drop);
    }
  }
  coin=CoinDrop.parseConfig(rewardConfig);
  coinRewardMessage=new CoinMessageDecorator(new DefaultMessage(rewardConfig.getString("String_Node_Str",config.getString("String_Node_Str",COIN_REWARD_MESSAGE))));
  coinPenaltyMessage=new CoinMessageDecorator(new DefaultMessage(rewardConfig.getString("String_Node_Str",config.getString("String_Node_Str",COIN_PENALTY_MESSAGE))));
  noCoinRewardMessage=new NoCoinMessageDecorator(new DefaultMessage(rewardConfig.getString("String_Node_Str",config.getString("String_Node_Str",NO_COIN_REWARD_MESSAGE))));
  addItemsToInventory=rewardConfig.getBoolean("String_Node_Str",false);
}

Fixed version (ground truth):
public AbstractRewardSource(String section,ConfigurationSection config){
  this();
  if (config == null) {
    throw new IllegalArgumentException("String_Node_Str");
  }
  ConfigurationSection rewardConfig=config.getConfigurationSection(section);
  name=rewardConfig.getName();
  itemDrops=new ArrayList<AbstractItemDrop>();
  itemDrops.addAll(ItemDrop.parseConfig(rewardConfig));
  itemDrops.addAll(BookDrop.parseConfig(rewardConfig));
  itemDrops.addAll(LoreDrop.parseConfig(rewardConfig));
  entityDrops=EntityDrop.parseConfig(rewardConfig);
  jockeyDrops=new ArrayList<JockeyDrop>();
  for (  EntityDrop drop : JockeyDrop.parseConfig(rewardConfig)) {
    if (drop instanceof JockeyDrop) {
      jockeyDrops.add((JockeyDrop)drop);
    }
  }
  coin=CoinDrop.parseConfig(rewardConfig);
  coinRewardMessage=new CoinMessageDecorator(new DefaultMessage(rewardConfig.getString("String_Node_Str",config.getString("String_Node_Str",COIN_REWARD_MESSAGE))));
  coinPenaltyMessage=new CoinMessageDecorator(new DefaultMessage(rewardConfig.getString("String_Node_Str",config.getString("String_Node_Str",COIN_PENALTY_MESSAGE))));
  noCoinRewardMessage=new NoCoinMessageDecorator(new DefaultMessage(rewardConfig.getString("String_Node_Str",config.getString("String_Node_Str",NO_COIN_REWARD_MESSAGE))));
  addItemsToInventory=rewardConfig.getBoolean("String_Node_Str",false);
}
Program: 44333
Project: 44333
Buggy source:
private static List<EntityDrop> parseDrops(List<String> dropsList){
  List<EntityDrop> drops=Collections.emptyList();
  for (  String dropString : dropsList) {
    EntityDrop drop=createEntityDrop(dropString);
    if (drop != null) {
      drops=new ArrayList<EntityDrop>();
      drops.add(drop);
    }
  }
  return drops;
}

Fixed version (ground truth):
private static List<EntityDrop> parseDrops(List<String> dropsList){
  List<EntityDrop> drops=new ArrayList<EntityDrop>();
  for (  String dropString : dropsList) {
    EntityDrop drop=createEntityDrop(dropString);
    if (drop != null) {
      drops.add(drop);
    }
  }
  return drops;
}
Program: 44334
Project: 44334
Buggy source:
private void dropCoin(String player,Reward reward){
  if (!DependencyUtils.hasEconomy()) {
    return;
  }
  double amount=calculateAmount(reward);
  Set<String> party=new HashSet<String>();
  party.add(player);
  party.addAll(reward.getParty());
  for (  String member : party) {
    registerAmount(member,amount);
    Message message=member.equals(player) ? reward.getMessage() : getPartyMessage(amount);
    reward.addParameter(MessageToken.PLAYER,member).addParameter(MessageToken.AMOUNT,DependencyUtils.getEconomy().format(Math.abs(amount)));
    MessageHandler handler=new MessageHandler(message,reward.getParameters());
    handler.send(member);
  }
}

Fixed version (ground truth):
private void dropCoin(String player,Reward reward){
  if (!DependencyUtils.hasEconomy()) {
    return;
  }
  double amount=calculateAmount(reward);
  if (Math.abs(amount) > 0.0) {
    for (    String member : createParty(player,reward)) {
      registerAmount(member,amount);
      Message message=member.equals(player) ? reward.getMessage() : getPartyMessage(amount);
      reward.addParameter(MessageToken.PLAYER,member).addParameter(MessageToken.AMOUNT,DependencyUtils.getEconomy().format(Math.abs(amount)));
      MessageHandler handler=new MessageHandler(message,reward.getParameters());
      handler.send(member);
    }
  }
}
Program: 44335
Project: 44335
Buggy source:
private double calculateAmount(Reward reward){
  LoggerUtil.getInstance().debug("String_Node_Str" + reward.getCoin());
  LoggerUtil.getInstance().debug("String_Node_Str" + reward.getGain());
  double amount=reward.getCoin() * reward.getGain();
  LoggerUtil.getInstance().debug("String_Node_Str" + amount);
  if (reward.getParty().size() > 1) {
    amount/=reward.getParty().size();
    LoggerUtil.getInstance().debug("String_Node_Str" + amount);
  }
  if (reward.isIntegerCurrency()) {
    amount=Math.round(amount);
    LoggerUtil.getInstance().debug("String_Node_Str" + amount);
  }
  return amount;
}

Fixed version (ground truth):
private double calculateAmount(Reward reward){
  LoggerUtil.getInstance().debug("String_Node_Str" + reward.getCoin());
  LoggerUtil.getInstance().debug("String_Node_Str" + reward.getGain());
  double amount=reward.getCoin() * reward.getGain();
  LoggerUtil.getInstance().debug("String_Node_Str" + amount);
  if (reward.getParty().size() > 1) {
    LoggerUtil.getInstance().debug("String_Node_Str" + reward.getParty().size());
    amount/=reward.getParty().size();
    LoggerUtil.getInstance().debug("String_Node_Str" + amount);
  }
  if (reward.isIntegerCurrency()) {
    amount=round(amount,0,BigDecimal.ROUND_HALF_UP);
    LoggerUtil.getInstance().debug("String_Node_Str" + amount);
  }
 else {
    amount=round(amount,2,BigDecimal.ROUND_HALF_UP);
    LoggerUtil.getInstance().debug("String_Node_Str" + amount);
  }
  return amount;
}
Program: 44336
Project: 44336
Buggy source:
private static Short parseDurability(String dropString){
  String[] dropParts=dropString.split("String_Node_Str");
  String[] itemParts=dropParts[0].split("String_Node_Str");
  String[] itemSubParts=itemParts[0].split("String_Node_Str");
  return itemSubParts.length > 2 ? Short.parseShort(itemSubParts[2]) : null;
}

Fixed version (ground truth):
private static Short parseDurability(String dropString){
  String[] dropParts=dropString.split("String_Node_Str");
  String[] itemParts=dropParts[0].split("String_Node_Str");
  String[] itemSubParts=itemParts[0].split("String_Node_Str");
  return itemSubParts.length > 2 && !itemSubParts[2].isEmpty() ? Short.parseShort(itemSubParts[2]) : null;
}
Program: 44337
Project: 44337
Buggy source:
private static Byte parseData(String dropString){
  String[] dropParts=dropString.split("String_Node_Str");
  String[] itemParts=dropParts[0].split("String_Node_Str");
  String[] itemSubParts=itemParts[0].split("String_Node_Str");
  return itemSubParts.length > 1 ? Byte.parseByte(itemSubParts[1]) : null;
}

Fixed version (ground truth):
private static Byte parseData(String dropString){
  String[] dropParts=dropString.split("String_Node_Str");
  String[] itemParts=dropParts[0].split("String_Node_Str");
  String[] itemSubParts=itemParts[0].split("String_Node_Str");
  return itemSubParts.length > 1 && !itemSubParts[1].isEmpty() ? Byte.parseByte(itemSubParts[1]) : null;
}
Program: 44338
Project: 44338
Buggy source:
@Override public String getAssembledMessage(Map<MessageToken,String> parameters){
  String assembledMessage=template;
  if (assembledMessage != null && assembledMessage.length() > 0) {
    for (    Entry<MessageToken,String> entry : parameters.entrySet()) {
      if (entry.getKey() == MessageToken.AMOUNT) {
        assembledMessage=assembledMessage.replaceAll(entry.getKey().toString(),entry.getValue().replaceAll("String_Node_Str","String_Node_Str"));
      }
 else       if (entry.getKey() == MessageToken.ITEM) {
        assembledMessage=assembledMessage.replaceAll(entry.getKey().toString(),toCamelCase(entry.getValue()));
      }
 else       if (entry.getKey() == MessageToken.CLASS && DependencyUtils.hasHeroes()) {
        Player player=Bukkit.getPlayer(parameters.get(MessageToken.PLAYER));
        if (player != null) {
          assembledMessage=assembledMessage.replaceAll(MessageToken.CLASS.toString(),DependencyUtils.getHeroes().getCharacterManager().getHero(player).getHeroClass().getName());
        }
      }
 else {
        assembledMessage=assembledMessage.replaceAll(entry.getKey().toString(),entry.getValue());
      }
    }
  }
  return assembledMessage;
}

Fixed version (ground truth):
@Override public String getAssembledMessage(Map<MessageToken,String> parameters){
  String assembledMessage=template;
  if (DependencyUtils.hasHeroes() && parameters.containsKey(MessageToken.PLAYER)) {
    Player player=Bukkit.getPlayer(parameters.get(MessageToken.PLAYER));
    if (player != null) {
      parameters.put(MessageToken.CLASS,DependencyUtils.getHeroes().getCharacterManager().getHero(player).getHeroClass().getName());
    }
  }
  if (assembledMessage != null && assembledMessage.length() > 0) {
    for (    Entry<MessageToken,String> entry : parameters.entrySet()) {
      if (entry.getKey() == MessageToken.AMOUNT) {
        assembledMessage=assembledMessage.replaceAll(entry.getKey().toString(),entry.getValue().replaceAll("String_Node_Str","String_Node_Str"));
      }
 else       if (entry.getKey() == MessageToken.ITEM) {
        assembledMessage=assembledMessage.replaceAll(entry.getKey().toString(),toCamelCase(entry.getValue()));
      }
 else {
        assembledMessage=assembledMessage.replaceAll(entry.getKey().toString(),entry.getValue());
      }
    }
  }
  return assembledMessage;
}
Program: 44339
Project: 44339
Buggy source:
public ItemStack getOutcome(boolean isFixedDrops){
  if (random.nextDouble() * 100.0D < percentage && material != null) {
    int dropAmount=isFixedDrops ? range.getMaximumInteger() : range.getMinimumInteger() + random.nextInt(Math.abs(range.getMaximumInteger() - range.getMinimumInteger() + 1));
    if (dropAmount > 0) {
      ItemStack itemStack;
      if (data == null) {
        itemStack=new ItemStack(material,dropAmount);
      }
 else {
        MaterialData materialData=new MaterialData(material,data);
        itemStack=materialData.toItemStack(dropAmount);
        if (durability != null) {
          itemStack.setDurability(durability);
        }
      }
      itemStack.addEnchantments(ItemEnchantment.getOutcome(enchantments));
      if (itemStack.getAmount() > 0) {
        return itemStack;
      }
    }
  }
  return null;
}

Fixed version (ground truth):
public ItemStack getOutcome(boolean isFixedDrops){
  if (random.nextDouble() * 100.0D < percentage && material != null) {
    int dropAmount=isFixedDrops ? range.getMaximumInteger() : range.getMinimumInteger() + random.nextInt(Math.abs(range.getMaximumInteger() - range.getMinimumInteger() + 1));
    if (dropAmount > 0) {
      ItemStack itemStack;
      if (data == null && durability == null) {
        itemStack=new ItemStack(material,dropAmount);
      }
 else {
        MaterialData materialData=data == null ? new MaterialData(material) : new MaterialData(material,data);
        itemStack=materialData.toItemStack(dropAmount);
        if (durability != null) {
          itemStack.setDurability(durability);
        }
      }
      itemStack.addEnchantments(ItemEnchantment.getOutcome(enchantments));
      if (itemStack.getAmount() > 0) {
        return itemStack;
      }
    }
  }
  return null;
}
Program: 44340
Project: 44340
Buggy source:
private double calculateAmount(Reward reward){
  LoggerUtil.getInstance().debug(this.getClass(),"String_Node_Str" + reward.getCoin());
  LoggerUtil.getInstance().debug(this.getClass(),"String_Node_Str" + reward.getGain());
  double amount=reward.getCoin() * reward.getGain();
  LoggerUtil.getInstance().debug(this.getClass(),"String_Node_Str" + amount);
  if (reward.getParty().size() > 1) {
    amount/=reward.getParty().size();
    LoggerUtil.getInstance().debug(this.getClass(),"String_Node_Str" + amount);
  }
  if (reward.isIntegerCurrency()) {
    LoggerUtil.getInstance().debug(this.getClass(),"String_Node_Str" + amount);
    amount=Math.round(amount);
  }
  return amount;
}

Fixed version (ground truth):
private double calculateAmount(Reward reward){
  LoggerUtil.getInstance().debug(this.getClass(),"String_Node_Str" + reward.getCoin());
  LoggerUtil.getInstance().debug(this.getClass(),"String_Node_Str" + reward.getGain());
  double amount=reward.getCoin() * reward.getGain();
  LoggerUtil.getInstance().debug(this.getClass(),"String_Node_Str" + amount);
  if (reward.getParty().size() > 1) {
    amount/=reward.getParty().size();
    LoggerUtil.getInstance().debug(this.getClass(),"String_Node_Str" + amount);
  }
  if (reward.isIntegerCurrency()) {
    amount=Math.round(amount);
    LoggerUtil.getInstance().debug(this.getClass(),"String_Node_Str" + amount);
  }
  return amount;
}
Program: 44341
Project: 44341
Buggy source:
@Override protected Location getLocation(Event event){
  if (event instanceof EntityDeathEvent) {
    return ((EntityDeathEvent)event).getEntity().getLocation();
  }
 else   if (event instanceof PlayerDeathEvent) {
    return ((PlayerDeathEvent)event).getEntity().getLocation();
  }
  return null;
}

Fixed version (ground truth):
@Override protected Location getLocation(Event event){
  Location location=null;
  if (event instanceof EntityKilledEvent) {
    location=((EntityKilledEvent)event).getEntity().getLocation();
  }
 else   if (event instanceof PlayerKilledEvent) {
    location=((PlayerKilledEvent)event).getEntity().getLocation();
  }
 else   if (event instanceof PlayerDeathEvent) {
    location=((PlayerDeathEvent)event).getEntity().getLocation();
  }
  return location;
}
Program: 44342
Project: 44342
Buggy source:
@EventHandler(ignoreCancelled=true) public void onRewardEvent(RewardEvent event){
  if (!event.isCancelled()) {
    Reward reward=event.getReward();
    Player player=event.getPlayer();
    dropCoin(player.getName(),reward);
    dropItems(reward);
    dropEntities(reward);
    plugin.getMetrics().addCount(reward.getName());
  }
}

Fixed version (ground truth):
@EventHandler(ignoreCancelled=true) public void onRewardEvent(RewardEvent event){
  if (!event.isCancelled()) {
    Reward reward=event.getReward();
    Player player=event.getPlayer();
    if (player != null) {
      dropCoin(player.getName(),reward);
      dropItems(reward);
      dropEntities(reward);
      plugin.getMetrics().addCount(reward.getName());
      if (ECLogger.getInstance().isDebug()) {
        ECLogger.getInstance().debug(this.getClass(),"String_Node_Str" + reward.getName());
      }
    }
  }
}
Program: 44343
Project: 44343
Buggy source:
protected static AbstractRewardSource mergeSets(AbstractRewardSource source,ConfigurationSection rewardConfig,ConfigurationSection rewardSets){
  List<String> sets=rewardConfig.getStringList("String_Node_Str");
  if (!sets.isEmpty() && rewardSets != null) {
    for (    String setName : sets) {
      if (rewardSets.getConfigurationSection(setName) != null) {
        AbstractRewardSource setSource=RewardSourceFactory.createSource(source.getName(),rewardSets.getConfigurationSection(setName));
        source=mergeRewardSource(source,setSource);
      }
    }
  }
  return source;
}

Fixed version (ground truth):
protected static AbstractRewardSource mergeSets(AbstractRewardSource source,ConfigurationSection rewardConfig,ConfigurationSection rewardSets){
  List<String> sets=rewardConfig.getStringList("String_Node_Str");
  if (!sets.isEmpty() && rewardSets != null) {
    for (    String setName : sets) {
      if (rewardSets.getConfigurationSection(setName) != null) {
        AbstractRewardSource setSource=RewardSourceFactory.createSource(CustomRewardType.SET.getName(),rewardSets.getConfigurationSection(setName));
        setSource.setName(source.getName());
        source=mergeRewardSource(source,setSource);
      }
    }
  }
  return source;
}
Program: 44344
Project: 44344
Buggy source:
private void dropCoin(String player,Reward reward){
  if (!DependencyUtils.hasDeathTpPlus()) {
    return;
  }
  double amount=calculateAmount(reward);
  Set<String> party=new HashSet<String>();
  party.add(player);
  party.addAll(reward.getParty());
  for (  String member : party) {
    registerAmount(member,amount);
    Message message=member.equals(player) ? reward.getMessage() : getPartyMessage(amount);
    message.addParameter(MessageToken.PLAYER,member);
    message.addParameter(MessageToken.AMOUNT,DependencyUtils.getEconomy().format(Math.abs(amount)));
    MessageHandler handler=new MessageHandler(member,message);
    handler.send();
  }
}

Fixed version (ground truth):
private void dropCoin(String player,Reward reward){
  if (!DependencyUtils.hasEconomy()) {
    return;
  }
  double amount=calculateAmount(reward);
  Set<String> party=new HashSet<String>();
  party.add(player);
  party.addAll(reward.getParty());
  for (  String member : party) {
    registerAmount(member,amount);
    Message message=member.equals(player) ? reward.getMessage() : getPartyMessage(amount);
    message.addParameter(MessageToken.PLAYER,member);
    message.addParameter(MessageToken.AMOUNT,DependencyUtils.getEconomy().format(Math.abs(amount)));
    MessageHandler handler=new MessageHandler(member,message);
    handler.send();
  }
}
Program: 44345
Project: 44345
Buggy source:
public boolean hasDrops(){
  return !itemDrops.isEmpty() && !entityDrops.isEmpty();
}

Fixed version (ground truth):
public boolean hasDrops(){
  return !itemDrops.isEmpty() || !entityDrops.isEmpty();
}
Program: 44346
Project: 44346
Buggy source:
protected static AbstractRewardSource mergeSets(AbstractRewardSource source,ConfigurationSection rewardConfig,ConfigurationSection rewardSets){
  List<String> sets=rewardConfig.getStringList("String_Node_Str");
  if (!sets.isEmpty() && rewardSets != null) {
    for (    String setName : sets) {
      if (rewardSets.getConfigurationSection(setName) != null) {
        AbstractRewardSource setSource=RewardSourceFactory.createSource(CustomRewardType.SET.getName(),rewardSets.getConfigurationSection(setName));
        source=mergeRewardSource(source,setSource);
      }
    }
  }
  return source;
}

Fixed version (ground truth):
protected static AbstractRewardSource mergeSets(AbstractRewardSource source,ConfigurationSection rewardConfig,ConfigurationSection rewardSets){
  List<String> sets=rewardConfig.getStringList("String_Node_Str");
  if (!sets.isEmpty() && rewardSets != null) {
    for (    String setName : sets) {
      if (rewardSets.getConfigurationSection(setName) != null) {
        AbstractRewardSource setSource=RewardSourceFactory.createSource(source.getName(),rewardSets.getConfigurationSection(setName));
        source=mergeRewardSource(source,setSource);
      }
    }
  }
  return source;
}
Program: 44347
Project: 44347
Buggy source:
public static AbstractRewardSettings parseConfig(ConfigurationSection config){
  Map<EntityType,List<AbstractRewardSource>> sources=new HashMap<EntityType,List<AbstractRewardSource>>();
  ConfigurationSection rewardTable=config.getConfigurationSection("String_Node_Str");
  if (rewardTable != null) {
    for (    String typeName : rewardTable.getKeys(false)) {
      EntityType type=EntityType.fromName(typeName);
      if (type != null) {
        AbstractRewardSource source=configureRewardSource(RewardSourceFactory.createSource(typeName,rewardTable.getConfigurationSection(typeName)),config);
        if (!sources.containsKey(type)) {
          sources.put(type,new ArrayList<AbstractRewardSource>());
        }
        sources.get(type).add(mergeSets(source,rewardTable,config.getConfigurationSection("String_Node_Str")));
      }
    }
  }
  EntityRewardSettings settings=new EntityRewardSettings(sources);
  settings.setHuntingRules(loadHuntingRules(config));
  return settings;
}

Fixed version (ground truth):
public static AbstractRewardSettings parseConfig(ConfigurationSection config){
  Map<EntityType,List<AbstractRewardSource>> sources=new HashMap<EntityType,List<AbstractRewardSource>>();
  ConfigurationSection rewardTable=config.getConfigurationSection("String_Node_Str");
  if (rewardTable != null) {
    for (    String typeName : rewardTable.getKeys(false)) {
      EntityType type=EntityType.fromName(typeName);
      if (type != null) {
        AbstractRewardSource source=configureRewardSource(RewardSourceFactory.createSource(typeName,rewardTable.getConfigurationSection(typeName)),config);
        if (!sources.containsKey(type)) {
          sources.put(type,new ArrayList<AbstractRewardSource>());
        }
        sources.get(type).add(mergeSets(source,rewardTable.getConfigurationSection(typeName),config.getConfigurationSection("String_Node_Str")));
      }
    }
  }
  EntityRewardSettings settings=new EntityRewardSettings(sources);
  settings.setHuntingRules(loadHuntingRules(config));
  return settings;
}
Program: 44348
Project: 44348
Buggy source:
private static Message configureMessage(Message message,ConfigurationSection config){
  if (message != null && config != null) {
    message.setMessageOutputEnabled(config.getBoolean("String_Node_Str",true));
    message.setCoinLoggingEnabled(config.getBoolean("String_Node_Str",true));
    if (message instanceof NoCoinRewardMessage) {
      ((NoCoinRewardMessage)message).setNoRewardMessageEnabled(config.getBoolean("String_Node_Str",false));
    }
    if (message instanceof SpawnerCampMessage) {
      ((SpawnerCampMessage)message).setSpawnerCampMessageEnabled(config.getBoolean("String_Node_Str",false));
    }
  }
  return message;
}

Fixed version (ground truth):
private static Message configureMessage(Message message,ConfigurationSection config){
  if (message != null && config != null) {
    message.setMessageOutputEnabled(config.getBoolean("String_Node_Str",true));
    message.setCoinLoggingEnabled(config.getBoolean("String_Node_Str",true));
    if (message instanceof NoCoinMessageDecorator) {
      ((NoCoinMessageDecorator)message).setNoRewardMessageEnabled(config.getBoolean("String_Node_Str",false));
    }
  }
  return message;
}
Program: 44349
Project: 44349
Buggy source:
public static Set<Rule> parseConfig(ConfigurationSection config){
  Set<Rule> rules=Collections.emptySet();
  if (config != null) {
    SpawnerMobRule rule=new SpawnerMobRule();
    rule.setCanCampSpawner(config.getBoolean("String_Node_Str",false));
    rule.setClearDrops(config.getBoolean("String_Node_Str",true));
    rule.setCampByEntity(config.getBoolean("String_Node_Str",false));
    rule.setMessage(new DefaultMessage(config.getString("String_Node_Str",NO_CAMP_MESSAGE)));
    rules=new HashSet<Rule>();
    rules.add(rule);
  }
  return rules;
}

Fixed version (ground truth):
public static Set<Rule> parseConfig(ConfigurationSection config){
  Set<Rule> rules=Collections.emptySet();
  if (config != null) {
    SpawnerMobRule rule=new SpawnerMobRule();
    rule.setCanCampSpawner(config.getBoolean("String_Node_Str",false));
    rule.setClearDrops(config.getBoolean("String_Node_Str",true));
    rule.setCampByEntity(config.getBoolean("String_Node_Str",false));
    NoCampMessageDecorator message=new NoCampMessageDecorator(new DefaultMessage(config.getString("String_Node_Str",NO_CAMP_MESSAGE)));
    message.setSpawnerCampMessageEnabled(config.getBoolean("String_Node_Str",false));
    rule.setMessage(message);
    rules=new HashSet<Rule>();
    rules.add(rule);
  }
  return rules;
}
Program: 44350
Project: 44350
Buggy source:
public AbstractRewardSource(ConfigurationSection config){
  if (config == null) {
    throw new IllegalArgumentException("String_Node_Str");
  }
  name=config.getName();
  itemDrops=ItemDrop.parseConfig(config);
  entityDrops=EntityDrop.parseConfig(config);
  coin=CoinDrop.parseConfig(config);
  coinRewardMessage=new DefaultMessage(config.getString("String_Node_Str",COIN_REWARD_MESSAGE));
  coinPenaltyMessage=new DefaultMessage(config.getString("String_Node_Str",COIN_PENALTY_MESSAGE));
  noCoinRewardMessage=new NoCoinRewardMessage(config.getString("String_Node_Str",NO_COIN_REWARD_MESSAGE));
}

Fixed version (ground truth):
public AbstractRewardSource(ConfigurationSection config){
  if (config == null) {
    throw new IllegalArgumentException("String_Node_Str");
  }
  name=config.getName();
  itemDrops=ItemDrop.parseConfig(config);
  entityDrops=EntityDrop.parseConfig(config);
  coin=CoinDrop.parseConfig(config);
  coinRewardMessage=new DefaultMessage(config.getString("String_Node_Str",COIN_REWARD_MESSAGE));
  coinPenaltyMessage=new DefaultMessage(config.getString("String_Node_Str",COIN_PENALTY_MESSAGE));
  noCoinRewardMessage=new NoCoinMessageDecorator(new DefaultMessage(config.getString("String_Node_Str",NO_COIN_REWARD_MESSAGE)));
}
Program: 44351
Project: 44351
Buggy source:
private double calculateAmount(Reward reward){
  double amount=reward.getCoin() * reward.getGain();
  ECLogger.getInstance().debug("String_Node_Str" + amount);
  amount/=reward.hasParty() ? reward.getParty().size() : 1;
  if (reward.getParty().size() > 1) {
    amount/=reward.getParty().size();
    ECLogger.getInstance().debug("String_Node_Str" + amount);
  }
  if (reward.isIntegerCurrency()) {
    ECLogger.getInstance().debug("String_Node_Str" + amount);
    amount=Math.round(amount);
  }
  return amount;
}

Fixed version (ground truth):
private double calculateAmount(Reward reward){
  double amount=reward.getCoin() * reward.getGain();
  ECLogger.getInstance().debug("String_Node_Str" + amount);
  if (reward.getParty().size() > 1) {
    amount/=reward.getParty().size();
    ECLogger.getInstance().debug("String_Node_Str" + amount);
  }
  if (reward.isIntegerCurrency()) {
    ECLogger.getInstance().debug("String_Node_Str" + amount);
    amount=Math.round(amount);
  }
  return amount;
}
Program: 44352
Project: 44352
Buggy source:
public static List<EntityDrop> parseConfig(ConfigurationSection config){
  List<EntityDrop> drops=Collections.emptyList();
  if (config != null) {
    drops=new ArrayList<EntityDrop>();
    if (config.getList("String_Node_Str") != null) {
      List<String> dropsList=config.getStringList("String_Node_Str");
      drops=EntityDrop.parseDrops(dropsList);
    }
 else {
      drops=EntityDrop.parseDrops(config.getString("String_Node_Str"));
    }
    EntityDrop exp=parseExpConfig(config);
    if (exp != null) {
      drops.add(exp);
    }
  }
  return drops;
}

Fixed version (ground truth):
public static List<EntityDrop> parseConfig(ConfigurationSection config){
  List<EntityDrop> drops=Collections.emptyList();
  if (config != null) {
    drops=new ArrayList<EntityDrop>();
    if (config.getList("String_Node_Str") != null) {
      List<String> dropsList=config.getStringList("String_Node_Str");
      drops.addAll(EntityDrop.parseDrops(dropsList));
    }
 else {
      drops.addAll(EntityDrop.parseDrops(config.getString("String_Node_Str")));
    }
    EntityDrop exp=parseExpConfig(config);
    if (exp != null) {
      drops.add(exp);
    }
  }
  return drops;
}
Program: 44353
Project: 44353
Buggy source:
public Set<String> getParty(Player player){
  Set<String> players=Collections.emptySet();
  for (  Party party : parties) {
    players=new HashSet<String>();
    if (party.isShared()) {
      players.addAll(party.getPlayers(player));
    }
  }
  return players;
}

Fixed version (ground truth):
public Set<String> getParty(Player player){
  Set<String> players=new HashSet<String>();
  for (  Party party : parties) {
    if (party.isShared()) {
      players.addAll(party.getPlayers(player));
    }
  }
  return players;
}
Program: 44355
Project: 44355
Buggy source:
private FileConfiguration getConfig(File file) throws IOException, InvalidConfigurationException {
  FileConfiguration config=new YamlConfiguration();
  if (!file.exists()) {
    file.getParentFile().mkdir();
    file.createNewFile();
    InputStream inputStream=plugin.getResource(file.getName());
    FileOutputStream outputStream=new FileOutputStream(file);
    byte[] buffer=new byte[8192];
    int length=0;
    while ((length=inputStream.read(buffer)) > 0) {
      outputStream.write(buffer,0,length);
    }
    inputStream.close();
    outputStream.close();
    ECLogger.getInstance().info("String_Node_Str" + file.getName());
  }
 else {
    ECLogger.getInstance().severe("String_Node_Str");
  }
  config.load(file);
  config.setDefaults(YamlConfiguration.loadConfiguration(plugin.getResource(file.getName())));
  config.options().copyDefaults(true);
  return config;
}

Fixed version (ground truth):
private FileConfiguration getConfig(File file) throws IOException, InvalidConfigurationException {
  FileConfiguration config=new YamlConfiguration();
  if (!file.exists()) {
    file.getParentFile().mkdir();
    file.createNewFile();
    InputStream inputStream=plugin.getResource(file.getName());
    FileOutputStream outputStream=new FileOutputStream(file);
    byte[] buffer=new byte[8192];
    int length=0;
    while ((length=inputStream.read(buffer)) > 0) {
      outputStream.write(buffer,0,length);
    }
    inputStream.close();
    outputStream.close();
    ECLogger.getInstance().info("String_Node_Str" + file.getName());
  }
 else {
    ECLogger.getInstance().info("String_Node_Str" + file.getName());
  }
  config.load(file);
  config.setDefaults(YamlConfiguration.loadConfiguration(plugin.getResource(DEFAULT_FILE)));
  config.options().copyDefaults(true);
  return config;
}
Program: 44356
Project: 44356
Buggy source:
public PluginConfig(ecoCreature plugin){
  this.plugin=plugin;
  loaded=false;
  dataWorldsFolder=new File(plugin.getDataFolder(),"String_Node_Str");
  dataWorldsFolder.mkdirs();
  try {
    load();
    loaded=true;
  }
 catch (  IOException ioe) {
    ECLogger.getInstance().severe("String_Node_Str" + ioe.toString());
  }
catch (  InvalidConfigurationException ice) {
    ECLogger.getInstance().severe("String_Node_Str" + ice.toString());
  }
}

Fixed version (ground truth):
public PluginConfig(ecoCreature plugin){
  this.plugin=plugin;
  dataWorldsFolder=new File(plugin.getDataFolder(),"String_Node_Str");
  dataWorldsFolder.mkdirs();
  initialized=initConfig();
}
Program: 44357
Project: 44357
Buggy source:
public void onEnable(){
  DependencyUtils.init();
  metrics=new RewardMetrics(this);
  pluginConfig=new PluginConfig(this);
  if (pluginConfig.isLoaded()) {
    addCommands();
    registerEvents();
    new UpdateTask(this);
    ECLogger.getInstance().info(getDescription().getVersion() + "String_Node_Str");
  }
 else {
    Bukkit.getPluginManager().disablePlugin(this);
  }
}

Fixed version (ground truth):
public void onEnable(){
  DependencyUtils.init();
  metrics=new RewardMetrics(this);
  pluginConfig=new PluginConfig(this);
  if (pluginConfig.isInitialized()) {
    addCommands();
    registerEvents();
    new UpdateTask(this);
    ECLogger.getInstance().info(getDescription().getVersion() + "String_Node_Str");
  }
 else {
    Bukkit.getPluginManager().disablePlugin(this);
  }
}
Program: 44358
Project: 44358
Buggy source:
@Override public void onDisable(){
  getServer().getScheduler().cancelTasks(this);
  pluginConfig.save();
  ECLogger.getInstance().info(getDescription().getVersion() + "String_Node_Str");
}

Fixed version (ground truth):
@Override public void onDisable(){
  getServer().getScheduler().cancelTasks(this);
  ECLogger.getInstance().info(getDescription().getVersion() + "String_Node_Str");
}
Program: 44359
Project: 44359
Buggy source:
private static WorldSettings loadWorldSettings(FileConfiguration config){
  WorldSettings settings=new WorldSettings();
  settings.setClearDefaultDrops(config.getBoolean("String_Node_Str",true));
  settings.setOverrideDrops(config.getBoolean("String_Node_Str",true));
  settings.setNoFarm(config.getBoolean("String_Node_Str",false));
  settings.setNoFarmFire(config.getBoolean("String_Node_Str",false));
  settings.setGainMultipliers(loadGainMultipliers(config));
  settings.setParties(loadParties(config));
  settings.setHuntingRules(loadHuntingRules(config));
  settings.setMaterialSources(loadMaterialSources(config));
  settings.setEntitySources(loadEntitySources(config));
  settings.setCustomSources(loadCustomSources(config));
  return settings;
}

Fixed version (ground truth):
private static WorldSettings loadWorldSettings(FileConfiguration config){
  WorldSettings settings=new WorldSettings();
  settings.setClearOnNoDrops(config.getBoolean("String_Node_Str",true));
  settings.setOverrideDrops(config.getBoolean("String_Node_Str",true));
  settings.setNoFarm(config.getBoolean("String_Node_Str",false));
  settings.setNoFarmFire(config.getBoolean("String_Node_Str",false));
  settings.setGainMultipliers(loadGainMultipliers(config));
  settings.setParties(loadParties(config));
  settings.setHuntingRules(loadHuntingRules(config));
  settings.setMaterialSources(loadMaterialSources(config));
  settings.setEntitySources(loadEntitySources(config));
  settings.setCustomSources(loadCustomSources(config));
  return settings;
}
Program: 44360
Project: 44360
Buggy source:
private Set<RewardEvent> getRewardEvents(EntityKilledEvent event){
  Set<RewardEvent> events=new HashSet<RewardEvent>();
  Player killer=event.getKiller();
  WorldSettings settings=plugin.getWorldSettings(killer.getWorld());
  if (settings.hasRewardSource(event)) {
    Reward outcome=settings.getRewardSource(event).getOutcome(event);
    outcome.setGain(settings.getGainMultiplier(killer));
    outcome.setParty(settings.getParty(killer));
    outcome.getMessage().addParameter(MessageToken.CREATURE,outcome.getName());
    outcome.getMessage().addParameter(MessageToken.ITEM,event.getWeaponName());
    if (outcome.getEntityDrops().contains(EntityType.EXPERIENCE_ORB)) {
      event.setDroppedExp(0);
    }
    if (settings.isOverrideDrops()) {
      event.getDrops().clear();
    }
    events.add(new RewardEvent(killer,outcome));
  }
  return events;
}

Fixed version (ground truth):
private Set<RewardEvent> getRewardEvents(EntityKilledEvent event){
  Set<RewardEvent> events=new HashSet<RewardEvent>();
  Player killer=event.getKiller();
  WorldSettings settings=plugin.getWorldSettings(killer.getWorld());
  if (settings.hasRewardSource(event)) {
    Reward outcome=settings.getRewardSource(event).getOutcome(event);
    outcome.setGain(settings.getGainMultiplier(killer));
    outcome.setParty(settings.getParty(killer));
    outcome.getMessage().addParameter(MessageToken.CREATURE,outcome.getName());
    outcome.getMessage().addParameter(MessageToken.ITEM,event.getWeaponName());
    if (settings.isOverrideDrops() || (settings.isClearOnNoDrops() && !outcome.hasDrops())) {
      event.getDrops().clear();
    }
    if (outcome.getEntityDrops().contains(EntityType.EXPERIENCE_ORB)) {
      event.setDroppedExp(0);
    }
    events.add(new RewardEvent(killer,outcome));
  }
  return events;
}
Program: 44361
Project: 44361
Buggy source:
@EventHandler(priority=EventPriority.NORMAL) public void onEntityDeath(EntityDeathEvent event){
  if (event instanceof PlayerDeathEvent) {
    return;
  }
  handleDefaultDrops(event);
  if (EventUtils.getKillerFromDeathEvent(event) != null) {
    for (    RewardEvent rewardEvent : handler.getRewardEvents(EntityKilledEvent.createEvent(event))) {
      Bukkit.getPluginManager().callEvent(rewardEvent);
    }
  }
 else {
    handleNoFarm(event);
  }
}

Fixed version (ground truth):
@EventHandler(priority=EventPriority.NORMAL) public void onEntityDeath(EntityDeathEvent event){
  if (event instanceof PlayerDeathEvent) {
    return;
  }
  if (EventUtils.getKillerFromDeathEvent(event) != null) {
    for (    RewardEvent rewardEvent : handler.getRewardEvents(EntityKilledEvent.createEvent(event))) {
      Bukkit.getPluginManager().callEvent(rewardEvent);
    }
  }
 else {
    handleNoFarm(event);
  }
}
Program: 44362
Project: 44362
Buggy source:
public boolean hasDrops(){
  return !itemDrops.isEmpty();
}

Fixed version (ground truth):
public boolean hasDrops(){
  return !itemDrops.isEmpty() && !entityDrops.isEmpty();
}
Program: 44363
Project: 44363
Buggy source:
@Override public Set<String> getPlayers(Player player){
  Set<String> party=new HashSet<String>();
  if (DependencyUtils.hasMcMMO() && PartyAPI.inParty(player)) {
    for (    Player member : PartyAPI.getOnlineMembers(player)) {
      party.add(member.getName());
    }
  }
  return party;
}

Fixed version (ground truth):
@Override public Set<String> getPlayers(Player player){
  Set<String> party=new HashSet<String>();
  if (DependencyUtils.hasMcMMO() && PartyAPI.inParty(player)) {
    List<Player> members=PartyAPI.getOnlineMembers(player);
    if (members != null) {
      for (      Player member : members) {
        party.add(member.getName());
      }
    }
  }
  return party;
}
Program: 44364
Project: 44364
Buggy source:
public Reward(Location location){
  this.location=location;
  gain=1.0;
  party=new HashSet<String>();
  integerCurrency=false;
  name=CustomType.UNKNOWN.getName();
  coin=0.0;
  itemDrops=new ArrayList<ItemStack>();
  entityDrops=new ArrayList<EntityType>();
  message=new DefaultMessage();
}

Fixed version (ground truth):
public Reward(Location location){
  this.location=location;
  gain=1.0;
  party=new HashSet<String>();
  integerCurrency=false;
  name="String_Node_Str";
  coin=0.0;
  itemDrops=new ArrayList<ItemStack>();
  entityDrops=new ArrayList<EntityType>();
  message=new DefaultMessage();
}
Program: 44365
Project: 44365
Buggy source:
public static Set<Rule> parseConfig(ConfigurationSection config){
  Set<Rule> rules=new HashSet<Rule>();
  if (config != null) {
    SpawnerDistanceRule rule=new SpawnerDistanceRule();
    rule.setCanCampSpawner(config.getBoolean("String_Node_Str",false));
    rule.setClearDropsEnabled(config.getBoolean("String_Node_Str",true));
    rule.setCampByDistance(config.getBoolean("String_Node_Str",true));
    rule.setCampRadius(config.getInt("String_Node_Str",16));
    rule.setMessage(new DefaultMessage(config.getString("String_Node_Str",NO_CAMP_MESSAGE)));
    rules.add(rule);
  }
  return rules;
}

Fixed version (ground truth):
public static Set<Rule> parseConfig(ConfigurationSection config){
  Set<Rule> rules=new HashSet<Rule>();
  if (config != null) {
    SpawnerDistanceRule rule=new SpawnerDistanceRule();
    rule.setCanCampSpawner(config.getBoolean("String_Node_Str",false));
    rule.setClearDrops(config.getBoolean("String_Node_Str",true));
    rule.setCampByDistance(config.getBoolean("String_Node_Str",true));
    rule.setCampRadius(config.getInt("String_Node_Str",16));
    rule.setMessage(new DefaultMessage(config.getString("String_Node_Str",NO_CAMP_MESSAGE)));
    rules.add(rule);
  }
  return rules;
}
Program: 44366
Project: 44366
Buggy source:
public static Set<Rule> parseConfig(ConfigurationSection config){
  Set<Rule> rules=new HashSet<Rule>();
  if (config != null) {
    SpawnerMobRule rule=new SpawnerMobRule();
    rule.setCanCampSpawner(config.getBoolean("String_Node_Str",false));
    rule.setClearDropsEnabled(config.getBoolean("String_Node_Str",true));
    rule.setCampByEntity(config.getBoolean("String_Node_Str",false));
    rule.setMessage(new DefaultMessage(config.getString("String_Node_Str",NO_CAMP_MESSAGE)));
    rules.add(rule);
  }
  return rules;
}

Fixed version (ground truth):
public static Set<Rule> parseConfig(ConfigurationSection config){
  Set<Rule> rules=new HashSet<Rule>();
  if (config != null) {
    SpawnerMobRule rule=new SpawnerMobRule();
    rule.setCanCampSpawner(config.getBoolean("String_Node_Str",false));
    rule.setClearDrops(config.getBoolean("String_Node_Str",true));
    rule.setCampByEntity(config.getBoolean("String_Node_Str",false));
    rule.setMessage(new DefaultMessage(config.getString("String_Node_Str",NO_CAMP_MESSAGE)));
    rules.add(rule);
  }
  return rules;
}
Program: 44367
Project: 44367
Buggy source:
public BasicMessage(MessageManager messageManager){
  this.messageManager=messageManager;
}

Fixed version (ground truth):
public BasicMessage(MessageManager messageManager){
  this.messageManager=messageManager;
  parameters=new HashMap<MessageToken,String>();
}
Program: 44368
Project: 44368
Buggy source:
@Override public void send(){
  for (  MessageToken token : parameters.keySet()) {
    if (token == MessageToken.AMOUNT_TOKEN) {
      template.replaceAll(token.toString(),parameters.get(token).replaceAll("String_Node_Str","String_Node_Str"));
    }
 else     if (token == MessageToken.ITEM_TOKEN) {
      template.replaceAll(token.toString(),toCamelCase(parameters.get(token)));
    }
 else {
      template.replaceAll(token.toString(),parameters.get(token));
    }
  }
  if (messageManager.shouldOutputMessages && parameters.containsKey(MessageToken.PLAYER_TOKEN)) {
    Bukkit.getPlayer(parameters.get(MessageToken.PLAYER_TOKEN)).sendMessage(template);
  }
  if (messageManager.shouldLogCoinRewards && parameters.containsKey(MessageToken.AMOUNT_TOKEN)) {
    ecoCreature.getECLogger().info(removeColorCodes(template));
  }
}

Fixed version (ground truth):
@Override public void send(){
  for (  MessageToken token : parameters.keySet()) {
    if (token == MessageToken.AMOUNT_TOKEN) {
      template=template.replaceAll(token.toString(),parameters.get(token).replaceAll("String_Node_Str","String_Node_Str"));
    }
 else     if (token == MessageToken.ITEM_TOKEN) {
      template=template.replaceAll(token.toString(),toCamelCase(parameters.get(token)));
    }
 else {
      template=template.replaceAll(token.toString(),parameters.get(token));
    }
  }
  if (messageManager.shouldOutputMessages && parameters.containsKey(MessageToken.PLAYER_TOKEN)) {
    Bukkit.getPlayer(parameters.get(MessageToken.PLAYER_TOKEN)).sendMessage(template);
  }
  if (messageManager.shouldLogCoinRewards && parameters.containsKey(MessageToken.AMOUNT_TOKEN)) {
    ecoCreature.getECLogger().info(removeColorCodes(template));
  }
}
Program: 44369
Project: 44369
Buggy source:
public String getWeaponName(){
  return usedTamedCreature() ? RewardType.fromEntity(getTamedCreature()).getName() : getWeapon().name();
}

Fixed version (ground truth):
public String getWeaponName(){
  return usedTamedCreature() ? RewardType.fromEntity(getTamedCreature()).getName() : EntityUtils.getItemNameInHand(getPlayer());
}
Program: 44370
Project: 44370
Buggy source:
public String getWeaponName(){
  return getWeapon().name();
}

Fixed version (ground truth):
public String getWeaponName(){
  return EntityUtils.getItemNameInHand(getKiller());
}
Program: 44371
Project: 44371
Buggy source:
public void registerDeathPenalty(Player player){
  if (!hasDeathPenalty || !DependencyUtils.hasPermission(player,"String_Node_Str") || !DependencyUtils.hasEconomy()) {
    return;
  }
  double amount=isPercentPenalty ? DependencyUtils.getEconomy().getBalance(player.getName()) * (penaltyAmount / 100.0D) : penaltyAmount;
  if (amount > 0.0D) {
    DependencyUtils.getEconomy().withdrawPlayer(player.getName(),amount);
    messageManager.deathPenaltyMessage(messageManager.deathPenaltyMessage,player,amount);
  }
}

Fixed version (ground truth):
public void registerDeathPenalty(Player player){
  if (!hasDeathPenalty || !DependencyUtils.hasPermission(player,"String_Node_Str") || !DependencyUtils.hasEconomy()) {
    return;
  }
  double amount=isPercentPenalty ? DependencyUtils.getEconomy().getBalance(player.getName()) * (penaltyAmount / 100.0D) : penaltyAmount;
  if (isIntegerCurrency) {
    amount=Math.round(amount);
  }
  if (amount > 0.0D) {
    DependencyUtils.getEconomy().withdrawPlayer(player.getName(),amount);
    messageManager.deathPenaltyMessage(messageManager.deathPenaltyMessage,player,amount);
  }
}
Program: 44372
Project: 44372
Buggy source:
public void registerSpawnerBreak(Player player,Block block){
  if (player == null || block == null) {
    return;
  }
  if (!block.getType().equals(Material.MOB_SPAWNER)) {
    return;
  }
  if (DependencyUtils.hasPermission(player,"String_Node_Str") && rewards.containsKey(RewardType.SPAWNER)) {
    if (hasReward(RewardType.SPAWNER)) {
      Reward reward=getRewardForType(RewardType.SPAWNER);
      registerReward(player,reward,Material.getMaterial(player.getItemInHand().getTypeId()).name());
      for (      ItemStack itemStack : reward.getDropAmounts(isFixedDrops)) {
        block.getWorld().dropItemNaturally(block.getLocation(),itemStack);
      }
    }
  }
}

Fixed version (ground truth):
public void registerSpawnerBreak(Player player,Block block){
  if (player == null || block == null) {
    return;
  }
  if (!block.getType().equals(Material.MOB_SPAWNER)) {
    return;
  }
  if (DependencyUtils.hasPermission(player,"String_Node_Str") && rewards.containsKey(RewardType.SPAWNER)) {
    if (hasReward(RewardType.SPAWNER)) {
      Reward reward=getRewardForType(RewardType.SPAWNER);
      registerReward(player,reward,EntityUtils.getItemNameInHand(player));
      for (      ItemStack itemStack : reward.getDropAmounts(isFixedDrops)) {
        block.getWorld().dropItemNaturally(block.getLocation(),itemStack);
      }
    }
  }
}
Program: 44374
Project: 44374
Buggy source:
public void registerPVPReward(PlayerKilledByPlayerEvent event){
  if (!hasPVPReward || !DependencyUtils.hasPermission(event.getKiller(),"String_Node_Str")) {
    return;
  }
  double amount=0.0D;
  if (hasReward(RewardType.PLAYER)) {
    Reward reward=getRewardForType(RewardType.PLAYER);
    amount=reward.getCoin().getAmount() * getGainMultiplier(event.getKiller());
    if (reward.hasDrops() && shouldOverrideDrops) {
      event.getDrops().clear();
    }
    event.getDrops().addAll(reward.getDropAmounts(isFixedDrops));
    if (reward.hasExp()) {
      event.setDroppedExp(reward.getExp().getAmount());
    }
  }
 else   if (DependencyUtils.hasEconomy()) {
    amount=isPercentPvpReward ? DependencyUtils.getEconomy().getBalance(event.getVictim().getName()) * (pvpRewardAmount / 100.0D) : pvpRewardAmount;
  }
  if (amount > 0.0D && DependencyUtils.hasEconomy()) {
    amount=Math.min(amount,DependencyUtils.getEconomy().getBalance(event.getVictim().getName()));
    DependencyUtils.getEconomy().withdrawPlayer(event.getVictim().getName(),amount);
    messageManager.deathPenaltyMessage(messageManager.deathPenaltyMessage,event.getVictim(),amount);
    DependencyUtils.getEconomy().depositPlayer(event.getKiller().getName(),amount);
    messageManager.rewardMessage(messageManager.pvpRewardMessage,event.getKiller(),amount,event.getVictim().getName(),event.getWeaponName());
  }
}

Fixed version (ground truth):
public void registerPVPReward(PlayerKilledByPlayerEvent event){
  if (!hasPVPReward || !DependencyUtils.hasPermission(event.getKiller(),"String_Node_Str")) {
    return;
  }
  double amount=0.0D;
  if (hasReward(RewardType.PLAYER)) {
    Reward reward=getRewardForType(RewardType.PLAYER);
    amount=reward.getCoin().getAmount() * getGainMultiplier(event.getKiller());
    if (reward.hasDrops() && shouldOverrideDrops) {
      event.getDrops().clear();
    }
    event.getDrops().addAll(reward.getDropAmounts(isFixedDrops));
    if (reward.hasExp()) {
      event.setDroppedExp(reward.getExp().getAmount());
    }
  }
 else   if (DependencyUtils.hasEconomy()) {
    amount=isPercentPvpReward ? DependencyUtils.getEconomy().getBalance(event.getVictim().getName()) * (pvpRewardAmount / 100.0D) : pvpRewardAmount;
  }
  if (isIntegerCurrency) {
    amount=Math.round(amount);
  }
  if (amount > 0.0D && DependencyUtils.hasEconomy()) {
    amount=Math.min(amount,DependencyUtils.getEconomy().getBalance(event.getVictim().getName()));
    DependencyUtils.getEconomy().withdrawPlayer(event.getVictim().getName(),amount);
    messageManager.deathPenaltyMessage(messageManager.deathPenaltyMessage,event.getVictim(),amount);
    DependencyUtils.getEconomy().depositPlayer(event.getKiller().getName(),amount);
    messageManager.rewardMessage(messageManager.pvpRewardMessage,event.getKiller(),amount,event.getVictim().getName(),event.getWeaponName());
  }
}