Fix Discord /list command showing tags in output (#5698)

This commit is contained in:
pop4959 2024-02-25 00:06:52 -08:00 committed by GitHub
parent 185b4e266b
commit d4b72c8af6
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 10 additions and 2 deletions

View File

@ -40,6 +40,13 @@ public final class FormatUtil {
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) {

View File

@ -3,6 +3,7 @@ package net.essentialsx.discord.interactions.commands;
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 class ListCommand extends InteractionCommandImpl {
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)));
}
}