Resolve skipping stages with delays after relogging, fixes #810

This commit is contained in:
PikaMug 2019-06-07 00:06:37 -04:00
parent a77a917e3f
commit 98372258eb
3 changed files with 12 additions and 9 deletions

View File

@ -181,6 +181,12 @@ public class CmdExecutor implements CommandExecutor {
if (quester.getCurrentQuests().isEmpty() == false) { if (quester.getCurrentQuests().isEmpty() == false) {
for (Quest q : quester.getCurrentQuests().keySet()) { for (Quest q : quester.getCurrentQuests().keySet()) {
Stage stage = quester.getCurrentStage(q); Stage stage = quester.getCurrentStage(q);
LinkedList<Stage> stages = q.getStages();
for (Stage s : stages) {
if (s.equals(quester.getCurrentStage(q))) {
System.out.println(ChatColor.LIGHT_PURPLE + "quest (" + Lang.get("stageEditorStage") + " " + (stages.indexOf(s) + 1) + ")");
}
}
q.updateCompass(quester, stage); q.updateCompass(quester, stage);
if (plugin.getQuester(player.getUniqueId()).getQuestData(q).delayStartTime == 0) { if (plugin.getQuester(player.getUniqueId()).getQuestData(q).delayStartTime == 0) {
String msg = Lang.get(player, "questObjectivesTitle"); String msg = Lang.get(player, "questObjectivesTitle");
@ -536,14 +542,10 @@ public class CmdExecutor implements CommandExecutor {
cs.sendMessage(ChatColor.YELLOW + Lang.get("currentQuest") + " " + ChatColor.DARK_PURPLE + Lang.get("none")); cs.sendMessage(ChatColor.YELLOW + Lang.get("currentQuest") + " " + ChatColor.DARK_PURPLE + Lang.get("none"));
} else { } else {
cs.sendMessage(ChatColor.YELLOW + Lang.get("currentQuest")); cs.sendMessage(ChatColor.YELLOW + Lang.get("currentQuest"));
for (Quest q : quester.getCurrentQuests().keySet()) { for (Entry<Quest, Integer> set : quester.getCurrentQuests().entrySet()) {
String msg = ChatColor.LIGHT_PURPLE + " - " + ChatColor.DARK_PURPLE + q.getName(); Quest q = set.getKey();
LinkedList<Stage> stages = q.getStages(); String msg = ChatColor.LIGHT_PURPLE + " - " + ChatColor.DARK_PURPLE + q.getName()
for (Stage s : stages) { + ChatColor.LIGHT_PURPLE + " (" + Lang.get("stageEditorStage") + " " + (set.getValue() + 1) + ")";
if (s.equals(quester.getCurrentStage(q))) {
msg += ChatColor.LIGHT_PURPLE + " (" + Lang.get("stageEditorStage") + " " + (stages.indexOf(s) + 1) + ")";
}
}
cs.sendMessage(msg); cs.sendMessage(msg);
} }
} }

View File

@ -783,7 +783,7 @@ public class PlayerListener implements Listener {
quester.checkQuest(quest); quester.checkQuest(quest);
} }
for (Quest quest : quester.getCurrentQuests().keySet()) { for (Quest quest : quester.getCurrentQuests().keySet()) {
if (quester.getCurrentStage(quest).getDelay() > -1) { if (quester.getCurrentStage(quest).getDelay() > -1 && quester.getQuestData(quest).delayOver == false) {
quester.startStageTimer(quest); quester.startStageTimer(quest);
} }
} }

View File

@ -52,6 +52,7 @@ public class StageTimer implements Runnable {
} }
quest.completeQuest(quester); quest.completeQuest(quester);
} else { } else {
System.out.println("get delay = " + quester.getCurrentStage(quest).getDelay());
Stage currentStage = quester.getCurrentStage(quest); Stage currentStage = quester.getCurrentStage(quest);
int stageNum = quester.getCurrentQuests().get(quest) + 1; int stageNum = quester.getCurrentQuests().get(quest) + 1;
quester.hardQuit(quest); quester.hardQuit(quest);