From 83edb8007e53e6aa6c8dfaaef177541ec6a9a018 Mon Sep 17 00:00:00 2001 From: Electroblob77 <35599699+Electroblob77@users.noreply.github.com> Date: Fri, 4 Jan 2019 20:02:57 +0000 Subject: [PATCH] Replace direct translation in /allies command with text component, fixes #70 --- .../wizardry/command/CommandViewAllies.java | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/src/main/java/electroblob/wizardry/command/CommandViewAllies.java b/src/main/java/electroblob/wizardry/command/CommandViewAllies.java index 8fb54fc8..3bb82a2b 100644 --- a/src/main/java/electroblob/wizardry/command/CommandViewAllies.java +++ b/src/main/java/electroblob/wizardry/command/CommandViewAllies.java @@ -92,24 +92,20 @@ public class CommandViewAllies extends CommandBase { if(WizardData.get(player) != null){ - String string = ""; + Object playerList = null; Set names = WizardData.get(player).allyNames; if(!names.isEmpty()){ - for(String name : names){ - string = string + name + ", "; - } - // Cuts the last " ," off of the string. - string = string.substring(0, string.length() - 2); + playerList = joinNiceStringFromCollection(names); }else{ - string = I18n.format("commands." + Wizardry.MODID + ":allies.none"); + playerList = new TextComponentTranslation("commands." + Wizardry.MODID + ":allies.none"); } if(executeAsOtherPlayer){ 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{ - sender.sendMessage(new TextComponentTranslation("commands." + Wizardry.MODID + ":allies.list", string)); + sender.sendMessage(new TextComponentTranslation("commands." + Wizardry.MODID + ":allies.list", playerList)); } } }