Must specify objective before adding delay, fixes #577

This commit is contained in:
BuildTools 2018-12-18 01:29:34 -05:00
parent 2ff85225e2
commit 998859251a

View File

@ -253,13 +253,16 @@ public class CreateStagePrompt extends FixedSetPrompt {
} else { } else {
text += ChatColor.LIGHT_PURPLE + "" + ChatColor.BOLD + "16 " + ChatColor.RESET + ChatColor.YELLOW + "- " + Lang.get("stageEditorEvents") + "\n"; text += ChatColor.LIGHT_PURPLE + "" + ChatColor.BOLD + "16 " + ChatColor.RESET + ChatColor.YELLOW + "- " + Lang.get("stageEditorEvents") + "\n";
} }
if (!hasObjective) {
text += ChatColor.GRAY + "" + ChatColor.BOLD + "17 " + ChatColor.RESET + ChatColor.GRAY + "- " + Lang.get("delay") + ChatColor.GRAY + " (" + Lang.get("stageEditorOptional") + ")\n";
} else {
if (context.getSessionData(pref + CK.S_DELAY) == null) { if (context.getSessionData(pref + CK.S_DELAY) == null) {
text += ChatColor.LIGHT_PURPLE + "" + ChatColor.BOLD + "17 " + ChatColor.RESET + ChatColor.DARK_PURPLE + "- " + Lang.get("delay") + ChatColor.GRAY + " (" + Lang.get("noneSet") + ")\n"; text += ChatColor.LIGHT_PURPLE + "" + ChatColor.BOLD + "17 " + ChatColor.RESET + ChatColor.DARK_PURPLE + "- " + Lang.get("delay") + ChatColor.GRAY + " (" + Lang.get("noneSet") + ")\n";
} else { } else {
hasObjective = true;
long time = (Long) context.getSessionData(pref + CK.S_DELAY); long time = (Long) context.getSessionData(pref + CK.S_DELAY);
text += ChatColor.LIGHT_PURPLE + "" + ChatColor.BOLD + "17 " + ChatColor.RESET + ChatColor.DARK_PURPLE + "- " + Lang.get("delay") + ChatColor.GRAY + "(" + ChatColor.AQUA + Quests.getTime(time) + ChatColor.GRAY + ")\n"; text += ChatColor.LIGHT_PURPLE + "" + ChatColor.BOLD + "17 " + ChatColor.RESET + ChatColor.DARK_PURPLE + "- " + Lang.get("delay") + ChatColor.GRAY + "(" + ChatColor.AQUA + Quests.getTime(time) + ChatColor.GRAY + ")\n";
} }
}
if (context.getSessionData(pref + CK.S_DELAY) == null) { if (context.getSessionData(pref + CK.S_DELAY) == null) {
text += ChatColor.GRAY + "" + ChatColor.BOLD + "18 " + ChatColor.RESET + ChatColor.GRAY + "- " + Lang.get("stageEditorDelayMessage") + ChatColor.GRAY + " (" + Lang.get("noDelaySet") + ")\n"; text += ChatColor.GRAY + "" + ChatColor.BOLD + "18 " + ChatColor.RESET + ChatColor.GRAY + "- " + Lang.get("stageEditorDelayMessage") + ChatColor.GRAY + " (" + Lang.get("noDelaySet") + ")\n";
} else if (context.getSessionData(pref + CK.S_DELAY_MESSAGE) == null) { } else if (context.getSessionData(pref + CK.S_DELAY_MESSAGE) == null) {
@ -393,7 +396,12 @@ public class CreateStagePrompt extends FixedSetPrompt {
return new CreateStagePrompt(stageNum, questFactory, citizens); return new CreateStagePrompt(stageNum, questFactory, citizens);
} }
} else if (input.equalsIgnoreCase("17")) { } else if (input.equalsIgnoreCase("17")) {
if (hasObjective) {
return new DelayPrompt(); return new DelayPrompt();
} else {
context.getForWhom().sendRawMessage(ChatColor.RED + Lang.get("invalidOption"));
return new CreateStagePrompt(stageNum, questFactory, citizens);
}
} else if (input.equalsIgnoreCase("18")) { } else if (input.equalsIgnoreCase("18")) {
if (context.getSessionData(pref + CK.S_DELAY) == null) { if (context.getSessionData(pref + CK.S_DELAY) == null) {
context.getForWhom().sendRawMessage(ChatColor.RED + Lang.get("stageEditorNoDelaySet")); context.getForWhom().sendRawMessage(ChatColor.RED + Lang.get("stageEditorNoDelaySet"));