{
// retrieve some entity components
CharData charData = entity.get(CharData.class);
Map<Faction, Integer[]> factionData = entity.get(FactionData.class).factionPoints;
P221_UpdateFaction updateFaction = new P221_UpdateFaction();
updateFaction.init(channel);
updateFaction.setLevel(charData.level);
updateFaction.setMorale(charData.morale);
updateFaction.setExperience(charData.experience);
if (factionData.containsKey(Faction.Kurzick))
{
updateFaction.setKurzickFree(factionData.get(Faction.Kurzick)[0]);
updateFaction.setKurzickTotal(factionData.get(Faction.Kurzick)[1]);
}
if (factionData.containsKey(Faction.Luxon))
{
updateFaction.setLuxonFree(factionData.get(Faction.Luxon)[0]);
updateFaction.setLuxonTotal(factionData.get(Faction.Luxon)[1]);
}
if (factionData.containsKey(Faction.Imperial))
{
updateFaction.setImperialFree(factionData.get(Faction.Imperial)[0]);
updateFaction.setImperialTotal(factionData.get(Faction.Imperial)[1]);
}
if (factionData.containsKey(Faction.Balthazar))
{
updateFaction.setBalthFree(factionData.get(Faction.Balthazar)[0]);
updateFaction.setBalthTotal(factionData.get(Faction.Balthazar)[1]);
}
channel.writeAndFlush(updateFaction);
}