Fix spaces with ", "

Fixes #134
This commit is contained in:
Tibo 2014-11-17 19:32:34 +01:00
parent 4b6ccc7967
commit b970755cb1

View File

@ -89,6 +89,8 @@ public class CmdShow extends FCommand {
FancyMessage allies = new FancyMessage("Allies: ").color(ChatColor.GOLD); FancyMessage allies = new FancyMessage("Allies: ").color(ChatColor.GOLD);
FancyMessage enemies = new FancyMessage("Enemies: ").color(ChatColor.GOLD); FancyMessage enemies = new FancyMessage("Enemies: ").color(ChatColor.GOLD);
boolean firstAlly = true;
boolean firstEnemy = true;
for (Faction otherFaction : Factions.getInstance().getAllFactions()) { for (Faction otherFaction : Factions.getInstance().getAllFactions()) {
if (otherFaction == faction) { if (otherFaction == faction) {
continue; continue;
@ -97,21 +99,39 @@ public class CmdShow extends FCommand {
Relation rel = otherFaction.getRelationTo(faction); Relation rel = otherFaction.getRelationTo(faction);
String s = otherFaction.getTag(fme); String s = otherFaction.getTag(fme);
if (rel.isAlly()) { if (rel.isAlly()) {
if (firstAlly)
allies.then(s).tooltip(getToolTips(otherFaction)); allies.then(s).tooltip(getToolTips(otherFaction));
else
alies.then(", " + s).tooltip(getToolTips(otherFaction));
firstAlly = false;
} else if (rel.isEnemy()) { } else if (rel.isEnemy()) {
if (firstEnemy)
enemies.then(s).tooltip(getToolTips(otherFaction)); enemies.then(s).tooltip(getToolTips(otherFaction));
else
enemies.then(", " + s).tooltip(getToolTips(otherFaction));
firstEnemy = false;
} }
} }
FancyMessage online = new FancyMessage("Members online: ").color(ChatColor.GOLD); FancyMessage online = new FancyMessage("Members online: ").color(ChatColor.GOLD);
FancyMessage offline = new FancyMessage("Members offline: ").color(ChatColor.GOLD); FancyMessage offline = new FancyMessage("Members offline: ").color(ChatColor.GOLD);
boolean firstOnline = true;
boolean firstOffline = true;
for (FPlayer p : faction.getFPlayers()) { for (FPlayer p : faction.getFPlayers()) {
String name = p.getNameAndTitle(); String name = p.getNameAndTitle();
if (p.isOnline()) { if (p.isOnline()) {
if (firstOnline)
online.then(name).tooltip(getToolTips(p)); online.then(name).tooltip(getToolTips(p));
else
online.then(", " + name).tooltip(getToolTips(p));
firstOnline = false;
} else { } else {
if (firstOffline)
offline.then(name).tooltip(getToolTips(p)); offline.then(name).tooltip(getToolTips(p));
else
offline.then(", " + name).tooltip(getToolTips(p));
firstOffline = false;
} }
} }