diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/FlagCmd.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/FlagCmd.java index 35888fdde..18976edac 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/FlagCmd.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/FlagCmd.java @@ -300,15 +300,19 @@ public class FlagCmd extends SubCommand { flags.computeIfAbsent(category, k -> new ArrayList<>()); flagList.add(flag1.getName()); } - StringBuilder message = new StringBuilder(); - String prefix = ""; - for (Map.Entry> entry : flags.entrySet()) { - String category = entry.getKey(); - List flagNames = entry.getValue(); + + final StringBuilder message = new StringBuilder(); + final Iterator>> iterator = + flags.entrySet().iterator(); + while (iterator.hasNext()) { + final Map.Entry> flagsEntry = iterator.next(); + final List flagNames = flagsEntry.getValue(); Collections.sort(flagNames); - message.append(prefix).append("&6").append(category).append(": &7") - .append(StringMan.join(flagNames, ", ")); - prefix = "\n"; + message.append(String.format(Captions.FLAG_LIST_ENTRY.formatted(), + flagsEntry.getKey(), StringMan.join(flagNames, ", "))); + if (iterator.hasNext()) { + message.append("\n"); + } } MainUtil.sendMessage(player, message.toString()); return true; diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/config/Captions.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/config/Captions.java index d0e386ea3..f148d445b 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/config/Captions.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/config/Captions.java @@ -532,7 +532,24 @@ public enum Captions { FLAG_REMOVED("$4Successfully removed flag", "Flag"), FLAG_ADDED("$4Successfully added flag", "Flag"), FLAG_TUTORIAL_USAGE("$1Have an admin set the flag: $2%s", "CommandConfig"), + FLAG_LIST_ENTRY("$2%s: $1%s", "Flag"), // + // + FLAG_CATEGORY_STRING("String Flags", "Flags"), + FLAG_CATEGORY_INTEGERS("Integer Flags", "Flags"), + FLAG_CATEGORY_TELEPORT_DENY("Teleport Deny Flag", "Flags"), + FLAG_CATEGORY_STRING_LIST("String List Flags", "Flags"), + FLAG_CATEGORY_WEATHER("Weather Flags", "Flags"), + FLAG_CATEGORY_BLOCK_LIST("Material Flags", "Flags"), + FLAG_CATEGORY_INTERVALS("Interval Flags", "Flags"), + FLAG_CATEGORY_INTEGER_LIST("Integer List Flags", "Flags"), + FLAG_CATEGORY_GAMEMODE("Game Mode Flags", "Flags"), + FLAG_CATEGORY_ENUM("Generic Enum Flags", "Flags"), + FLAG_CATEGORY_DECIMAL("Decimal Flags", "Flags"), + FLAG_CATEGORY_BOOLEAN("Boolean Flags", "Flags"), + FLAG_CATEGORY_MIXED("Mixed Value Flags", "Flags"), + // + // TRUSTED_ADDED("$4You successfully trusted a user to the plot", "Trusted"), WAS_NOT_ADDED("$2That player was not trusted on this plot", "Trusted"), @@ -585,22 +602,6 @@ public enum Captions { GRANTED_PLOT_FAILED("$1Grant failed: $2%s", "Grants"), // - // - FLAG_CATEGORY_STRING("String Flags", "Flags"), - FLAG_CATEGORY_INTEGERS("Integer Flags", "Flags"), - FLAG_CATEGORY_TELEPORT_DENY("Teleport Deny Flag", "Flags"), - FLAG_CATEGORY_STRING_LIST("String List Flags", "Flags"), - FLAG_CATEGORY_WEATHER("Weather Flags", "Flags"), - FLAG_CATEGORY_BLOCK_LIST("Material Flags", "Flags"), - FLAG_CATEGORY_INTERVALS("Interval Flags", "Flags"), - FLAG_CATEGORY_INTEGER_LIST("Integer List Flags", "Flags"), - FLAG_CATEGORY_GAMEMODE("Game Mode Flags", "Flags"), - FLAG_CATEGORY_ENUM("Generic Enum Flags", "Flags"), - FLAG_CATEGORY_DECIMAL("Decimal Flags", "Flags"), - FLAG_CATEGORY_BOOLEAN("Boolean Flags", "Flags"), - FLAG_CATEGORY_MIXED("Mixed Value Flags", "Flags"), - // - /** * Legacy Configuration Conversion */