Program: 172819
Project: 172819
Buggy source:
@Listener public void onChatMessage(MessageChannelEvent.Chat event,@Root Player player){
  Optional<Faction> optionalPlayerFaction=FactionLogic.getFactionByPlayerUUID(player.getUniqueId());
  if (optionalPlayerFaction.isPresent()) {
    MessageChannel messageChannel=event.getOriginalChannel();
    Faction playerFaction=optionalPlayerFaction.get();
    Text.Builder formattedMessage=Text.builder();
    Text.Builder factionAndRankPrefix=Text.builder();
    Text.Builder otherPrefixesAndPlayer=Text.builder();
    Text.Builder message=Text.builder();
    otherPrefixesAndPlayer.append(event.getMessage().getChildren().get(0));
    if (EagleFactions.ChatList.containsKey(player.getUniqueId())) {
      Text.Builder chatTypePrefix=Text.builder();
      if (EagleFactions.ChatList.get(player.getUniqueId()).equals(ChatEnum.Alliance)) {
        message.append(Text.of(TextColors.BLUE,event.getRawMessage()));
        chatTypePrefix.append(getAlliancePrefix());
        messageChannel.asMutable().clearMembers();
        Set<MessageReceiver> receivers=new HashSet<>();
        for (        String allianceName : playerFaction.Alliances) {
          receivers.addAll(FactionLogic.getOnlinePlayers(FactionLogic.getFactionByName(allianceName)));
        }
        receivers.addAll(FactionLogic.getOnlinePlayers(playerFaction));
        messageChannel=MessageChannel.fixed(receivers);
      }
 else       if (EagleFactions.ChatList.get(player.getUniqueId()).equals(ChatEnum.Faction)) {
        message.append(Text.of(TextColors.GREEN,event.getRawMessage()));
        chatTypePrefix.append(getFactionPrefix());
        messageChannel.asMutable().clearMembers();
        Set<MessageReceiver> receivers=new HashSet<>();
        receivers.addAll(FactionLogic.getOnlinePlayers(playerFaction));
        messageChannel=MessageChannel.fixed(receivers);
      }
      formattedMessage.append(chatTypePrefix.build());
    }
 else {
      message.append(event.getMessage().getChildren().get(1));
    }
    if (MainLogic.getPrefixOption().equals("String_Node_Str")) {
      if (!playerFaction.Tag.toPlainSingle().equals("String_Node_Str")) {
        if (MainLogic.areColoredTagsAllowed()) {
          Text factionTag=Text.builder().append(MainLogic.getFactionPrefixStart(),playerFaction.Tag,MainLogic.getFactionPrefixEnd()).build();
          factionAndRankPrefix.append(factionTag);
        }
 else {
          Text factionTag=Text.builder().append(MainLogic.getFactionPrefixStart(),Text.of(TextColors.GREEN,playerFaction.Tag),MainLogic.getFactionPrefixEnd()).build();
          factionAndRankPrefix.append(factionTag);
        }
      }
    }
 else     if (MainLogic.getPrefixOption().equals("String_Node_Str")) {
      Text factionNamePrefix=Text.builder().append(MainLogic.getFactionPrefixStart(),Text.of(TextColors.GREEN,playerFaction.Name,TextColors.RESET),MainLogic.getFactionPrefixEnd()).build();
      factionAndRankPrefix.append(factionNamePrefix);
    }
    if (MainLogic.shouldDisplayRank()) {
      if (playerFaction.Leader.equals(player.getUniqueId().toString())) {
        Text leaderPrefix=Text.builder().append(Text.of("String_Node_Str",TextColors.GOLD,"String_Node_Str",TextColors.RESET,"String_Node_Str")).build();
        factionAndRankPrefix.append(leaderPrefix);
      }
      if (playerFaction.Officers.contains(player.getUniqueId().toString())) {
        Text officerPrefix=Text.builder().append(Text.of("String_Node_Str",TextColors.GOLD,"String_Node_Str",TextColors.RESET,"String_Node_Str")).build();
        factionAndRankPrefix.append(officerPrefix);
      }
    }
    formattedMessage.append(factionAndRankPrefix.build());
    formattedMessage.append(otherPrefixesAndPlayer.build());
    formattedMessage.append(message.build());
    Text messageToPrint=Text.builder().append(formattedMessage.build()).build();
    event.setChannel(messageChannel);
    event.setMessage(messageToPrint);
  }
  return;
}

