From 82189e03edd4be13755e184ebdecba5587d46bd3 Mon Sep 17 00:00:00 2001 From: KingRainbow44 Date: Thu, 1 Jun 2023 21:28:46 -0400 Subject: [PATCH] Add debug command for checking triggers on a group --- .../command/commands/QuestCommand.java | 25 ++++++++++++++++--- 1 file changed, 21 insertions(+), 4 deletions(-) diff --git a/src/main/java/emu/grasscutter/command/commands/QuestCommand.java b/src/main/java/emu/grasscutter/command/commands/QuestCommand.java index 7818933ea..4f5ce7796 100644 --- a/src/main/java/emu/grasscutter/command/commands/QuestCommand.java +++ b/src/main/java/emu/grasscutter/command/commands/QuestCommand.java @@ -1,12 +1,13 @@ package emu.grasscutter.command.commands; -import static emu.grasscutter.utils.lang.Language.translate; - -import emu.grasscutter.command.Command; -import emu.grasscutter.command.CommandHandler; +import emu.grasscutter.command.*; import emu.grasscutter.game.player.Player; import emu.grasscutter.game.quest.GameQuest; + import java.util.List; +import java.util.stream.Collectors; + +import static emu.grasscutter.utils.lang.Language.translate; @Command( label = "quest", @@ -131,6 +132,22 @@ public final class QuestCommand implements CommandHandler { "Triggers registered for %s: %s." .formatted(questId, String.join(", ", quest.getTriggers().keySet()))); } + case "grouptriggers" -> { + var scene = targetPlayer.getScene(); + var scriptManager = scene.getScriptManager(); + + var group = scriptManager.getGroupById(questId); + if (group == null) { + CommandHandler.sendMessage(sender, "The group does not exist."); + return; + } + + CommandHandler.sendMessage(sender, + group.triggers.entrySet().stream() + .map(entry -> "%s: %s".formatted(entry.getKey(), entry.getValue())) + .collect(Collectors.joining(", ")) + ); + } default -> this.sendUsageMessage(sender); } }