From feed688a8992b4345cbb35d4f3805cb780ba0186 Mon Sep 17 00:00:00 2001 From: ChomeNS <95471003+ChomeNS@users.noreply.github.com> Date: Tue, 29 Oct 2024 16:45:25 +0700 Subject: [PATCH] Add FilteredPlayer options info into FilterCommand's list --- .../chomens_bot/commands/FilterCommand.java | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/src/main/java/me/chayapak1/chomens_bot/commands/FilterCommand.java b/src/main/java/me/chayapak1/chomens_bot/commands/FilterCommand.java index 76abbf5..fc597b2 100644 --- a/src/main/java/me/chayapak1/chomens_bot/commands/FilterCommand.java +++ b/src/main/java/me/chayapak1/chomens_bot/commands/FilterCommand.java @@ -101,11 +101,25 @@ public class FilterCommand extends Command { for (JsonElement playerElement : FilterPlugin.filteredPlayers) { final FilteredPlayer player = gson.fromJson(playerElement, FilteredPlayer.class); + Component options = Component.empty().color(NamedTextColor.DARK_GRAY); + + if (player.ignoreCase || player.regex) { + final List args = new ArrayList<>(); + + if (player.ignoreCase) args.add(Component.text("ignore case")); + if (player.regex) args.add(Component.text("regex")); + + options = options.append(Component.text("(")); + options = options.append(Component.join(JoinConfiguration.commas(true), args).color(ColorUtilities.getColorByString(bot.config.colorPalette.string))); + options = options.append(Component.text(")")); + } + filtersComponents.add( Component.translatable( - "%s › %s", + "%s › %s %s", Component.text(index).color(ColorUtilities.getColorByString(bot.config.colorPalette.number)), - Component.text(player.playerName).color(ColorUtilities.getColorByString(bot.config.colorPalette.username)) + Component.text(player.playerName).color(ColorUtilities.getColorByString(bot.config.colorPalette.username)), + options ).color(NamedTextColor.DARK_GRAY) );