Fixed version (ground truth):
@Listener public void onChatMessage(MessageChannelEvent.Chat event,@Root Player player){
  Optional<Faction> optionalPlayerFaction=FactionLogic.getFactionByPlayerUUID(player.getUniqueId());
  if (optionalPlayerFaction.isPresent()) {
    MessageChannel messageChannel=event.getOriginalChannel();
    Faction playerFaction=optionalPlayerFaction.get();
    Text.Builder formattedMessage=Text.builder();
    Text.Builder factionAndRankPrefix=Text.builder();
    Text.Builder otherPrefixesAndPlayer=Text.builder();
    Text.Builder factionPrefixText=Text.builder();
    Text.Builder rankPrefixText=Text.builder();
    Text.Builder message=Text.builder();
    otherPrefixesAndPlayer.append(event.getMessage().getChildren().get(0));
    if (EagleFactions.ChatList.containsKey(player.getUniqueId())) {
      Text.Builder chatTypePrefix=Text.builder();
      if (EagleFactions.ChatList.get(player.getUniqueId()).equals(ChatEnum.Alliance)) {
        message.append(Text.of(TextColors.BLUE,event.getRawMessage()));
        chatTypePrefix.append(getAlliancePrefix());
        messageChannel.asMutable().clearMembers();
        Set<MessageReceiver> receivers=new HashSet<>();
        for (        String allianceName : playerFaction.Alliances) {
          receivers.addAll(FactionLogic.getOnlinePlayers(FactionLogic.getFactionByName(allianceName)));
        }
        receivers.addAll(FactionLogic.getOnlinePlayers(playerFaction));
        messageChannel=MessageChannel.fixed(receivers);
      }
 else       if (EagleFactions.ChatList.get(player.getUniqueId()).equals(ChatEnum.Faction)) {
        message.append(Text.of(TextColors.GREEN,event.getRawMessage()));
        chatTypePrefix.append(getFactionPrefix());
        messageChannel.asMutable().clearMembers();
        Set<MessageReceiver> receivers=new HashSet<>();
        receivers.addAll(FactionLogic.getOnlinePlayers(playerFaction));
        messageChannel=MessageChannel.fixed(receivers);
      }
      formattedMessage.append(chatTypePrefix.build());
    }
 else {
      message.append(event.getMessage().getChildren().get(1));
    }
    if (MainLogic.getPrefixOption().equals("String_Node_Str")) {
      if (!playerFaction.Tag.toPlainSingle().equals("String_Node_Str")) {
        if (MainLogic.areColoredTagsAllowed()) {
          Text factionTag=Text.builder().append(MainLogic.getFactionPrefixStart(),playerFaction.Tag,MainLogic.getFactionPrefixEnd()).build();
          factionPrefixText.append(factionTag);
        }
 else {
          Text factionTag=Text.builder().append(MainLogic.getFactionPrefixStart(),Text.of(TextColors.GREEN,playerFaction.Tag),MainLogic.getFactionPrefixEnd()).build();
          factionPrefixText.append(factionTag);
        }
      }
    }
 else     if (MainLogic.getPrefixOption().equals("String_Node_Str")) {
      Text factionNamePrefix=Text.builder().append(MainLogic.getFactionPrefixStart(),Text.of(TextColors.GREEN,playerFaction.Name,TextColors.RESET),MainLogic.getFactionPrefixEnd()).build();
      factionPrefixText.append(factionNamePrefix);
    }
    if (MainLogic.shouldDisplayRank()) {
      if (playerFaction.Leader.equals(player.getUniqueId().toString())) {
        Text leaderPrefix=Text.builder().append(Text.of("String_Node_Str",TextColors.GOLD,"String_Node_Str",TextColors.RESET,"String_Node_Str")).build();
        rankPrefixText.append(leaderPrefix);
      }
      if (playerFaction.Officers.contains(player.getUniqueId().toString())) {
        Text officerPrefix=Text.builder().append(Text.of("String_Node_Str",TextColors.GOLD,"String_Node_Str",TextColors.RESET,"String_Node_Str")).build();
        rankPrefixText.append(officerPrefix);
      }
    }
    if (MainLogic.isFactionPrefixFirstInChat()) {
      factionAndRankPrefix.append(factionPrefixText.build());
      factionAndRankPrefix.append(rankPrefixText.build());
    }
 else {
      factionAndRankPrefix.append(rankPrefixText.build());
      factionAndRankPrefix.append(factionPrefixText.build());
    }
    formattedMessage.append(factionAndRankPrefix.build());
    formattedMessage.append(otherPrefixesAndPlayer.build());
    formattedMessage.append(message.build());
    Text messageToPrint=Text.builder().append(formattedMessage.build()).build();
    event.setChannel(messageChannel);
    event.setMessage(messageToPrint);
  }
  return;
}