Skip to content

Commit

Permalink
Add debug command for checking triggers on a group
Browse files Browse the repository at this point in the history
  • Loading branch information
KingRainbow44 committed Jun 2, 2023
1 parent cef8b53 commit 82189e0
Showing 1 changed file with 21 additions and 4 deletions.
25 changes: 21 additions & 4 deletions src/main/java/emu/grasscutter/command/commands/QuestCommand.java
Original file line number Diff line number Diff line change
@@ -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",
Expand Down Expand Up @@ -131,6 +132,22 @@ public void execute(Player sender, Player targetPlayer, List<String> args) {
"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);
}
}
Expand Down

0 comments on commit 82189e0

Please sign in to comment.