2 Commits

Author SHA1 Message Date
c425ca1171 Merge pull request 'Add declined question handling in CheckCommand' (#66) from add-saved-declined-questions-history into main
All checks were successful
SteamWarCI Build successful
Reviewed-on: #66
Reviewed-by: YoyoNow <yoyonow@noreply.localhost>
2025-06-10 20:43:53 +02:00
5cc417c43c Add declined question handling in CheckCommand
All checks were successful
SteamWarCI Build successful
- Implemented tracking of declined questions during checks.
- Updated messaging logic to display declined questions to users.
- Added new translations for decline-related messages.
2025-06-05 23:41:01 +02:00
3 changed files with 43 additions and 4 deletions

View File

@@ -325,12 +325,15 @@ CHECK_ABORT=§aThe test operation was canceled!
CHECK_NEXT=Next question
CHECK_ACCEPT=Accept
CHECK_DECLINE=Decline
CHECK_MARK_DECLINE=Mark Decline
CHECK_RANK=§aRank {0}: {1}
CHECK_RANK_HOVER=§aAccept with given rank
CHECK_ACCEPTED=§aYour §e{0} {1} §ewas accepted§8!
CHECK_ACCEPTED_TEAM=§7The schematic §e{0} §7from §e{1} §7is now approved!
CHECK_DECLINED=§cYour §e{0} {1} §cwas declined§8: §c{2}
CHECK_DECLINED_TEAM=§7The schematic §e{0} §7from §e{1} §7is now declined because §e{2}§7!
CHECK_DECLINED_QUESTIONS=§fQuestions answered declined:
CHECK_DECLINED_QUESTION_FORMAT=§c{0}: {1}
#HistoricCommand
HISTORIC_BROADCAST=§7Historic §e{0} §7fight by §e{1}§8!

View File

@@ -307,12 +307,14 @@ CHECK_ABORT=§aDer Prüfvorgang wurde abgebrochen!
CHECK_NEXT=Nächste Frage
CHECK_ACCEPT=Annehmen
CHECK_DECLINE=Ablehnen
CHECK_MARK_DECLINE=Ablehnen Markieren
CHECK_RANK=§aRang {0}: {1}
CHECK_RANK_HOVER=§aMit diesem Rang freigeben
CHECK_ACCEPTED=§aDein §e{0} {1} §ewurde freigegeben§8!
CHECK_ACCEPTED_TEAM=§7Die Schematic §e{0} §7von §e{1} §7ist nun freigegeben!
CHECK_DECLINED=§cDein §e{0} {1} §cwurde abgelehnt§8: §c{2}
CHECK_DECLINED_TEAM=§7Die Schematic §e{0} §7von §e{1} §7wurde aufgrund von §e{2} §7abgelehnt!
CHECK_DECLINED_QUESTIONS=§fAls abgelehnt markierte Fragen:
#HistoricCommand
HISTORIC_BROADCAST=§7Historischer §e{0}§8-§7Kampf von §e{1}§8!

View File

@@ -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(){