From 9ce12999c487607626267953269693aa15492724 Mon Sep 17 00:00:00 2001 From: Blackvein Date: Mon, 15 Oct 2012 12:04:23 -0700 Subject: [PATCH] Finished base Quest creation, doing Requirement setting --- src/me/blackvein/quests/Quest.java | 4 +- src/me/blackvein/quests/QuestFactory.java | 747 ++++++++++-------- src/me/blackvein/quests/Quests.java | 24 +- .../quests/prompts/RequirementPrompt.java | 50 ++ 4 files changed, 476 insertions(+), 349 deletions(-) create mode 100644 src/me/blackvein/quests/prompts/RequirementPrompt.java diff --git a/src/me/blackvein/quests/Quest.java b/src/me/blackvein/quests/Quest.java index 7770b8fdf..5bd4c51b1 100644 --- a/src/me/blackvein/quests/Quest.java +++ b/src/me/blackvein/quests/Quest.java @@ -234,10 +234,10 @@ public class Quest { } if(moneyReward > 1){ - player.sendMessage("- " + ChatColor.DARK_GREEN + moneyReward + " " + ChatColor.DARK_PURPLE + Quests.economy.currencyNamePlural()); + player.sendMessage("- " + ChatColor.DARK_GREEN + moneyReward + " " + ChatColor.DARK_PURPLE + Quests.getCurrency(true)); none = null; }else if(moneyReward == 1){ - player.sendMessage("- " + ChatColor.DARK_GREEN + moneyReward + " " + ChatColor.DARK_PURPLE + Quests.economy.currencyNameSingular()); + player.sendMessage("- " + ChatColor.DARK_GREEN + moneyReward + " " + ChatColor.DARK_PURPLE + Quests.getCurrency(false)); none = null; } diff --git a/src/me/blackvein/quests/QuestFactory.java b/src/me/blackvein/quests/QuestFactory.java index 8950aa0db..96f2c9ba3 100644 --- a/src/me/blackvein/quests/QuestFactory.java +++ b/src/me/blackvein/quests/QuestFactory.java @@ -1,343 +1,404 @@ -package me.blackvein.quests; - -import java.io.File; -import java.util.HashMap; -import java.util.Map; -import org.bukkit.ChatColor; -import org.bukkit.Location; -import org.bukkit.conversations.*; -import org.bukkit.entity.Player; - -public class QuestFactory implements ConversationAbandonedListener { - - Quests quests; - Map editSessions = new HashMap(); - ConversationFactory convoCreator; - static final ChatColor BOLD = ChatColor.BOLD; - static final ChatColor AQUA = ChatColor.AQUA; - static final ChatColor BLUE = ChatColor.BLUE; - static final ChatColor GOLD = ChatColor.GOLD; - static final ChatColor RED = ChatColor.RED; - static final ChatColor DARKRED = ChatColor.DARK_RED; - static final ChatColor YELLOW = ChatColor.YELLOW; - static final ChatColor RESET = ChatColor.RESET; - - File questsFile; - - @SuppressWarnings("LeakingThisInConstructor") - public QuestFactory(Quests plugin){ - - quests = plugin; - questsFile = new File(plugin.getDataFolder(), "quests.yml"); - - //Ensure to initialize convoCreator last, to ensure that 'this' is fully initialized before it is passed - this.convoCreator = new ConversationFactory(plugin) - .withModality(false) - .withLocalEcho(false) - .withPrefix(new QuestCreatorPrefix()) - .withFirstPrompt(new MenuPrompt()) - .withTimeout(3600) - .thatExcludesNonPlayersWithMessage("Console may not perform this operation!") - .addConversationAbandonedListener(this); - - } - - @Override - public void conversationAbandoned(ConversationAbandonedEvent abandonedEvent) { - - - - } - - private class QuestCreatorPrefix implements ConversationPrefix { - - @Override - public String getPrefix(ConversationContext context){ - - return ""; - - } - - } - - private class MenuPrompt extends FixedSetPrompt { - - public MenuPrompt(){ - - super ("1", "2", "3"); - - } - - @Override - public String getPromptText(ConversationContext context){ - - 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" - ; - - return text; - - } - - @Override - protected Prompt acceptValidatedInput(ConversationContext context, String input){ - - if(input.equalsIgnoreCase("1")) - return new QuestNamePrompt(); - - return null; - - } - - } - - private class CreateMenuPrompt extends FixedSetPrompt { - - public CreateMenuPrompt(){ - - super("1", "2", "3", "4", "5", "6"); - - } - - @Override - public String getPromptText(ConversationContext context){ - - String text = - GOLD + "- Quest: " + AQUA + context.getSessionData("questName") + GOLD + " -\n"; - - text += BLUE + "" + BOLD + "1" + RESET + YELLOW + " - Set name\n"; - - if(context.getSessionData("askMessage") == null) - text += BLUE + "" + BOLD + "2" + RESET + RED + " - Set ask message " + DARKRED + "(Required, none set)\n"; - else - text += BLUE + "" + BOLD + "2" + RESET + YELLOW + " - Set ask message (\"" + context.getSessionData("askMessage") + "\")\n"; - - if(context.getSessionData("finishMessage") == null) - text += BLUE + "" + BOLD + "3" + RESET + RED + " - Set finish message " + DARKRED + "(Required, none set)\n"; - else - text += BLUE + "" + BOLD + "3" + RESET + YELLOW + " - Set finish message (\"" + context.getSessionData("finishMessage") + "\")\n"; - - if(context.getSessionData("redoDelay") == null) - text += BLUE + "" + BOLD + "4" + RESET + YELLOW + " - Set redo delay (None set)"; - else - text += BLUE + "" + BOLD + "4" + RESET + YELLOW + " - Set redo delay (" + Quests.getTime((Long)context.getSessionData("redoDelay")) + ")"; - - if(context.getSessionData("npcStart") == null && quests.citizens != null) - text += BLUE + "" + BOLD + "5" + RESET + YELLOW + " - Set NPC start (None set)"; - else if(quests.citizens != null) - text += BLUE + "" + BOLD + "5" + RESET + YELLOW + " - Set NPC start (" + quests.citizens.getNPCRegistry().getById((Integer)context.getSessionData("npcStart")).getName() + ")"; - - if(context.getSessionData("blockStart") == null){ - - if(quests.citizens != null) - text += BLUE + "" + BOLD + "6" + RESET + YELLOW + " - Set Block start (None set)"; - else - text += BLUE + "" + BOLD + "5" + RESET + YELLOW + " - Set Block start (None set)"; - - }else{ - - if(quests.citizens != null){ - Location l = (Location) context.getSessionData("blockStart"); - text += BLUE + "" + BOLD + "6" + RESET + YELLOW + " - Set Block start (" + l.getWorld().getName() + ", " + l.getBlockX() + ", " + l.getBlockY() + ", " + l.getBlockZ() + ")"; - }else{ - Location l = (Location) context.getSessionData("blockStart"); - text += BLUE + "" + BOLD + "5" + RESET + YELLOW + " - Set Block start (" + l.getWorld().getName() + ", " + l.getBlockX() + ", " + l.getBlockY() + ", " + l.getBlockZ() + ")"; - } - - } - - return text; - - } - - @Override - public Prompt acceptValidatedInput(ConversationContext context, String input){ - - if(input.equalsIgnoreCase("1")){ - - return new SetNamePrompt(); - - }else if(input.equalsIgnoreCase("2")){ - - return new AskMessagePrompt(); - - }else if(input.equalsIgnoreCase("3")){ - - return new FinishMessagePrompt(); - - }else if(input.equalsIgnoreCase("4")){ - - return new RedoDelayPrompt(); - - } - - return null; - - } - - } - - private class QuestNamePrompt extends StringPrompt { - - @Override - public String getPromptText(ConversationContext context){ - - String text = - AQUA + "Create new Quest " + GOLD + "- Enter a name for the Quest (Or enter \'cancel\' to return to the main menu)" - ; - - return text; - - } - - @Override - public Prompt acceptInput(ConversationContext context, String input){ - - if(input.equalsIgnoreCase("cancel") == false){ - - for(Quest q : quests.quests){ - - if(q.name.equalsIgnoreCase(input)){ - - context.getForWhom().sendRawMessage(ChatColor.RED + "Quest already exists!"); - return new QuestNamePrompt(); - - } - - } - - context.setSessionData("questName", input); - return new CreateMenuPrompt(); - - }else{ - - return new MenuPrompt(); - - } - - } - - } - - private class SetNpcStartPrompt extends NumericPrompt { - - @Override - public String getPromptText(ConversationContext context){ - - return ChatColor.YELLOW + "Enter NPC ID (or -1 to return)"; - - } - - @Override - protected Prompt acceptValidatedInput(ConversationContext context, Number input){ - - if(input.intValue() != -1){ - - if(quests.citizens.getNPCRegistry().getById(input.intValue()) == null){ - context.getForWhom().sendRawMessage(ChatColor.RED + "No NPC exists with that id!"); - return new SetNpcStartPrompt(); - }else{ - context.setSessionData("") - } - - }else{ - return new CreateMenuPrompt(); - } - context.setSessionData("questName", input); - - return new CreateMenuPrompt(); - - } - - } - - private class SetNamePrompt extends StringPrompt { - - @Override - public String getPromptText(ConversationContext context){ - - return ChatColor.YELLOW + "Enter Quest name (or \'cancel\' to return)"; - - } - - @Override - public Prompt acceptInput(ConversationContext context, String input){ - - if(input.equalsIgnoreCase("cancel") == false) - context.setSessionData("questName", input); - - return new CreateMenuPrompt(); - - } - - } - - private class AskMessagePrompt extends StringPrompt { - - @Override - public String getPromptText(ConversationContext context){ - - return ChatColor.YELLOW + "Enter ask message (or \'cancel\' to return)"; - - } - - @Override - public Prompt acceptInput(ConversationContext context, String input){ - - if(input.equalsIgnoreCase("cancel") == false) - context.setSessionData("askMessage", input); - - return new CreateMenuPrompt(); - - } - - } - - private class FinishMessagePrompt extends StringPrompt { - - @Override - public String getPromptText(ConversationContext context){ - - return ChatColor.YELLOW + "Enter finish message (or \'cancel\' to return)"; - - } - - @Override - public Prompt acceptInput(ConversationContext context, String input){ - - if(input.equalsIgnoreCase("cancel") == false) - context.setSessionData("finishMessage", input); - - return new CreateMenuPrompt(); - - } - - } - - private class RedoDelayPrompt extends NumericPrompt{ - - @Override - public String getPromptText(ConversationContext context){ - - return ChatColor.YELLOW + "Enter amount of time (in milliseconds)"; - - } - - @Override - protected Prompt acceptValidatedInput(ConversationContext context, Number input){ - - if(input.longValue() < 0) - context.getForWhom().sendRawMessage(ChatColor.RED + "Amount must be a positive number."); - else - context.setSessionData("redoDelay", input.longValue()); - - return new CreateMenuPrompt(); - - } - - } - -} +package me.blackvein.quests; + +import java.io.File; +import java.util.HashMap; +import java.util.Map; +import org.bukkit.ChatColor; +import org.bukkit.Location; +import org.bukkit.conversations.*; +import org.bukkit.entity.Player; + +public class QuestFactory implements ConversationAbandonedListener { + + Quests quests; + Map editSessions = new HashMap(); + ConversationFactory convoCreator; + static final ChatColor BOLD = ChatColor.BOLD; + static final ChatColor AQUA = ChatColor.AQUA; + static final ChatColor DARKAQUA = ChatColor.DARK_AQUA; + static final ChatColor BLUE = ChatColor.BLUE; + static final ChatColor GOLD = ChatColor.GOLD; + static final ChatColor PINK = ChatColor.LIGHT_PURPLE; + static final ChatColor GREEN = ChatColor.GREEN; + static final ChatColor RED = ChatColor.RED; + static final ChatColor DARKRED = ChatColor.DARK_RED; + static final ChatColor YELLOW = ChatColor.YELLOW; + static final ChatColor RESET = ChatColor.RESET; + + File questsFile; + + @SuppressWarnings("LeakingThisInConstructor") + public QuestFactory(Quests plugin){ + + quests = plugin; + questsFile = new File(plugin.getDataFolder(), "quests.yml"); + + //Ensure to initialize convoCreator last, to ensure that 'this' is fully initialized before it is passed + this.convoCreator = new ConversationFactory(plugin) + .withModality(false) + .withLocalEcho(false) + .withPrefix(new QuestCreatorPrefix()) + .withFirstPrompt(new MenuPrompt()) + .withTimeout(3600) + .thatExcludesNonPlayersWithMessage("Console may not perform this operation!") + .addConversationAbandonedListener(this); + + } + + @Override + public void conversationAbandoned(ConversationAbandonedEvent abandonedEvent) { + + + + } + + private class QuestCreatorPrefix implements ConversationPrefix { + + @Override + public String getPrefix(ConversationContext context){ + + return ""; + + } + + } + + private class MenuPrompt extends FixedSetPrompt { + + public MenuPrompt(){ + + super ("1", "2", "3"); + + } + + @Override + public String getPromptText(ConversationContext context){ + + 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" + ; + + return text; + + } + + @Override + protected Prompt acceptValidatedInput(ConversationContext context, String input){ + + if(input.equalsIgnoreCase("1")) + return new QuestNamePrompt(); + + return null; + + } + + } + + private class CreateMenuPrompt extends FixedSetPrompt { + + public CreateMenuPrompt(){ + + super("1", "2", "3", "4", "5", "6"); + + } + + @Override + public String getPromptText(ConversationContext context){ + + String text = + GOLD + "- Quest: " + AQUA + context.getSessionData("questName") + GOLD + " -\n"; + + text += BLUE + "" + BOLD + "1" + RESET + YELLOW + " - Set name\n"; + + if(context.getSessionData("askMessage") == null) + text += BLUE + "" + BOLD + "2" + RESET + RED + " - Set ask message " + DARKRED + "(Required, none set)\n"; + else + text += BLUE + "" + BOLD + "2" + RESET + YELLOW + " - Set ask message (\"" + context.getSessionData("askMessage") + "\")\n"; + + if(context.getSessionData("finishMessage") == null) + text += BLUE + "" + BOLD + "3" + RESET + RED + " - Set finish message " + DARKRED + "(Required, none set)\n"; + else + text += BLUE + "" + BOLD + "3" + RESET + YELLOW + " - Set finish message (\"" + context.getSessionData("finishMessage") + "\")\n"; + + if(context.getSessionData("redoDelay") == null) + text += BLUE + "" + BOLD + "4" + RESET + YELLOW + " - Set redo delay (None set)"; + else + text += BLUE + "" + BOLD + "4" + RESET + YELLOW + " - Set redo delay (" + Quests.getTime((Long)context.getSessionData("redoDelay")) + ")"; + + if(context.getSessionData("npcStart") == null && quests.citizens != null) + text += BLUE + "" + BOLD + "5" + RESET + YELLOW + " - Set NPC start (None set)"; + else if(quests.citizens != null) + text += BLUE + "" + BOLD + "5" + RESET + YELLOW + " - Set NPC start (" + quests.citizens.getNPCRegistry().getById((Integer)context.getSessionData("npcStart")).getName() + ")"; + + if(context.getSessionData("blockStart") == null){ + + if(quests.citizens != null) + text += BLUE + "" + BOLD + "6" + RESET + YELLOW + " - Set Block start (None set)"; + else + text += BLUE + "" + BOLD + "5" + RESET + YELLOW + " - Set Block start (None set)"; + + }else{ + + if(quests.citizens != null){ + Location l = (Location) context.getSessionData("blockStart"); + text += BLUE + "" + BOLD + "6" + RESET + YELLOW + " - Set Block start (" + l.getWorld().getName() + ", " + l.getBlockX() + ", " + l.getBlockY() + ", " + l.getBlockZ() + ")"; + }else{ + Location l = (Location) context.getSessionData("blockStart"); + text += BLUE + "" + BOLD + "5" + RESET + YELLOW + " - Set Block start (" + l.getWorld().getName() + ", " + l.getBlockX() + ", " + l.getBlockY() + ", " + l.getBlockZ() + ")"; + } + + } + + if(quests.citizens != null){ + text += BLUE + "" + BOLD + "7" + RESET + DARKAQUA + " - Edit Requirements"; + }else{ + text += BLUE + "" + BOLD + "6" + RESET + DARKAQUA + " - Edit Requirements"; + } + + if(quests.citizens != null){ + text += BLUE + "" + BOLD + "8" + RESET + PINK + " - Edit Stages"; + }else{ + text += BLUE + "" + BOLD + "7" + RESET + PINK + " - Edit Stages"; + } + + if(quests.citizens != null){ + text += BLUE + "" + BOLD + "9" + RESET + GREEN + " - Edit Rewards"; + }else{ + text += BLUE + "" + BOLD + "8" + RESET + GREEN + " - Edit Rewards"; + } + + return text; + + } + + @Override + public Prompt acceptValidatedInput(ConversationContext context, String input){ + + if(input.equalsIgnoreCase("1")){ + + return new SetNamePrompt(); + + }else if(input.equalsIgnoreCase("2")){ + + return new AskMessagePrompt(); + + }else if(input.equalsIgnoreCase("3")){ + + return new FinishMessagePrompt(); + + }else if(input.equalsIgnoreCase("4")){ + + return new RedoDelayPrompt(); + + }else if(input.equalsIgnoreCase("5")){ + + if(quests.citizens != null){ + return new SetNpcStartPrompt(); + }else{ + return new BlockStartPrompt(); + } + + }else if(input.equalsIgnoreCase("6")){ + + + + } + + return null; + + } + + } + + private class QuestNamePrompt extends StringPrompt { + + @Override + public String getPromptText(ConversationContext context){ + + String text = + AQUA + "Create new Quest " + GOLD + "- Enter a name for the Quest (Or enter \'cancel\' to return to the main menu)" + ; + + return text; + + } + + @Override + public Prompt acceptInput(ConversationContext context, String input){ + + if(input.equalsIgnoreCase("cancel") == false){ + + for(Quest q : quests.quests){ + + if(q.name.equalsIgnoreCase(input)){ + + context.getForWhom().sendRawMessage(ChatColor.RED + "Quest already exists!"); + return new QuestNamePrompt(); + + } + + } + + context.setSessionData("questName", input); + return new CreateMenuPrompt(); + + }else{ + + return new MenuPrompt(); + + } + + } + + } + + private class SetNpcStartPrompt extends NumericPrompt { + + @Override + public String getPromptText(ConversationContext context){ + + return ChatColor.YELLOW + "Enter NPC ID (or -1 to return)"; + + } + + @Override + protected Prompt acceptValidatedInput(ConversationContext context, Number input){ + + if(input.intValue() != -1){ + + if(quests.citizens.getNPCRegistry().getById(input.intValue()) == null){ + context.getForWhom().sendRawMessage(ChatColor.RED + "No NPC exists with that id!"); + return new SetNpcStartPrompt(); + } + + context.setSessionData("npcStart", input); + + } + + return new CreateMenuPrompt(); + + } + + } + + private class BlockStartPrompt extends StringPrompt { + + @Override + public String getPromptText(ConversationContext context){ + + return ChatColor.YELLOW + "Enter location, in the format \"WorldName x y z\", or \"cancel\" to return"; + + } + + @Override + public Prompt acceptInput(ConversationContext context, String input){ + + if(input.equalsIgnoreCase("input") == false){ + + if(Quests.getLocation(input) == null){ + + context.getForWhom().sendRawMessage(ChatColor.RED + "Invalid location."); + return new BlockStartPrompt(); + + } + + context.setSessionData("blockStart", Quests.getLocation(input)); + + } + + return new CreateMenuPrompt(); + + } + + } + + private class SetNamePrompt extends StringPrompt { + + @Override + public String getPromptText(ConversationContext context){ + + return ChatColor.YELLOW + "Enter Quest name (or \'cancel\' to return)"; + + } + + @Override + public Prompt acceptInput(ConversationContext context, String input){ + + if(input.equalsIgnoreCase("cancel") == false) + context.setSessionData("questName", input); + + return new CreateMenuPrompt(); + + } + + } + + private class AskMessagePrompt extends StringPrompt { + + @Override + public String getPromptText(ConversationContext context){ + + return ChatColor.YELLOW + "Enter ask message (or \'cancel\' to return)"; + + } + + @Override + public Prompt acceptInput(ConversationContext context, String input){ + + if(input.equalsIgnoreCase("cancel") == false) + context.setSessionData("askMessage", input); + + return new CreateMenuPrompt(); + + } + + } + + private class FinishMessagePrompt extends StringPrompt { + + @Override + public String getPromptText(ConversationContext context){ + + return ChatColor.YELLOW + "Enter finish message (or \'cancel\' to return)"; + + } + + @Override + public Prompt acceptInput(ConversationContext context, String input){ + + if(input.equalsIgnoreCase("cancel") == false) + context.setSessionData("finishMessage", input); + + return new CreateMenuPrompt(); + + } + + } + + private class RedoDelayPrompt extends NumericPrompt{ + + @Override + public String getPromptText(ConversationContext context){ + + return ChatColor.YELLOW + "Enter amount of time (in milliseconds)"; + + } + + @Override + protected Prompt acceptValidatedInput(ConversationContext context, Number input){ + + if(input.longValue() < 0) + context.getForWhom().sendRawMessage(ChatColor.RED + "Amount must be a positive number."); + else + context.setSessionData("redoDelay", input.longValue()); + + return new CreateMenuPrompt(); + + } + + } + +} diff --git a/src/me/blackvein/quests/Quests.java b/src/me/blackvein/quests/Quests.java index bfe0e1269..0fafe916a 100644 --- a/src/me/blackvein/quests/Quests.java +++ b/src/me/blackvein/quests/Quests.java @@ -400,15 +400,15 @@ public class Quests extends JavaPlugin implements ConversationAbandonedListener{ if (economy.getBalance(quester.name) >= quest.moneyReq) { if (quest.moneyReq == 1) { - cs.sendMessage(ChatColor.GRAY + "- " + ChatColor.GREEN + quest.moneyReq + " " + economy.currencyNameSingular()); + cs.sendMessage(ChatColor.GRAY + "- " + ChatColor.GREEN + quest.moneyReq + " " + Quests.getCurrency(false)); } else { - cs.sendMessage(ChatColor.GRAY + "- " + ChatColor.GREEN + quest.moneyReq + " " + economy.currencyNamePlural()); + cs.sendMessage(ChatColor.GRAY + "- " + ChatColor.GREEN + quest.moneyReq + " " + Quests.getCurrency(true)); } } else { if (quest.moneyReq == 1) { - cs.sendMessage(ChatColor.GRAY + "- " + ChatColor.RED + quest.moneyReq + " " + economy.currencyNameSingular()); + cs.sendMessage(ChatColor.GRAY + "- " + ChatColor.RED + quest.moneyReq + " " + Quests.getCurrency(false)); } else { - cs.sendMessage(ChatColor.GRAY + "- " + ChatColor.RED + quest.moneyReq + " " + economy.currencyNamePlural()); + cs.sendMessage(ChatColor.GRAY + "- " + ChatColor.RED + quest.moneyReq + " " + Quests.getCurrency(true)); } } @@ -3489,6 +3489,22 @@ public class Quests extends JavaPlugin implements ConversationAbandonedListener{ } } + + public static String getCurrency(boolean plural){ + + if(plural){ + if(Quests.economy.currencyNamePlural().trim().isEmpty()) + return "Money"; + else + return Quests.economy.currencyNamePlural(); + }else{ + if(Quests.economy.currencyNameSingular().trim().isEmpty()) + return "Money"; + else + return Quests.economy.currencyNameSingular(); + } + + } public static boolean removeItem(Inventory inventory, Material type, int amount) { diff --git a/src/me/blackvein/quests/prompts/RequirementPrompt.java b/src/me/blackvein/quests/prompts/RequirementPrompt.java new file mode 100644 index 000000000..e92f335e1 --- /dev/null +++ b/src/me/blackvein/quests/prompts/RequirementPrompt.java @@ -0,0 +1,50 @@ +package me.blackvein.quests.prompts; + +import me.blackvein.quests.Quests; +import org.bukkit.ChatColor; +import org.bukkit.conversations.ConversationContext; +import org.bukkit.conversations.FixedSetPrompt; +import org.bukkit.conversations.Prompt; + + +public class RequirementPrompt extends FixedSetPrompt{ + + static final ChatColor BOLD = ChatColor.BOLD; + static final ChatColor AQUA = ChatColor.AQUA; + static final ChatColor DARKAQUA = ChatColor.DARK_AQUA; + static final ChatColor BLUE = ChatColor.BLUE; + static final ChatColor GOLD = ChatColor.GOLD; + static final ChatColor PINK = ChatColor.LIGHT_PURPLE; + static final ChatColor GREEN = ChatColor.GREEN; + static final ChatColor RED = ChatColor.RED; + static final ChatColor DARKRED = ChatColor.DARK_RED; + static final ChatColor YELLOW = ChatColor.YELLOW; + static final ChatColor RESET = ChatColor.RESET; + + @Override + public String getPromptText(ConversationContext context){ + + String text; + + text = DARKAQUA + "- " + AQUA + context.getSessionData("questName") + AQUA + " | Requirements -\n"; + + if(context.getSessionData("moneyReq") == null) + text += BLUE + "" + BOLD + "1" + RESET + YELLOW + " - Set money requirement (None set)\n"; + else{ + int moneyReq = (Integer) context.getSessionData("moneyReq"); + text += BLUE + "" + BOLD + "1" + RESET + YELLOW + " - Set money requirement (" + context.getSessionData("moneyReq") + " " + (moneyReq > 1 ? Quests.getCurrency(true) : Quests.getCurrency(false)) + " )\n"; + } + + + return text; + + } + + @Override + protected Prompt acceptValidatedInput(ConversationContext context, String input){ + + return null; + + } + +}