Add declined question handling in CheckCommand

- Implemented tracking of declined questions during checks.
- Updated messaging logic to display declined questions to users.
- Added new translations for decline-related messages.
This commit is contained in:
2025-06-05 23:41:01 +02:00
parent c30f24ab8f
commit 5cc417c43c
3 changed files with 43 additions and 4 deletions
@@ -164,6 +164,14 @@ public class CheckCommand extends SWCommand {
next(sender);
}
@Register(value = "decline", description = "CHECK_HELP_DECLINE")
public void decline(PlayerChatter sender) {
if(notChecking(sender.getPlayer()))
return;
currentCheckers.get(sender.getPlayer().getUniqueId()).markDeclined();
}
@Register(value = "decline", description = "CHECK_HELP_DECLINE")
public void decline(PlayerChatter sender, String... message) {
if(notChecking(sender.getPlayer()))
@@ -200,6 +208,8 @@ public class CheckCommand extends SWCommand {
private final SchematicNode schematic;
private final Timestamp startTime;
private final ListIterator<String> checkList;
private String currentQuestion;
private final List<String> declinedQuestions = new ArrayList<>();
private CheckSession(PlayerChatter checker, SchematicNode schematic){
this.checker = checker;
@@ -220,20 +230,44 @@ public class CheckCommand extends SWCommand {
private void next() {
if(!checkList.hasNext()){
accept();
if (declinedQuestions.isEmpty()) {
accept();
} else {
checker.system("CHECK_DECLINED_QUESTIONS");
int i = 1;
for (String s : declinedQuestions) {
checker.prefixless("CHECK_DECLINED_QUESTION_FORMAT", i++, s);
}
declinedQuestions.clear();
checker.sendMessage(Component
.text(checker.parseToPlain("CHECK_ACCEPT"))
.color(NamedTextColor.GREEN)
.clickEvent(ClickEvent.suggestCommand("/check accept"))
.append(Component
.text(" " + checker.parseToPlain("CHECK_DECLINE"))
.color(NamedTextColor.RED)
.clickEvent(ClickEvent.suggestCommand("/check decline "))));
}
return;
}
checker.prefixless("PLAIN_STRING", checkList.next());
currentQuestion = checkList.next();
checker.prefixless("PLAIN_STRING", currentQuestion);
checker.sendMessage(Component
.text(checker.parseToPlain(checkList.hasNext() ? "CHECK_NEXT" : "CHECK_ACCEPT"))
.color(NamedTextColor.GREEN)
.clickEvent(ClickEvent.runCommand("/check next"))
.append(Component
.text(" " + checker.parseToPlain("CHECK_DECLINE"))
.text(" " + checker.parseToPlain("CHECK_MARK_DECLINE"))
.color(NamedTextColor.RED)
.clickEvent(ClickEvent.suggestCommand("/check decline "))));
.clickEvent(ClickEvent.runCommand("/check decline"))));
}
private void markDeclined() {
declinedQuestions.add(currentQuestion);
next();
}
private void accept(){