private void generalCustomSoldier() { soldierType = "Custom " + name; soldierDictionary = soldierType.replaceAll("(\\s+)", "_"); String soldierModel = soldier.getSoldier()[0]; List officerTypes = soldier.getOfficers(); try { UnitUtil.modifyBattleFile(unitFaction, soldierModel); if (officerTypes != null && officerTypes.size() > 0) { for (int i = 0; i < officerTypes.size(); i++) { UnitUtil.modifyBattleFile(unitFaction, (String) officerTypes.get(i)); } } } catch (IOException e1) { e1.printStackTrace(); } String horse = soldier.getMount(); if (horse != null) { horse = (String) UnitUtil.getMountTypeToModelMap().get(horse); if (horse != null) { try { UnitUtil.modifyBattleFile(unitFaction, horse); } catch (IOException e) { e.printStackTrace(); } } } if (isGeneralUnit) { if (!soldier.getAttributes().contains("general_unit")) soldier.getAttributes().add("general_unit"); if (!soldier.getAttributes().contains("no_custom")) soldier.getAttributes().add("no_custom"); } else { soldier.getAttributes().remove("general_unit"); soldier.getAttributes().remove("no_custom"); } UnitParser.createSoldier(soldier, this.soldierType, soldierDictionary, unitFaction); setSoldierDescription(soldierDictionary, displayName, description); setSoldierImage(); setSoldierBuilding(); }