Use StringBuilder, like a sane person

This commit is contained in:
Sauilitired 2019-01-22 19:54:31 +01:00
parent e54f964eca
commit 344a2afeff
No known key found for this signature in database
GPG key ID: C0207FF7EA146678

View file

@ -279,16 +279,17 @@ import java.util.*;
} }
flags.get(type).add(flag1.getName()); flags.get(type).add(flag1.getName());
} }
String message = ""; StringBuilder message = new StringBuilder();
String prefix = ""; String prefix = "";
for (Map.Entry<String, ArrayList<String>> entry : flags.entrySet()) { for (Map.Entry<String, ArrayList<String>> entry : flags.entrySet()) {
String category = entry.getKey(); String category = entry.getKey();
List<String> flagNames = entry.getValue(); List<String> flagNames = entry.getValue();
Collections.sort(flagNames); Collections.sort(flagNames);
message += prefix + "&6" + category + ": &7" + StringMan.join(flagNames, ", "); message.append(prefix).append("&6").append(category).append(": &7")
.append(StringMan.join(flagNames, ", "));
prefix = "\n"; prefix = "\n";
} }
MainUtil.sendMessage(player, message); MainUtil.sendMessage(player, message.toString());
return true; return true;
} }
MainUtil.sendMessage(player, C.COMMAND_SYNTAX, "/plot flag <set|remove|add|list|info>"); MainUtil.sendMessage(player, C.COMMAND_SYNTAX, "/plot flag <set|remove|add|list|info>");