forked from SteamWar/SteamWar
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:
@@ -325,12 +325,15 @@ CHECK_ABORT=§aThe test operation was canceled!
|
|||||||
CHECK_NEXT=Next question
|
CHECK_NEXT=Next question
|
||||||
CHECK_ACCEPT=Accept
|
CHECK_ACCEPT=Accept
|
||||||
CHECK_DECLINE=Decline
|
CHECK_DECLINE=Decline
|
||||||
|
CHECK_MARK_DECLINE=Mark Decline
|
||||||
CHECK_RANK=§aRank {0}: {1}
|
CHECK_RANK=§aRank {0}: {1}
|
||||||
CHECK_RANK_HOVER=§aAccept with given rank
|
CHECK_RANK_HOVER=§aAccept with given rank
|
||||||
CHECK_ACCEPTED=§aYour §e{0} {1} §ewas accepted§8!
|
CHECK_ACCEPTED=§aYour §e{0} {1} §ewas accepted§8!
|
||||||
CHECK_ACCEPTED_TEAM=§7The schematic §e{0} §7from §e{1} §7is now approved!
|
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=§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_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
|
#HistoricCommand
|
||||||
HISTORIC_BROADCAST=§7Historic §e{0} §7fight by §e{1}§8!
|
HISTORIC_BROADCAST=§7Historic §e{0} §7fight by §e{1}§8!
|
||||||
|
|||||||
@@ -307,12 +307,14 @@ CHECK_ABORT=§aDer Prüfvorgang wurde abgebrochen!
|
|||||||
CHECK_NEXT=Nächste Frage
|
CHECK_NEXT=Nächste Frage
|
||||||
CHECK_ACCEPT=Annehmen
|
CHECK_ACCEPT=Annehmen
|
||||||
CHECK_DECLINE=Ablehnen
|
CHECK_DECLINE=Ablehnen
|
||||||
|
CHECK_MARK_DECLINE=Ablehnen Markieren
|
||||||
CHECK_RANK=§aRang {0}: {1}
|
CHECK_RANK=§aRang {0}: {1}
|
||||||
CHECK_RANK_HOVER=§aMit diesem Rang freigeben
|
CHECK_RANK_HOVER=§aMit diesem Rang freigeben
|
||||||
CHECK_ACCEPTED=§aDein §e{0} {1} §ewurde freigegeben§8!
|
CHECK_ACCEPTED=§aDein §e{0} {1} §ewurde freigegeben§8!
|
||||||
CHECK_ACCEPTED_TEAM=§7Die Schematic §e{0} §7von §e{1} §7ist nun freigegeben!
|
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=§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_TEAM=§7Die Schematic §e{0} §7von §e{1} §7wurde aufgrund von §e{2} §7abgelehnt!
|
||||||
|
CHECK_DECLINED_QUESTIONS=§fAls abgelehnt markierte Fragen:
|
||||||
|
|
||||||
#HistoricCommand
|
#HistoricCommand
|
||||||
HISTORIC_BROADCAST=§7Historischer §e{0}§8-§7Kampf von §e{1}§8!
|
HISTORIC_BROADCAST=§7Historischer §e{0}§8-§7Kampf von §e{1}§8!
|
||||||
|
|||||||
@@ -164,6 +164,14 @@ public class CheckCommand extends SWCommand {
|
|||||||
next(sender);
|
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")
|
@Register(value = "decline", description = "CHECK_HELP_DECLINE")
|
||||||
public void decline(PlayerChatter sender, String... message) {
|
public void decline(PlayerChatter sender, String... message) {
|
||||||
if(notChecking(sender.getPlayer()))
|
if(notChecking(sender.getPlayer()))
|
||||||
@@ -200,6 +208,8 @@ public class CheckCommand extends SWCommand {
|
|||||||
private final SchematicNode schematic;
|
private final SchematicNode schematic;
|
||||||
private final Timestamp startTime;
|
private final Timestamp startTime;
|
||||||
private final ListIterator<String> checkList;
|
private final ListIterator<String> checkList;
|
||||||
|
private String currentQuestion;
|
||||||
|
private final List<String> declinedQuestions = new ArrayList<>();
|
||||||
|
|
||||||
private CheckSession(PlayerChatter checker, SchematicNode schematic){
|
private CheckSession(PlayerChatter checker, SchematicNode schematic){
|
||||||
this.checker = checker;
|
this.checker = checker;
|
||||||
@@ -220,20 +230,44 @@ public class CheckCommand extends SWCommand {
|
|||||||
|
|
||||||
private void next() {
|
private void next() {
|
||||||
if(!checkList.hasNext()){
|
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;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
checker.prefixless("PLAIN_STRING", checkList.next());
|
currentQuestion = checkList.next();
|
||||||
|
|
||||||
|
checker.prefixless("PLAIN_STRING", currentQuestion);
|
||||||
|
|
||||||
checker.sendMessage(Component
|
checker.sendMessage(Component
|
||||||
.text(checker.parseToPlain(checkList.hasNext() ? "CHECK_NEXT" : "CHECK_ACCEPT"))
|
.text(checker.parseToPlain(checkList.hasNext() ? "CHECK_NEXT" : "CHECK_ACCEPT"))
|
||||||
.color(NamedTextColor.GREEN)
|
.color(NamedTextColor.GREEN)
|
||||||
.clickEvent(ClickEvent.runCommand("/check next"))
|
.clickEvent(ClickEvent.runCommand("/check next"))
|
||||||
.append(Component
|
.append(Component
|
||||||
.text(" " + checker.parseToPlain("CHECK_DECLINE"))
|
.text(" " + checker.parseToPlain("CHECK_MARK_DECLINE"))
|
||||||
.color(NamedTextColor.RED)
|
.color(NamedTextColor.RED)
|
||||||
.clickEvent(ClickEvent.suggestCommand("/check decline "))));
|
.clickEvent(ClickEvent.runCommand("/check decline"))));
|
||||||
|
}
|
||||||
|
|
||||||
|
private void markDeclined() {
|
||||||
|
declinedQuestions.add(currentQuestion);
|
||||||
|
next();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void accept(){
|
private void accept(){
|
||||||
|
|||||||
Reference in New Issue
Block a user