diff --git a/Essentials/src/main/java/com/earth2me/essentials/utils/FormatUtil.java b/Essentials/src/main/java/com/earth2me/essentials/utils/FormatUtil.java index 5cc90179310..e911e3a8fda 100644 --- a/Essentials/src/main/java/com/earth2me/essentials/utils/FormatUtil.java +++ b/Essentials/src/main/java/com/earth2me/essentials/utils/FormatUtil.java @@ -40,6 +40,13 @@ public static String stripFormat(final String input) { return ChatColor.stripColor(input); } + public static String stripMiniFormat(final String input) { + if (input == null) { + return null; + } + return AdventureUtil.miniMessage().stripTags(input); + } + //This method is used to simply strip the & convention colour codes public static String stripEssentialsFormat(final String input) { if (input == null) { diff --git a/EssentialsDiscord/src/main/java/net/essentialsx/discord/interactions/commands/ListCommand.java b/EssentialsDiscord/src/main/java/net/essentialsx/discord/interactions/commands/ListCommand.java index 60057bc461a..a34d5299132 100644 --- a/EssentialsDiscord/src/main/java/net/essentialsx/discord/interactions/commands/ListCommand.java +++ b/EssentialsDiscord/src/main/java/net/essentialsx/discord/interactions/commands/ListCommand.java @@ -3,6 +3,7 @@ import com.earth2me.essentials.IEssentials; import com.earth2me.essentials.PlayerList; import com.earth2me.essentials.User; +import com.earth2me.essentials.utils.FormatUtil; import net.essentialsx.api.v2.services.discord.InteractionCommandArgument; import net.essentialsx.api.v2.services.discord.InteractionCommandArgumentType; import net.essentialsx.api.v2.services.discord.InteractionEvent; @@ -45,8 +46,8 @@ public void onCommand(InteractionEvent event) { final StringBuilder stringBuilder = new StringBuilder(); for (final String str : output) { - stringBuilder.append(str).append("\n"); + stringBuilder.append(FormatUtil.stripMiniFormat(str)).append("\n"); } - event.reply(MessageUtil.sanitizeDiscordMarkdown(stringBuilder.substring(0, stringBuilder.length() - 2))); + event.reply(MessageUtil.sanitizeDiscordMarkdown(stringBuilder.substring(0, stringBuilder.length() - 1))); } }