diff --git a/src/main/java/me/blackvein/quests/QuestFactory.java b/src/main/java/me/blackvein/quests/QuestFactory.java index e13cb5456..676864255 100644 --- a/src/main/java/me/blackvein/quests/QuestFactory.java +++ b/src/main/java/me/blackvein/quests/QuestFactory.java @@ -83,10 +83,10 @@ public class QuestFactory implements ConversationAbandonedListener, ColorUtil { String text = GOLD + "- Quest Editor -\n" - + BLUE + "" + BOLD + "1" + RESET + YELLOW + " - Create a Quest\n" - + BLUE + "" + BOLD + "2" + RESET + YELLOW + " - Edit a Quest\n" - + BLUE + "" + BOLD + "3" + RESET + YELLOW + " - Delete a Quest\n" - + GOLD + "" + BOLD + "4" + RESET + YELLOW + " - Exit"; + + BLUE + "" + BOLD + "1" + RESET + YELLOW + " - " + Lang.get("questEditorCreate") + "\n" + + BLUE + "" + BOLD + "2" + RESET + YELLOW + " - " + Lang.get("questEditorEdit") + "\n" + + BLUE + "" + BOLD + "3" + RESET + YELLOW + " - " + Lang.get("questEditorDelete") + "\n" + + GOLD + "" + BOLD + "4" + RESET + YELLOW + " - " + Lang.get("exit"); return text; @@ -103,7 +103,7 @@ public class QuestFactory implements ConversationAbandonedListener, ColorUtil { if (player.hasPermission("quests.editor.create")) { return new QuestNamePrompt(); } else { - player.sendMessage(RED + "You do not have permission to create Quests."); + player.sendMessage(RED + Lang.get("questEditorNoPermsCreate")); return new MenuPrompt(); } @@ -112,7 +112,7 @@ public class QuestFactory implements ConversationAbandonedListener, ColorUtil { if (player.hasPermission("quests.editor.edit")) { return new SelectEditPrompt(); } else { - player.sendMessage(RED + "You do not have permission to edit Quests."); + player.sendMessage(RED + Lang.get("questEditorNoPermsCreate")); return new MenuPrompt(); } @@ -121,12 +121,12 @@ public class QuestFactory implements ConversationAbandonedListener, ColorUtil { if (player.hasPermission("quests.editor.delete")) { return new SelectDeletePrompt(); } else { - player.sendMessage(RED + "You do not have permission to delete Quests."); + player.sendMessage(RED + Lang.get("questEditorNoPermsDelete")); return new MenuPrompt(); } } else if (input.equalsIgnoreCase("4")) { - context.getForWhom().sendRawMessage(YELLOW + "Exited."); + context.getForWhom().sendRawMessage(YELLOW + Lang.get("exited")); return Prompt.END_OF_CONVERSATION; } @@ -155,29 +155,29 @@ public class QuestFactory implements ConversationAbandonedListener, ColorUtil { String text = GOLD + "- Quest: " + AQUA + context.getSessionData(CK.Q_NAME) + GOLD + " -\n"; - text += BLUE + "" + BOLD + "1" + RESET + YELLOW + " - Set name\n"; + text += BLUE + "" + BOLD + "1" + RESET + YELLOW + " - "+ Lang.get("questEditorName") +"\n"; if (context.getSessionData(CK.Q_ASK_MESSAGE) == null) { - text += BLUE + "" + BOLD + "2" + RESET + RED + " - Set ask message " + DARKRED + "(Required, none set)\n"; + text += BLUE + "" + BOLD + "2" + RESET + RED + " - " + Lang.get("questEditorAskMessage") + " " + DARKRED + "(Required, none set)\n"; } else { - text += BLUE + "" + BOLD + "2" + RESET + YELLOW + " - Set ask message (\"" + context.getSessionData(CK.Q_ASK_MESSAGE) + "\")\n"; + text += BLUE + "" + BOLD + "2" + RESET + YELLOW + " - " + Lang.get("questEditorAskMessage") + " (\"" + context.getSessionData(CK.Q_ASK_MESSAGE) + "\")\n"; } if (context.getSessionData(CK.Q_FINISH_MESSAGE) == null) { - text += BLUE + "" + BOLD + "3" + RESET + RED + " - Set finish message " + DARKRED + "(Required, none set)\n"; + text += BLUE + "" + BOLD + "3" + RESET + RED + " - " + Lang.get("questEditorFinishMessage") + " " + DARKRED + "(Required, none set)\n"; } else { - text += BLUE + "" + BOLD + "3" + RESET + YELLOW + " - Set finish message (\"" + context.getSessionData(CK.Q_FINISH_MESSAGE) + "\")\n"; + text += BLUE + "" + BOLD + "3" + RESET + YELLOW + " - " + Lang.get("questEditorFinishMessage") + " (\"" + context.getSessionData(CK.Q_FINISH_MESSAGE) + "\")\n"; } if (context.getSessionData(CK.Q_REDO_DELAY) == null) { - text += BLUE + "" + BOLD + "4" + RESET + YELLOW + " - Set redo delay (None set)\n"; + text += BLUE + "" + BOLD + "4" + RESET + YELLOW + " - " + Lang.get("questEditorRedoDelay") + " (None set)\n"; } else { //something here is throwing an exception try{ - text += BLUE + "" + BOLD + "4" + RESET + YELLOW + " - Set redo delay (" + Quests.getTime((Long) context.getSessionData(CK.Q_REDO_DELAY)) + ")\n"; + text += BLUE + "" + BOLD + "4" + RESET + YELLOW + " - " + Lang.get("questEditorRedoDelay") + " (" + Quests.getTime((Long) context.getSessionData(CK.Q_REDO_DELAY)) + ")\n"; }catch(Exception e){ e.printStackTrace(); } @@ -186,27 +186,27 @@ public class QuestFactory implements ConversationAbandonedListener, ColorUtil { } if (context.getSessionData(CK.Q_START_NPC) == null && quests.citizens != null) { - text += BLUE + "" + BOLD + "5" + RESET + YELLOW + " - Set NPC start (None set)\n"; + text += BLUE + "" + BOLD + "5" + RESET + YELLOW + " - " + Lang.get("questEditorNPCStart") + " (None set)\n"; } else if (quests.citizens != null) { - text += BLUE + "" + BOLD + "5" + RESET + YELLOW + " - Set NPC start (" + CitizensAPI.getNPCRegistry().getById((Integer) context.getSessionData(CK.Q_START_NPC)).getName() + ")\n"; + text += BLUE + "" + BOLD + "5" + RESET + YELLOW + " - " + Lang.get("questEditorNPCStart") + " (" + CitizensAPI.getNPCRegistry().getById((Integer) context.getSessionData(CK.Q_START_NPC)).getName() + ")\n"; } if (context.getSessionData(CK.Q_START_BLOCK) == null) { if (quests.citizens != null) { - text += BLUE + "" + BOLD + "6" + RESET + YELLOW + " - Set Block start (None set)\n"; + text += BLUE + "" + BOLD + "6" + RESET + YELLOW + " - " + Lang.get("questEditorBlockStart") + " (None set)\n"; } else { - text += BLUE + "" + BOLD + "5" + RESET + YELLOW + " - Set Block start (None set)\n"; + text += BLUE + "" + BOLD + "5" + RESET + YELLOW + " - " + Lang.get("questEditorBlockStart") + " (None set)\n"; } } else { if (quests.citizens != null) { Location l = (Location) context.getSessionData(CK.Q_START_BLOCK); - text += BLUE + "" + BOLD + "6" + RESET + YELLOW + " - Set Block start (" + l.getWorld().getName() + ", " + l.getBlockX() + ", " + l.getBlockY() + ", " + l.getBlockZ() + ")\n"; + text += BLUE + "" + BOLD + "6" + RESET + YELLOW + " - " + Lang.get("questEditorBlockStart") + " (" + l.getWorld().getName() + ", " + l.getBlockX() + ", " + l.getBlockY() + ", " + l.getBlockZ() + ")\n"; } else { Location l = (Location) context.getSessionData(CK.Q_START_BLOCK); - text += BLUE + "" + BOLD + "5" + RESET + YELLOW + " - Set Block start (" + l.getWorld().getName() + ", " + l.getBlockX() + ", " + l.getBlockY() + ", " + l.getBlockZ() + ")\n"; + text += BLUE + "" + BOLD + "5" + RESET + YELLOW + " - " + Lang.get("questEditorBlockStart") + " (" + l.getWorld().getName() + ", " + l.getBlockX() + ", " + l.getBlockY() + ", " + l.getBlockZ() + ")\n"; } } @@ -215,53 +215,53 @@ public class QuestFactory implements ConversationAbandonedListener, ColorUtil { if (context.getSessionData(CK.Q_INITIAL_EVENT) == null) { if (quests.citizens != null) { - text += BLUE + "" + BOLD + "7" + RESET + YELLOW + " - Set initial Event (None set)\n"; + text += BLUE + "" + BOLD + "7" + RESET + YELLOW + " - " + Lang.get("questEditorInitialEvent") + " (None set)\n"; } else { - text += BLUE + "" + BOLD + "6" + RESET + YELLOW + " - Set initial Event (None set)\n"; + text += BLUE + "" + BOLD + "6" + RESET + YELLOW + " - " + Lang.get("questEditorInitialEvent") + " (None set)\n"; } } else { if (quests.citizens != null) { String s = (String) context.getSessionData(CK.Q_INITIAL_EVENT); - text += BLUE + "" + BOLD + "7" + RESET + YELLOW + " - Set initial Event (" + s + ")\n"; + text += BLUE + "" + BOLD + "7" + RESET + YELLOW + " - " + Lang.get("questEditorInitialEvent") + " (" + s + ")\n"; } else { String s = (String) context.getSessionData(CK.Q_INITIAL_EVENT); - text += BLUE + "" + BOLD + "6" + RESET + YELLOW + " - Set initial Event (" + s + ")\n"; + text += BLUE + "" + BOLD + "6" + RESET + YELLOW + " - " + Lang.get("questEditorInitialEvent") + " (" + s + ")\n"; } } if (quests.citizens != null) { - text += BLUE + "" + BOLD + "8" + RESET + DARKAQUA + " - Edit Requirements\n"; + text += BLUE + "" + BOLD + "8" + RESET + DARKAQUA + " - " + Lang.get("questEditorReqs") + "\n"; } else { - text += BLUE + "" + BOLD + "7" + RESET + DARKAQUA + " - Edit Requirements\n"; + text += BLUE + "" + BOLD + "7" + RESET + DARKAQUA + " - " + Lang.get("questEditorReqs") + "\n"; } if (quests.citizens != null) { - text += BLUE + "" + BOLD + "9" + RESET + PINK + " - Edit Stages\n"; + text += BLUE + "" + BOLD + "9" + RESET + PINK + " - " + Lang.get("questEditorStages") + "\n"; } else { - text += BLUE + "" + BOLD + "8" + RESET + PINK + " - Edit Stages\n"; + text += BLUE + "" + BOLD + "8" + RESET + PINK + " - " + Lang.get("questEditorStages") + "\n"; } if (quests.citizens != null) { - text += BLUE + "" + BOLD + "10" + RESET + GREEN + " - Edit Rewards\n"; + text += BLUE + "" + BOLD + "10" + RESET + GREEN + " - " + Lang.get("questEditorRews") + "\n"; } else { - text += BLUE + "" + BOLD + "9" + RESET + GREEN + " - Edit Rewards\n"; + text += BLUE + "" + BOLD + "9" + RESET + GREEN + " - " + Lang.get("questEditorRews") + "\n"; } if (quests.citizens != null) { - text += BLUE + "" + BOLD + "11" + RESET + GOLD + " - Save\n"; + text += BLUE + "" + BOLD + "11" + RESET + GOLD + " - " + Lang.get("save") + "\n"; } else { - text += BLUE + "" + BOLD + "10" + RESET + GOLD + " - Save\n"; + text += BLUE + "" + BOLD + "10" + RESET + GOLD + " - " + Lang.get("save") + "\n"; } if (quests.citizens != null) { - text += BLUE + "" + BOLD + "12" + RESET + RED + " - Exit\n"; + text += BLUE + "" + BOLD + "12" + RESET + RED + " - " + Lang.get("exit") + "\n"; } else { - text += BLUE + "" + BOLD + "11" + RESET + RED + " - Exit\n"; + text += BLUE + "" + BOLD + "11" + RESET + RED + " - " + Lang.get("exit") + "\n"; } @@ -387,7 +387,7 @@ public class QuestFactory implements ConversationAbandonedListener, ColorUtil { @Override public Prompt acceptInput(ConversationContext context, String input) { - if (input.equalsIgnoreCase("cancel") == false) { + if (input.equalsIgnoreCase(Lang.get("cmdCancel")) == false) { for (Quest q : quests.getQuests()) { @@ -430,8 +430,8 @@ public class QuestFactory implements ConversationAbandonedListener, ColorUtil { @Override public String getPromptText(ConversationContext context) { - String text = GOLD + "- Create Quest -\n"; - text += AQUA + "Create new Quest " + GOLD + "- " + Lang.get("enterQuestName"); + String text = GOLD + "- " + Lang.get("questCreateHeader") + " -\n"; + text += AQUA + Lang.get("questCreateNew") + " " + GOLD + "- " + Lang.get("enterQuestName"); return text; @@ -440,13 +440,13 @@ public class QuestFactory implements ConversationAbandonedListener, ColorUtil { @Override public Prompt acceptInput(ConversationContext context, String input) { - if (input.equalsIgnoreCase("cancel") == false) { + if (input.equalsIgnoreCase(Lang.get("cmdCancel")) == false) { for (Quest q : quests.quests) { if (q.name.equalsIgnoreCase(input)) { - context.getForWhom().sendRawMessage(ChatColor.RED + "Quest already exists!"); + context.getForWhom().sendRawMessage(ChatColor.RED + Lang.get("questNameExists")); return new QuestNamePrompt(); } @@ -455,14 +455,14 @@ public class QuestFactory implements ConversationAbandonedListener, ColorUtil { if (names.contains(input)) { - context.getForWhom().sendRawMessage(ChatColor.RED + "Someone is creating a Quest with that name!"); + context.getForWhom().sendRawMessage(ChatColor.RED + Lang.get("questBeingEdited")); return new QuestNamePrompt(); } if (input.contains(",")) { - context.getForWhom().sendRawMessage(ChatColor.RED + "Name may not contain commas!"); + context.getForWhom().sendRawMessage(ChatColor.RED + Lang.get("questNameContainsCommas")); return new QuestNamePrompt(); } @@ -485,7 +485,7 @@ public class QuestFactory implements ConversationAbandonedListener, ColorUtil { @Override public String getPromptText(ConversationContext context) { - return ChatColor.YELLOW + "Enter NPC ID, or -1 to clear the NPC start, or -2 to cancel"; + return ChatColor.YELLOW + Lang.get("enterNPCStart"); } @@ -495,7 +495,7 @@ public class QuestFactory implements ConversationAbandonedListener, ColorUtil { if (input.intValue() > -1) { if (CitizensAPI.getNPCRegistry().getById(input.intValue()) == null) { - context.getForWhom().sendRawMessage(ChatColor.RED + "No NPC exists with that id!"); + context.getForWhom().sendRawMessage(ChatColor.RED + Lang.get("npcNonExistant")); return new SetNpcStartPrompt(); } @@ -508,7 +508,7 @@ public class QuestFactory implements ConversationAbandonedListener, ColorUtil { } else if (input.intValue() == -2) { return new CreateMenuPrompt(); } else { - context.getForWhom().sendRawMessage(ChatColor.RED + "No NPC exists with that id!"); + context.getForWhom().sendRawMessage(ChatColor.RED + Lang.get("npcNonExistant")); return new SetNpcStartPrompt(); } @@ -520,8 +520,7 @@ public class QuestFactory implements ConversationAbandonedListener, ColorUtil { @Override public String getPromptText(ConversationContext context) { - return ChatColor.YELLOW + "Right-click on a block to use as a start point, then enter \"done\" to save,\n" - + "or enter \"clear\" to clear the block start, or \"cancel\" to return"; + return ChatColor.YELLOW + Lang.get("enterBlockStart"); } @@ -529,9 +528,9 @@ public class QuestFactory implements ConversationAbandonedListener, ColorUtil { public Prompt acceptInput(ConversationContext context, String input) { Player player = (Player) context.getForWhom(); - if (input.equalsIgnoreCase("done") || input.equalsIgnoreCase("cancel")) { + if (input.equalsIgnoreCase(Lang.get("cmdDone")) || input.equalsIgnoreCase(Lang.get("cmdCancel"))) { - if (input.equalsIgnoreCase("done")) { + if (input.equalsIgnoreCase(Lang.get("cmdDone"))) { Block block = selectedBlockStarts.get(player); if (block != null) { @@ -539,7 +538,7 @@ public class QuestFactory implements ConversationAbandonedListener, ColorUtil { context.setSessionData(CK.Q_START_BLOCK, loc); selectedBlockStarts.remove(player); } else { - player.sendMessage(ChatColor.RED + "You must select a block first."); + player.sendMessage(ChatColor.RED + Lang.get("blockNotSelected")); return new BlockStartPrompt(); } @@ -550,7 +549,7 @@ public class QuestFactory implements ConversationAbandonedListener, ColorUtil { return new CreateMenuPrompt(); - } else if (input.equalsIgnoreCase("clear")) { + } else if (input.equalsIgnoreCase(Lang.get("cmdClear"))) { selectedBlockStarts.remove(player); context.setSessionData(CK.Q_START_BLOCK, null); @@ -568,14 +567,14 @@ public class QuestFactory implements ConversationAbandonedListener, ColorUtil { @Override public String getPromptText(ConversationContext context) { - return ChatColor.YELLOW + "Enter Quest name (or \'cancel\' to return)"; + return ChatColor.YELLOW + Lang.get("enterQuestName"); } @Override public Prompt acceptInput(ConversationContext context, String input) { - if (input.equalsIgnoreCase("cancel") == false) { + if (input.equalsIgnoreCase(Lang.get("cmdCancel")) == false) { for (Quest q : quests.quests) { @@ -586,7 +585,7 @@ public class QuestFactory implements ConversationAbandonedListener, ColorUtil { } if (s != null && s.equalsIgnoreCase(input) == false) { - context.getForWhom().sendRawMessage(RED + "A Quest with that name already exists!"); + context.getForWhom().sendRawMessage(RED + Lang.get("questNameExists")); return new SetNamePrompt(); } } @@ -594,13 +593,13 @@ public class QuestFactory implements ConversationAbandonedListener, ColorUtil { } if (names.contains(input)) { - context.getForWhom().sendRawMessage(RED + "Someone is creating/editing a Quest with that name!"); + context.getForWhom().sendRawMessage(RED + Lang.get("questBeingEdited")); return new SetNamePrompt(); } if (input.contains(",")) { - context.getForWhom().sendRawMessage(ChatColor.RED + "Name may not contain commas!"); + context.getForWhom().sendRawMessage(ChatColor.RED + Lang.get("questNameContainsCommas")); return new QuestNamePrompt(); } @@ -621,14 +620,14 @@ public class QuestFactory implements ConversationAbandonedListener, ColorUtil { @Override public String getPromptText(ConversationContext context) { - return ChatColor.YELLOW + "Enter ask message (or \'cancel\' to return)"; + return ChatColor.YELLOW + Lang.get("enterAskMessage"); } @Override public Prompt acceptInput(ConversationContext context, String input) { - if (input.equalsIgnoreCase("cancel") == false) { + if (input.equalsIgnoreCase(Lang.get("cmdCancel")) == false) { if (input.startsWith("++")) { if (context.getSessionData(CK.Q_ASK_MESSAGE) != null) { context.setSessionData(CK.Q_ASK_MESSAGE, context.getSessionData(CK.Q_ASK_MESSAGE) + " " + input.substring(2)); @@ -648,14 +647,14 @@ public class QuestFactory implements ConversationAbandonedListener, ColorUtil { @Override public String getPromptText(ConversationContext context) { - return ChatColor.YELLOW + "Enter finish message (or \'cancel\' to return)"; + return ChatColor.YELLOW + Lang.get("enterFinishMessage"); } @Override public Prompt acceptInput(ConversationContext context, String input) { - if (input.equalsIgnoreCase("cancel") == false) { + if (input.equalsIgnoreCase(Lang.get("cmdCancel")) == false) { if (input.startsWith("++")) { if (context.getSessionData(CK.Q_FINISH_MESSAGE) != null) { context.setSessionData(CK.Q_FINISH_MESSAGE, context.getSessionData(CK.Q_FINISH_MESSAGE) + " " + input.substring(2)); @@ -675,7 +674,7 @@ public class QuestFactory implements ConversationAbandonedListener, ColorUtil { @Override public String getPromptText(ConversationContext context) { - String text = DARKGREEN + "- Events -\n"; + String text = DARKGREEN + "- " + Lang.get("event") + " -\n"; if (quests.events.isEmpty()) { text += RED + "- None"; } else { @@ -684,7 +683,7 @@ public class QuestFactory implements ConversationAbandonedListener, ColorUtil { } } - return text + YELLOW + "Enter an Event name, or enter \"clear\" to clear the initial Event, or \"cancel\" to return"; + return text + YELLOW + Lang.get("questEditorEnterInitialEvent"); } @@ -693,7 +692,7 @@ public class QuestFactory implements ConversationAbandonedListener, ColorUtil { Player player = (Player) context.getForWhom(); - if (input.equalsIgnoreCase("cancel") == false && input.equalsIgnoreCase("clear") == false) { + if (input.equalsIgnoreCase(Lang.get("cmdCancel")) == false && input.equalsIgnoreCase(Lang.get("cmdClear")) == false) { Event found = null; @@ -707,16 +706,16 @@ public class QuestFactory implements ConversationAbandonedListener, ColorUtil { } if (found == null) { - player.sendMessage(RED + input + YELLOW + " is not a valid event name!"); + player.sendMessage(RED + input + YELLOW + " " + Lang.get("questEditorInvalidName")); return new InitialEventPrompt(); } else { context.setSessionData(CK.Q_INITIAL_EVENT, found.getName()); return new CreateMenuPrompt(); } - } else if (input.equalsIgnoreCase("clear")) { + } else if (input.equalsIgnoreCase(Lang.get("cmdClear"))) { context.setSessionData(CK.Q_INITIAL_EVENT, null); - player.sendMessage(YELLOW + "Initial Event cleared."); + player.sendMessage(YELLOW + Lang.get("questEditorEventCleared")); return new CreateMenuPrompt(); } else { return new CreateMenuPrompt(); @@ -730,7 +729,7 @@ public class QuestFactory implements ConversationAbandonedListener, ColorUtil { @Override public String getPromptText(ConversationContext context) { - return ChatColor.YELLOW + "Enter amount of time (in milliseconds), or 0 to clear the redo delay, or -1 to cancel"; + return ChatColor.YELLOW + Lang.get("questEditorEnterRedoDelay"); } @@ -738,7 +737,7 @@ public class QuestFactory implements ConversationAbandonedListener, ColorUtil { protected Prompt acceptValidatedInput(ConversationContext context, Number input) { if (input.longValue() < -1) { - context.getForWhom().sendRawMessage(ChatColor.RED + "Amount must be a positive number."); + context.getForWhom().sendRawMessage(ChatColor.RED + Lang.get("questEditorPositiveAmount")); } else if (input.longValue() == 0) { context.setSessionData(CK.Q_REDO_DELAY, null); } else if (input.longValue() != -1) { @@ -758,23 +757,23 @@ public class QuestFactory implements ConversationAbandonedListener, ColorUtil { String text = GREEN + "1 - Yes\n" + "2 - No"; - return ChatColor.YELLOW + "Finish and save \"" + AQUA + context.getSessionData(CK.Q_NAME) + YELLOW + "\"?\n" + text; + return ChatColor.YELLOW + Lang.get("questEditorSave") + " \"" + AQUA + context.getSessionData(CK.Q_NAME) + YELLOW + "\"?\n" + text; } @Override public Prompt acceptInput(ConversationContext context, String input) { - if (input.equalsIgnoreCase("1") || input.equalsIgnoreCase("Yes")) { + if (input.equalsIgnoreCase("1") || input.equalsIgnoreCase(Lang.get("yes"))) { if (context.getSessionData(CK.Q_ASK_MESSAGE) == null) { - context.getForWhom().sendRawMessage(RED + "You must set an ask message!"); + context.getForWhom().sendRawMessage(RED + Lang.get("questEditorNeedAskMessage")); return new CreateMenuPrompt(); } else if (context.getSessionData(CK.Q_FINISH_MESSAGE) == null) { - context.getForWhom().sendRawMessage(RED + "You must set a finish message!"); + context.getForWhom().sendRawMessage(RED + Lang.get("questEditorNeedFinishMessage")); return new CreateMenuPrompt(); } else if (StagesPrompt.getStages(context) == 0) { - context.getForWhom().sendRawMessage(RED + "Your Quest has no Stages!"); + context.getForWhom().sendRawMessage(RED + Lang.get("questEditorNeedStages")); return new CreateMenuPrompt(); } @@ -797,7 +796,7 @@ public class QuestFactory implements ConversationAbandonedListener, ColorUtil { ConfigurationSection newSection = questSection.createSection("custom" + customNum); saveQuest(context, newSection); data.save(new File(quests.getDataFolder(), "quests.yml")); - context.getForWhom().sendRawMessage(BOLD + "Quest saved! (You will need to perform a Quest reload for it to appear)"); + context.getForWhom().sendRawMessage(BOLD + Lang.get("questEditorSaved")); } catch (Exception e) { e.printStackTrace(); @@ -805,7 +804,7 @@ public class QuestFactory implements ConversationAbandonedListener, ColorUtil { return Prompt.END_OF_CONVERSATION; - } else if (input.equalsIgnoreCase("2") || input.equalsIgnoreCase("No")) { + } else if (input.equalsIgnoreCase("2") || input.equalsIgnoreCase(Lang.get("no"))) { return new CreateMenuPrompt(); } else { return new SavePrompt(); @@ -820,21 +819,21 @@ public class QuestFactory implements ConversationAbandonedListener, ColorUtil { public String getPromptText(ConversationContext context) { String text = GREEN - + "1 - Yes\n" - + "2 - No"; - return ChatColor.YELLOW + "Are you sure you want to exit without saving?\n" + text; + + "1 - " + Lang.get("yes") + "\n" + + "2 - " + Lang.get("no"); + return ChatColor.YELLOW + Lang.get("questEditorExited") + "\n" + text; } @Override public Prompt acceptInput(ConversationContext context, String input) { - if (input.equalsIgnoreCase("1") || input.equalsIgnoreCase("Yes")) { + if (input.equalsIgnoreCase("1") || input.equalsIgnoreCase(Lang.get("yes"))) { - context.getForWhom().sendRawMessage(BOLD + "" + YELLOW + "Exited."); + context.getForWhom().sendRawMessage(BOLD + "" + YELLOW + Lang.get("exited")); return Prompt.END_OF_CONVERSATION; - } else if (input.equalsIgnoreCase("2") || input.equalsIgnoreCase("No")) { + } else if (input.equalsIgnoreCase("2") || input.equalsIgnoreCase(Lang.get("no"))) { return new CreateMenuPrompt(); } else { return new ExitPrompt(); @@ -1695,14 +1694,14 @@ public class QuestFactory implements ConversationAbandonedListener, ColorUtil { @Override public String getPromptText(ConversationContext context) { - String text = GOLD + "- " + "Delete Quest" + " -\n"; + String text = GOLD + "- " + Lang.get("questEditorDelete") + " -\n"; for (Quest quest : quests.quests) { text += AQUA + quest.name + YELLOW + ","; } text = text.substring(0, text.length() - 1) + "\n"; - text += YELLOW + "Enter a Quest name, or \"cancel\" to return."; + text += YELLOW + Lang.get("questEditorEnterQuestName"); return text; @@ -1731,18 +1730,18 @@ public class QuestFactory implements ConversationAbandonedListener, ColorUtil { context.setSessionData(CK.ED_QUEST_DELETE, quest.name); return new DeletePrompt(); } else { - ((Player) context.getForWhom()).sendMessage(RED + "The following Quests have \"" + PURPLE + context.getSessionData(CK.ED_QUEST_DELETE) + RED + "\" as a requirement:"); + ((Player) context.getForWhom()).sendMessage(RED + Lang.get("questEditorQuestAsRequirement1") + " \"" + PURPLE + context.getSessionData(CK.ED_QUEST_DELETE) + RED + "\" " + Lang.get("questEditorQuestAsRequirement2")); for (String s : used) { ((Player) context.getForWhom()).sendMessage(RED + "- " + DARKRED + s); } - ((Player) context.getForWhom()).sendMessage(RED + "You must modify these Quests so that they do not use it before deleting it."); + ((Player) context.getForWhom()).sendMessage(RED + Lang.get("questEditorQuestAsRequirement3")); return new SelectDeletePrompt(); } } } - ((Player) context.getForWhom()).sendMessage(RED + "Quest not found!"); + ((Player) context.getForWhom()).sendMessage(RED + Lang.get("questEditorQuestNotFound")); return new SelectDeletePrompt(); } else { @@ -1758,8 +1757,8 @@ public class QuestFactory implements ConversationAbandonedListener, ColorUtil { public String getPromptText(ConversationContext context) { String text = - RED + "Are you sure you want to delete the Quest " + " \"" + GOLD + (String) context.getSessionData(CK.ED_QUEST_DELETE) + RED + "\"?\n"; - text += YELLOW + Lang.get("yes") + "/" + Lang.get("no"); + RED + Lang.get("questEditorDeleted") + " \"" + GOLD + (String) context.getSessionData(CK.ED_QUEST_DELETE) + RED + "\"?\n"; + text += YELLOW + Lang.get("yes") + "/" + Lang.get(Lang.get("no")); return text; @@ -1771,7 +1770,7 @@ public class QuestFactory implements ConversationAbandonedListener, ColorUtil { if (input.equalsIgnoreCase(Lang.get("yes"))) { deleteQuest(context); return Prompt.END_OF_CONVERSATION; - } else if (input.equalsIgnoreCase(Lang.get("no"))) { + } else if (input.equalsIgnoreCase(Lang.get(Lang.get("no")))) { return new MenuPrompt(); } else { return new DeletePrompt(); diff --git a/src/main/java/me/blackvein/quests/Quests.java b/src/main/java/me/blackvein/quests/Quests.java index 58e4fe260..210a0e949 100644 --- a/src/main/java/me/blackvein/quests/Quests.java +++ b/src/main/java/me/blackvein/quests/Quests.java @@ -1997,11 +1997,11 @@ public class Quests extends JavaPlugin implements ConversationAbandonedListener, if (config.contains("quests." + s + ".stages.ordered." + s2 + ".script-to-run")) { - if (ScriptRegistry.containsScript("quests." + s + ".stages.ordered." + s2 + ".script-to-run")) { + if (ScriptRegistry.containsScript(config.getString("quests." + s + ".stages.ordered." + s2 + ".script-to-run"))) { trigger = new QuestTaskTrigger(); stage.script = config.getString("quests." + s + ".stages.ordered." + s2 + ".script-to-run"); } else { - printSevere(GOLD + "[Quests] " + RED + "script-to-run: " + GOLD + "in " + PINK + "Stage " + s2 + GOLD + " of Quest " + PURPLE + quest.name + GOLD + " is not a Denizen script!"); + printSevere(GOLD + "[Quests] script-to-run: in Stage " + s2 + " of Quest " + quest.name + " is not a Denizen script!"); stageFailed = true; break; } @@ -2015,7 +2015,7 @@ public class Quests extends JavaPlugin implements ConversationAbandonedListener, if (checkList(config.getList("quests." + s + ".stages.ordered." + s2 + ".break-block-ids"), Integer.class)) { breakids = config.getIntegerList("quests." + s + ".stages.ordered." + s2 + ".break-block-ids"); } else { - printSevere(GOLD + "[Quests] " + RED + "break-block-ids: " + GOLD + "in " + PINK + "Stage " + s2 + GOLD + " of Quest " + PURPLE + quest.name + GOLD + " is not a list of numbers!"); + printSevere(GOLD + "[Quests] break-block-ids: in Stage " + s2 + " of Quest " + quest.name + " is not a list of numbers!"); stageFailed = true; break; } @@ -3558,9 +3558,12 @@ public class Quests extends JavaPlugin implements ConversationAbandonedListener, Calendar calendar = Calendar.getInstance(); calendar.setTimeInMillis(milliseconds); + + Calendar epoch = Calendar.getInstance(); + epoch.setTimeInMillis(0); - long days = calendar.get(Calendar.DAY_OF_YEAR) - 1; - long hours = calendar.get(Calendar.HOUR_OF_DAY) - 1; + long days = calendar.get(Calendar.DAY_OF_YEAR) - epoch.get(Calendar.DAY_OF_YEAR); + long hours = calendar.get(Calendar.HOUR_OF_DAY) - epoch.get(Calendar.HOUR_OF_DAY); long minutes = calendar.get(Calendar.MINUTE); long seconds = calendar.get(Calendar.SECOND); long milliSeconds2 = calendar.get(Calendar.MILLISECOND); diff --git a/src/main/java/me/blackvein/quests/util/Lang.java b/src/main/java/me/blackvein/quests/util/Lang.java index 86d8b011f..9fed44770 100644 --- a/src/main/java/me/blackvein/quests/util/Lang.java +++ b/src/main/java/me/blackvein/quests/util/Lang.java @@ -29,11 +29,60 @@ public class Lang { public void initPhrases(){ //English - - //Quests - en.put("enterQuestName", "Enter Quest name (or \"cancel\" to return)"); - - +//TODO: If finished, completely check everything. + //Quests + //Quest create menu + en.put("questEditorHeader", "Create Quest"); + en.put("questEditorCreate", "Create new Quest"); + en.put("questEditorEdit", "Edit a Quest"); + en.put("questEditorDelete", "Delete Quest"); + en.put("questEditorName", "Set name"); + + en.put("questEditorAskMessage", "Set ask message"); + en.put("questEditorFinishMessage", "Set finish message"); + en.put("questEditorRedoDelay", "Set redo delay"); + en.put("questEditorNPCStart", "Set NPC start"); + en.put("questEditorBlockStart", "Set Block start"); + en.put("questEditorInitialEvent", "Set initial Event"); + en.put("questEditorReqs", "Edit Requirements"); + en.put("questEditorStages", "Edit Stage"); + en.put("questEditorRews", "Edit Rewards"); + + en.put("questEditorEnterQuestName", "Enter Quest name (or \"cancel\" to return)"); + en.put("questEditorEnterAskMessage", "Enter ask message (or \"cancel\" to return)"); + en.put("questEditorEnterFinishMessage", "Enter finish message (or \"cancel\" to return)"); + en.put("questEditorEnterRedoDelay", "Enter amount of time (in milliseconds), 0 to clear the redo delay or -1 to cancel "); + en.put("questEditorEnterNPCStart", "Enter NPC ID, -1 to clear the NPC start or -2 to cancel"); + en.put("questEditorEnterBlockStart", "Right-click on a block to use as a start point, then enter \"done\" to save,\n" + + "or enter \"clear\" to clear the block start, or \"cancel\" to return"); + en.put("questEditorEnterInitialEvent", "Enter an Event name, or enter \"clear\" to clear the initial Event, or \"cancel\" to return"); + + //Quest create menu errors + en.put("questEditorNameExists", "A Quest with that name already exists!"); + en.put("questEditorBeingEdited", "Someone is creating/editing a Quest with that name!"); + en.put("questEditorInvalidQuestName", "Name may not contain commas!"); + en.put("questEditorInvalidEventName", "is not a valid event name!"); + en.put("questEditorInvalidNPC", "No NPC exists with that id!"); + en.put("questEditorNoStartBlockSelected", "You must select a block first."); + en.put("questEditorPositiveAmount", "Amount must be a positive number."); + en.put("questEditorQuestAsRequirement1", "The following Quests have"); + en.put("questEditorQuestAsRequirement2", "as a requirement:"); + en.put("questEditorQuestAsRequirement3", "You must modify these Quests so that they do not use it before deleting it."); + en.put("questEditorQuestNotFound", "Quest not found!"); + + en.put("questEditorEventCleared", "Initial Event cleared."); + en.put("questEditorSave", "Finish and save"); + + en.put("questEditorNeedAskMessage", "You must set an ask message!"); + en.put("questEditorNeedFinishMessage", "You must set a finish message!"); + en.put("questEditorNeedStages", "Your Quest has no Stages!"); + en.put("questEditorSaved", "Quest saved! (You will need to perform a Quest reload for it to appear)"); + en.put("questEditorExited", "Are you sure you want to exit without saving?"); + en.put("questEditorDeleted", "Are you sure you want to delete the Quest"); + + en.put("questEditorNoPermsCreate", "You do not have permission to create Quests."); + en.put("questEditorNoPermsEdit", "You do not have permission to edit Quests."); + en.put("questEditorNoPermsDelete", "You do not have permission to delete Quests."); // @@ -206,6 +255,7 @@ public class Lang { //Misc en.put("event", "Event"); + en.put("save", "save"); en.put("exit", "Exit"); en.put("exited", "Exited."); en.put("yes", "Yes"); diff --git a/src/main/resources/plugin.yml b/src/main/resources/plugin.yml index 055c5cbdc..710b9933c 100644 --- a/src/main/resources/plugin.yml +++ b/src/main/resources/plugin.yml @@ -1,110 +1,110 @@ -name: Quests -main: me.blackvein.quests.Quests -version: 1.6.4 -description: Player questing system -website: http://dev.bukkit.org/server-mods/quests/ -dev-url: https://github.com/Blackvein/Quests/ -authors: [Blackvein] -soft-depend: [Citizens, Vault] -permissions: - quests.quest: - description: View current Quest objectives - default: true - quests.questinfo: - description: View information about a Quest - default: true - quests.quests: - description: View Quests help - default: true - quests.list: - description: List Quests - default: true - quests.take: - description: Accept a Quest via command - default: true - quests.quit: - description: Quit current Quest - default: true - quests.stats: - description: View Questing statistics - default: true - quests.top: - description: View Questing leaderboards - default: true - quests.info: - description: View plugin information - default: true - quests.admin: - description: Base Questsadmin command - default: op - quests.admin.give: - description: Force a player to take a Quest (Overrides requirements) - default: op - quests.admin.quit: - description: Force a player to quit their current Quest - default: op - quests.admin.points: - description: Set a players Quest Points - default: op - quests.admin.takepoints: - description: Take away a players Quest Points - default: op - quests.admin.givepoints: - description: Give a player Quest Points - default: op - quests.admin.pointsall: - description: Set all players' Quest Points - default: op - quests.admin.finish: - description: Immediately force Quest completion for a player - default: op - quests.admin.nextstage: - description: Immediately force Stage completion for a player - default: op - quests.admin.reload: - description: Reload all Quests - default: op - quests.editor.editor: - description: Open Quests Editor - default: op - quests.editor.create: - description: Create new Quests - default: op - quests.editor.edit: - description: Edit Quests - default: op - quests.editor.delete: - description: Delete Quests - default: op - quests.editor.events.editor: - description: Open Events Editor - default: op - quests.editor.events.create: - description: Create new Events - default: op - quests.editor.events.edit: - description: Edit Events - default: op - quests.editor.events.delete: - description: Delete Events - default: op - quests.party.create: - description: Create/Disband Parties - default: true - quests.party.join: - description: Join parties without invitation - default: op -commands: - quests: - description: Quests command - permission: quests.quests - questadmin: - description: Quests admin command - permission: quests.admin - aliases: [questsadmin] - quest: - description: Quest command - permission: quests.quest - events: - description: Events +name: Quests +main: me.blackvein.quests.Quests +version: 1.6.7 +description: Player questing system +website: http://dev.bukkit.org/server-mods/quests/ +dev-url: https://github.com/Blackvein/Quests/ +authors: [Blackvein] +soft-depend: [Citizens, Vault] +permissions: + quests.quest: + description: View current Quest objectives + default: true + quests.questinfo: + description: View information about a Quest + default: true + quests.quests: + description: View Quests help + default: true + quests.list: + description: List Quests + default: true + quests.take: + description: Accept a Quest via command + default: true + quests.quit: + description: Quit current Quest + default: true + quests.stats: + description: View Questing statistics + default: true + quests.top: + description: View Questing leaderboards + default: true + quests.info: + description: View plugin information + default: true + quests.admin: + description: Base Questsadmin command + default: op + quests.admin.give: + description: Force a player to take a Quest (Overrides requirements) + default: op + quests.admin.quit: + description: Force a player to quit their current Quest + default: op + quests.admin.points: + description: Set a players Quest Points + default: op + quests.admin.takepoints: + description: Take away a players Quest Points + default: op + quests.admin.givepoints: + description: Give a player Quest Points + default: op + quests.admin.pointsall: + description: Set all players' Quest Points + default: op + quests.admin.finish: + description: Immediately force Quest completion for a player + default: op + quests.admin.nextstage: + description: Immediately force Stage completion for a player + default: op + quests.admin.reload: + description: Reload all Quests + default: op + quests.editor.editor: + description: Open Quests Editor + default: op + quests.editor.create: + description: Create new Quests + default: op + quests.editor.edit: + description: Edit Quests + default: op + quests.editor.delete: + description: Delete Quests + default: op + quests.editor.events.editor: + description: Open Events Editor + default: op + quests.editor.events.create: + description: Create new Events + default: op + quests.editor.events.edit: + description: Edit Events + default: op + quests.editor.events.delete: + description: Delete Events + default: op + quests.party.create: + description: Create/Disband Parties + default: true + quests.party.join: + description: Join parties without invitation + default: op +commands: + quests: + description: Quests command + permission: quests.quests + questadmin: + description: Quests admin command + permission: quests.admin + aliases: [questsadmin] + quest: + description: Quest command + permission: quests.quest + events: + description: Events permission: quests.editor \ No newline at end of file