Fix delays breaking reach-location objectives, fixes #505

This commit is contained in:
HappyPikachu 2018-11-07 02:22:56 -05:00
parent 441cd7ef28
commit 81a6c7a772
2 changed files with 28 additions and 24 deletions

View File

@ -414,6 +414,7 @@ public class Quester {
msg = msg.replace("<quest>", q.name); msg = msg.replace("<quest>", q.name);
getPlayer().sendMessage(ChatColor.GOLD + msg); getPlayer().sendMessage(ChatColor.GOLD + msg);
for (String s : getObjectivesReal(q)) { for (String s : getObjectivesReal(q)) {
try {
// TODO ensure all applicable strings are translated // TODO ensure all applicable strings are translated
String sbegin = s.substring(s.indexOf(ChatColor.AQUA.toString()) + 2); String sbegin = s.substring(s.indexOf(ChatColor.AQUA.toString()) + 2);
String serial = sbegin.substring(0, sbegin.indexOf(ChatColor.GREEN.toString())); String serial = sbegin.substring(0, sbegin.indexOf(ChatColor.GREEN.toString()));
@ -438,6 +439,9 @@ public class Quester {
} else { } else {
player.sendMessage(s); player.sendMessage(s);
} }
} catch (IndexOutOfBoundsException e) {
player.sendMessage(s);
}
} }
String stageStartMessage = stage.startMessage; String stageStartMessage = stage.startMessage;
if (stageStartMessage != null) { if (stageStartMessage != null) {

View File

@ -53,12 +53,12 @@ public class StageTimer implements Runnable {
} }
quester.hardStagePut(quest, stageNum); quester.hardStagePut(quest, stageNum);
quester.addEmptiesFor(quest, 0); quester.addEmptiesFor(quest, 0);
quester.getCurrentStage(quest).delay = -1; // Line added to fix Github issue #505
quester.getQuestData(quest).delayStartTime = 0; quester.getQuestData(quest).delayStartTime = 0;
quester.getQuestData(quest).delayTimeLeft = -1; quester.getQuestData(quest).delayTimeLeft = -1;
String msg = Lang.get(player, "questObjectivesTitle"); String msg = Lang.get(player, "questObjectivesTitle");
msg = msg.replaceAll("<quest>", quest.name); msg = msg.replace("<quest>", quest.name);
player.sendMessage(ChatColor.GOLD + msg); player.sendMessage(ChatColor.GOLD + msg);
player.sendMessage(ChatColor.GOLD + Lang.get(player, "questObjectivesTitle"));
for (String s : quester.getObjectivesReal(quest)) { for (String s : quester.getObjectivesReal(quest)) {
player.sendMessage(s); player.sendMessage(s);
} }