Replace direct translation in /allies command with text component, fixes #70

This commit is contained in:
Electroblob77
2019-01-04 20:02:57 +00:00
parent 67dda448f3
commit 83edb8007e
@@ -92,24 +92,20 @@ public class CommandViewAllies extends CommandBase {
if(WizardData.get(player) != null){ if(WizardData.get(player) != null){
String string = ""; Object playerList = null;
Set<String> names = WizardData.get(player).allyNames; Set<String> names = WizardData.get(player).allyNames;
if(!names.isEmpty()){ if(!names.isEmpty()){
for(String name : names){ playerList = joinNiceStringFromCollection(names);
string = string + name + ", ";
}
// Cuts the last " ," off of the string.
string = string.substring(0, string.length() - 2);
}else{ }else{
string = I18n.format("commands." + Wizardry.MODID + ":allies.none"); playerList = new TextComponentTranslation("commands." + Wizardry.MODID + ":allies.none");
} }
if(executeAsOtherPlayer){ if(executeAsOtherPlayer){
sender.sendMessage( sender.sendMessage(
new TextComponentTranslation("commands." + Wizardry.MODID + ":allies.list_other", player.getName(), string)); new TextComponentTranslation("commands." + Wizardry.MODID + ":allies.list_other", player.getName(), playerList));
}else{ }else{
sender.sendMessage(new TextComponentTranslation("commands." + Wizardry.MODID + ":allies.list", string)); sender.sendMessage(new TextComponentTranslation("commands." + Wizardry.MODID + ":allies.list", playerList));
} }
} }
} }