diff --git a/main/src/main/java/me/blackvein/quests/QuestFactory.java b/main/src/main/java/me/blackvein/quests/QuestFactory.java index 7ab3ac94e..25f83a683 100644 --- a/main/src/main/java/me/blackvein/quests/QuestFactory.java +++ b/main/src/main/java/me/blackvein/quests/QuestFactory.java @@ -149,12 +149,12 @@ public class QuestFactory implements ConversationAbandonedListener { context.setSessionData(CK.ED_QUEST_EDIT, q.getName()); context.setSessionData(CK.Q_ID, q.getId()); context.setSessionData(CK.Q_NAME, q.getName()); + context.setSessionData(CK.Q_ASK_MESSAGE, q.getDescription()); + context.setSessionData(CK.Q_FINISH_MESSAGE, q.getFinished()); if (q.getNpcStart() != null) { context.setSessionData(CK.Q_START_NPC, q.getNpcStart().getId()); } context.setSessionData(CK.Q_START_BLOCK, q.getBlockStart()); - context.setSessionData(CK.Q_ASK_MESSAGE, q.getDescription()); - context.setSessionData(CK.Q_FINISH_MESSAGE, q.getFinished()); if (q.getInitialAction() != null) { context.setSessionData(CK.Q_INITIAL_EVENT, q.getInitialAction().getName()); } diff --git a/main/src/main/java/me/blackvein/quests/Quests.java b/main/src/main/java/me/blackvein/quests/Quests.java index f467c6936..684001494 100644 --- a/main/src/main/java/me/blackvein/quests/Quests.java +++ b/main/src/main/java/me/blackvein/quests/Quests.java @@ -335,7 +335,9 @@ public class Quests extends JavaPlugin implements ConversationAbandonedListener return eventFactory; } - @Deprecated + /** + * @deprecated Use {@link #getActionFactory()} + */ public ActionFactory getEventFactory() { return eventFactory; } @@ -1358,7 +1360,19 @@ public class Quests extends JavaPlugin implements ConversationAbandonedListener if (config.contains("quests." + questKey + ".name")) { quest.setName(ConfigUtil.parseString(config.getString("quests." + questKey + ".name"), quest)); } else { - throw new QuestFormatException("Quest block is missing", questKey); + throw new QuestFormatException("name is missing", questKey); + } + if (config.contains("quests." + questKey + ".ask-message")) { + quest.description = ConfigUtil.parseString(config.getString("quests." + questKey + + ".ask-message"), quest); + } else { + throw new QuestFormatException("ask-message is missing", questKey); + } + if (config.contains("quests." + questKey + ".finish-message")) { + quest.finished = ConfigUtil.parseString(config.getString("quests." + questKey + + ".finish-message"), quest); + } else { + throw new QuestFormatException("finish-message is missing", questKey); } if (depends.getCitizens() != null && config.contains("quests." + questKey + ".npc-giver-id")) { if (CitizensAPI.getNPCRegistry().getById(config.getInt("quests." + questKey + ".npc-giver-id")) @@ -1422,18 +1436,6 @@ public class Quests extends JavaPlugin implements ConversationAbandonedListener throw new QuestFormatException("redo-delay is not a number", questKey); } } - if (config.contains("quests." + questKey + ".finish-message")) { - quest.finished = ConfigUtil.parseString(config.getString("quests." + questKey - + ".finish-message"), quest); - } else { - throw new QuestFormatException("finish-message is missing", questKey); - } - if (config.contains("quests." + questKey + ".ask-message")) { - quest.description = ConfigUtil.parseString(config.getString("quests." + questKey - + ".ask-message"), quest); - } else { - throw new QuestFormatException("ask-message is missing", questKey); - } if (config.contains("quests." + questKey + ".action")) { Action act = loadAction(config.getString("quests." + questKey + ".action")); if (act != null) { diff --git a/main/src/main/java/me/blackvein/quests/convo/quests/main/QuestMainPrompt.java b/main/src/main/java/me/blackvein/quests/convo/quests/main/QuestMainPrompt.java index fbd2d493c..5296f8313 100644 --- a/main/src/main/java/me/blackvein/quests/convo/quests/main/QuestMainPrompt.java +++ b/main/src/main/java/me/blackvein/quests/convo/quests/main/QuestMainPrompt.java @@ -117,17 +117,9 @@ public class QuestMainPrompt extends QuestsEditorNumericPrompt { case 1: return ChatColor.YELLOW + Lang.get("questEditorName"); case 2: - if (context.getSessionData(CK.Q_ASK_MESSAGE) == null) { - return ChatColor.RED + Lang.get("questEditorAskMessage"); - } else { - return ChatColor.YELLOW + Lang.get("questEditorAskMessage"); - } + return ChatColor.YELLOW + Lang.get("questEditorAskMessage"); case 3: - if (context.getSessionData(CK.Q_FINISH_MESSAGE) == null) { - return ChatColor.RED + Lang.get("questEditorFinishMessage"); - } else { - return ChatColor.YELLOW + Lang.get("questEditorFinishMessage"); - } + return ChatColor.YELLOW + Lang.get("questEditorFinishMessage"); case 4: if (context.getSessionData(CK.Q_START_NPC) == null && plugin.getDependencies().getCitizens() != null) { return ChatColor.YELLOW + Lang.get("questEditorNPCStart"); @@ -184,26 +176,18 @@ public class QuestMainPrompt extends QuestsEditorNumericPrompt { case 1: return ""; case 2: - if (context.getSessionData(CK.Q_ASK_MESSAGE) == null) { - return ChatColor.DARK_RED + "(" + Lang.get("questRequiredNoneSet") + ")"; - } else { - return ChatColor.YELLOW + "(" + context.getSessionData(CK.Q_ASK_MESSAGE) + ChatColor.RESET - + ChatColor.YELLOW + ")"; - } + return ChatColor.GRAY + "(" + ChatColor.AQUA + context.getSessionData(CK.Q_ASK_MESSAGE) + ChatColor.RESET + + ChatColor.GRAY + ")"; case 3: - if (context.getSessionData(CK.Q_FINISH_MESSAGE) == null) { - return ChatColor.DARK_RED + "(" + Lang.get("questRequiredNoneSet") + ")"; - } else { - return ChatColor.YELLOW + "(" + context.getSessionData(CK.Q_FINISH_MESSAGE) + ChatColor.RESET - + ChatColor.YELLOW + ")"; - } + return ChatColor.GRAY + "(" + ChatColor.AQUA + context.getSessionData(CK.Q_FINISH_MESSAGE) + + ChatColor.RESET + ChatColor.GRAY + ")"; case 4: if (context.getSessionData(CK.Q_START_NPC) == null && plugin.getDependencies().getCitizens() != null) { return ChatColor.GRAY + "(" + Lang.get("noneSet") + ")"; } else if (plugin.getDependencies().getCitizens() != null) { - return ChatColor.YELLOW + "(" + CitizensAPI.getNPCRegistry().getById((Integer) context - .getSessionData(CK.Q_START_NPC)).getName() + ChatColor.RESET + ChatColor.YELLOW + ")"; + return ChatColor.GRAY + "(" + ChatColor.AQUA + CitizensAPI.getNPCRegistry().getById((Integer) context + .getSessionData(CK.Q_START_NPC)).getName() + ChatColor.RESET + ChatColor.GRAY + ")"; } else { return ChatColor.GRAY + "(" + Lang.get("notInstalled") + ")"; } @@ -212,16 +196,16 @@ public class QuestMainPrompt extends QuestsEditorNumericPrompt { return ChatColor.GRAY + "(" + Lang.get("noneSet") + ")"; } else { Location l = (Location) context.getSessionData(CK.Q_START_BLOCK); - return ChatColor.YELLOW + "(" + l.getWorld().getName() + ", " + l.getBlockX() + ", " - + l.getBlockY() + ", " + l.getBlockZ() + ")"; + return ChatColor.GRAY + "(" + ChatColor.AQUA + l.getWorld().getName() + ", " + l.getBlockX() + ", " + + l.getBlockY() + ", " + l.getBlockZ() + ChatColor.RESET + ChatColor.GRAY + ")"; } case 6: if (plugin.getDependencies().getWorldGuardApi() != null) { if (context.getSessionData(CK.Q_REGION) == null) { return ChatColor.GRAY + "(" + Lang.get("noneSet") + ")"; } else { - return ChatColor.YELLOW + "(" + ChatColor.GREEN - + (String) context.getSessionData(CK.Q_REGION) + ChatColor.YELLOW + ")"; + return ChatColor.GRAY + "(" + ChatColor.AQUA + (String) context.getSessionData(CK.Q_REGION) + + ChatColor.RESET + ChatColor.GRAY + ")"; } } else { return ChatColor.GRAY + "(" + Lang.get("notInstalled") + ")"; @@ -230,15 +214,16 @@ public class QuestMainPrompt extends QuestsEditorNumericPrompt { if (context.getSessionData(CK.Q_INITIAL_EVENT) == null) { return ChatColor.GRAY + "(" + Lang.get("noneSet") + ")"; } else { - return ChatColor.YELLOW + "(" + (String) context.getSessionData(CK.Q_INITIAL_EVENT) + ")"; + return ChatColor.GRAY + "(" + ChatColor.AQUA + (String) context.getSessionData(CK.Q_INITIAL_EVENT) + + ChatColor.RESET + ChatColor.GRAY + ")"; } case 8: if (plugin.getDependencies().getCitizens() != null) { if (context.getSessionData(CK.Q_GUIDISPLAY) == null) { return ChatColor.GRAY + "(" + Lang.get("noneSet") + ")"; } else { - return ChatColor.YELLOW + "(" + ItemUtil.getDisplayString((ItemStack) context - .getSessionData(CK.Q_GUIDISPLAY)) + ChatColor.RESET + ChatColor.YELLOW + ")"; + return ChatColor.GRAY + "(" + ChatColor.AQUA + ItemUtil.getDisplayString((ItemStack) context + .getSessionData(CK.Q_GUIDISPLAY)) + ChatColor.RESET + ChatColor.GRAY + ")"; } } else { return ChatColor.GRAY + "(" + Lang.get("notInstalled") + ")"; diff --git a/main/src/main/java/me/blackvein/quests/convo/quests/menu/QuestMenuPrompt.java b/main/src/main/java/me/blackvein/quests/convo/quests/menu/QuestMenuPrompt.java index 8555a764d..8f52344d9 100644 --- a/main/src/main/java/me/blackvein/quests/convo/quests/menu/QuestMenuPrompt.java +++ b/main/src/main/java/me/blackvein/quests/convo/quests/menu/QuestMenuPrompt.java @@ -177,6 +177,8 @@ public class QuestMenuPrompt extends QuestsEditorNumericPrompt { return new QuestSelectCreatePrompt(context); } context.setSessionData(CK.Q_NAME, input); + context.setSessionData(CK.Q_ASK_MESSAGE, Lang.get("questEditorDefaultAskMessage")); + context.setSessionData(CK.Q_FINISH_MESSAGE, Lang.get("questEditorDefaultFinishMessage")); questNames.add(input); plugin.getQuestFactory().setNamesOfQuestsBeingEdited(questNames); return new QuestMainPrompt(context); diff --git a/main/src/main/resources/strings.yml b/main/src/main/resources/strings.yml index 8f9bdab01..a474d7a34 100644 --- a/main/src/main/resources/strings.yml +++ b/main/src/main/resources/strings.yml @@ -63,13 +63,14 @@ questEditorPln: "Edit Planner" questEditorStages: "Edit Stages" questEditorRews: "Edit Rewards" questEditorOpts: "Edit Options" +questEditorDefaultAskMessage: "Challenge objectives with haste!" +questEditorDefaultFinishMessage: "You have finished all objectives." questEditorEnterQuestName: "Enter quest name, " questEditorEnterAskMessage: "Enter ask message, " questEditorEnterFinishMessage: "Enter finish message, " questEditorEnterNPCStart: "Enter NPC ID, , " questEditorEnterBlockStart: "Right-click on a block to use as a start point, , , " questEditorEnterInitialEvent: "Enter an action name, , " -questRequiredNoneSet: "Required, none set" questDungeonsCreate: "Players added to this group may perform quests together!" questDungeonsDisband: "The quest group was disbanded." questDungeonsInvite: " can now perform quests with you!"