diff --git a/api/pom.xml b/api/pom.xml index cc170fb0e..dd5c976f1 100644 --- a/api/pom.xml +++ b/api/pom.xml @@ -1,6 +1,6 @@ + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> 4.0.0 me.blackvein.quests diff --git a/core/src/main/java/me/blackvein/quests/Quests.java b/core/src/main/java/me/blackvein/quests/Quests.java index 730b91987..50078d507 100644 --- a/core/src/main/java/me/blackvein/quests/Quests.java +++ b/core/src/main/java/me/blackvein/quests/Quests.java @@ -806,8 +806,8 @@ public class Quests extends JavaPlugin implements QuestsAPI { loadQuests(); loadActions(); loadConditions(); - getLogger().log(Level.INFO, "Loaded " + quests.size() + " Quest(s), " + actions.size() + " IAction(s), " - + conditions.size() + " ICondition(s) and " + Lang.size() + " Phrase(s)"); + getLogger().log(Level.INFO, "Loaded " + quests.size() + " Quest(s), " + actions.size() + " Action(s), " + + conditions.size() + " Condition(s) and " + Lang.size() + " Phrase(s)"); for (final Player p : getServer().getOnlinePlayers()) { final IQuester quester = new Quester(Quests.this, p.getUniqueId()); if (!quester.hasData()) { diff --git a/core/src/main/java/me/blackvein/quests/convo/actions/main/ActionMainPrompt.java b/core/src/main/java/me/blackvein/quests/convo/actions/main/ActionMainPrompt.java index dc5ae0eb2..f75333ed0 100644 --- a/core/src/main/java/me/blackvein/quests/convo/actions/main/ActionMainPrompt.java +++ b/core/src/main/java/me/blackvein/quests/convo/actions/main/ActionMainPrompt.java @@ -117,7 +117,7 @@ public class ActionMainPrompt extends ActionsEditorNumericPrompt { return ChatColor.YELLOW + Lang.get("stageEditorDenizenScript"); } case 8: - return ChatColor.YELLOW + Lang.get("eventEditorFailQuest") + ":"; + return ChatColor.YELLOW + Lang.get("eventEditorFailQuest"); case 9: return ChatColor.GREEN + Lang.get("save"); case 10: @@ -173,7 +173,8 @@ public class ActionMainPrompt extends ActionsEditorNumericPrompt { if (context.getSessionData(CK.E_FAIL_QUEST) == null) { context.setSessionData(CK.E_FAIL_QUEST, Lang.get("noWord")); } - return "" + ChatColor.AQUA + context.getSessionData(CK.E_FAIL_QUEST); + return ChatColor.GRAY + "(" + ChatColor.AQUA + context.getSessionData(CK.E_FAIL_QUEST) + ChatColor.GRAY + + ")"; default: return null; } @@ -377,11 +378,11 @@ public class ActionMainPrompt extends ActionsEditorNumericPrompt { = new ActionsEditorPostOpenNumericPromptEvent(context, this); plugin.getServer().getPluginManager().callEvent(event); - final StringBuilder text = new StringBuilder(ChatColor.GOLD + getTitle(context) + "\n"); + final StringBuilder text = new StringBuilder(ChatColor.GOLD + getTitle(context)); for (int i = 1; i <= size; i++) { - text.append(getNumberColor(context, i)).append(ChatColor.BOLD).append(i).append(ChatColor.RESET) - .append(" - ").append(getSelectionText(context, i)).append(" ") - .append(getAdditionalText(context, i)).append("\n"); + text.append("\n").append(getNumberColor(context, i)).append(ChatColor.BOLD).append(i) + .append(ChatColor.RESET).append(" - ").append(getSelectionText(context, i)).append(" ") + .append(getAdditionalText(context, i)); } return text.toString(); } @@ -499,46 +500,46 @@ public class ActionMainPrompt extends ActionsEditorNumericPrompt { switch (number) { case 1: return "(" + (questMob.getName() == null ? Lang.get("noneSet") : ChatColor.AQUA + questMob.getName()) - + ChatColor.GRAY + ")\n"; + + ChatColor.GRAY + ")"; case 2: return "(" + (questMob.getType() == null ? Lang.get("noneSet") : ChatColor.AQUA - + questMob.getType().name()) + ChatColor.GRAY + ")\n"; + + questMob.getType().name()) + ChatColor.GRAY + ")"; case 3: return "(" + (questMob.getSpawnLocation() == null ? ChatColor.GRAY + Lang.get("noneSet") : ChatColor.AQUA - + ConfigUtil.getLocationInfo(questMob.getSpawnLocation())) + ChatColor.GRAY + ")\n"; + + ConfigUtil.getLocationInfo(questMob.getSpawnLocation())) + ChatColor.GRAY + ")"; case 4: return "(" + (questMob.getSpawnAmounts() == null ? ChatColor.GRAY + Lang.get("noneSet") : ChatColor.AQUA - + "" + questMob.getSpawnAmounts()) + ChatColor.GRAY + ")\n"; + + "" + questMob.getSpawnAmounts()) + ChatColor.GRAY + ")"; case 5: return "(" + (questMob.getInventory()[0] == null ? ChatColor.GRAY + Lang.get("noneSet") : ChatColor.AQUA - + ItemUtil.getDisplayString(questMob.getInventory()[0])) + ChatColor.GRAY + ")\n"; + + ItemUtil.getDisplayString(questMob.getInventory()[0])) + ChatColor.GRAY + ")"; case 6: return "(" + (questMob.getDropChances()[0] == null ? ChatColor.GRAY + Lang.get("noneSet") : ChatColor.AQUA - + "" + questMob.getDropChances()[0]) + ChatColor.GRAY + ")\n"; + + "" + questMob.getDropChances()[0]) + ChatColor.GRAY + ")"; case 7: return "(" + (questMob.getInventory()[1] == null ? ChatColor.GRAY + Lang.get("noneSet") : ChatColor.AQUA - + ItemUtil.getDisplayString(questMob.getInventory()[1])) + ChatColor.GRAY + ")\n"; + + ItemUtil.getDisplayString(questMob.getInventory()[1])) + ChatColor.GRAY + ")"; case 8: return "(" + (questMob.getDropChances()[1] == null ? ChatColor.GRAY + Lang.get("noneSet") : ChatColor.AQUA - + "" + questMob.getDropChances()[1]) + ChatColor.GRAY + ")\n"; + + "" + questMob.getDropChances()[1]) + ChatColor.GRAY + ")"; case 9: return "(" + (questMob.getInventory()[2] == null ? ChatColor.GRAY + Lang.get("noneSet") : ChatColor.AQUA - + ItemUtil.getDisplayString(questMob.getInventory()[2])) + ChatColor.GRAY + ")\n"; + + ItemUtil.getDisplayString(questMob.getInventory()[2])) + ChatColor.GRAY + ")"; case 10: return "(" + (questMob.getDropChances()[2] == null ? ChatColor.GRAY + Lang.get("noneSet") : ChatColor.AQUA - + "" + questMob.getDropChances()[2]) + ChatColor.GRAY + ")\n"; + + "" + questMob.getDropChances()[2]) + ChatColor.GRAY + ")"; case 11: return "(" + (questMob.getInventory()[3] == null ? ChatColor.GRAY + Lang.get("noneSet") : ChatColor.AQUA - + ItemUtil.getDisplayString(questMob.getInventory()[3])) + ChatColor.GRAY + ")\n"; + + ItemUtil.getDisplayString(questMob.getInventory()[3])) + ChatColor.GRAY + ")"; case 12: return "(" + (questMob.getDropChances()[3] == null ? ChatColor.GRAY + Lang.get("noneSet") : ChatColor.AQUA - + "" + questMob.getDropChances()[3]) + ChatColor.GRAY + ")\n"; + + "" + questMob.getDropChances()[3]) + ChatColor.GRAY + ")"; case 13: return "(" + (questMob.getInventory()[4] == null ? ChatColor.GRAY + Lang.get("noneSet") : ChatColor.AQUA - + ItemUtil.getDisplayString(questMob.getInventory()[4])) + ChatColor.GRAY + ")\n"; + + ItemUtil.getDisplayString(questMob.getInventory()[4])) + ChatColor.GRAY + ")"; case 14: return "(" + (questMob.getDropChances()[4] == null ? ChatColor.GRAY + Lang.get("noneSet") : ChatColor.AQUA - + "" + questMob.getDropChances()[4]) + ChatColor.GRAY + ")\n"; + + "" + questMob.getDropChances()[4]) + ChatColor.GRAY + ")"; case 15: case 16: return ""; @@ -567,9 +568,9 @@ public class ActionMainPrompt extends ActionsEditorNumericPrompt { final StringBuilder text = new StringBuilder(ChatColor.GOLD + getTitle(context)); for (int i = 1; i <= size; i++) { - text.append("\n").append(getNumberColor(context, i)).append(ChatColor.BOLD).append(i).append(ChatColor.RESET) - .append(" - ").append(getSelectionText(context, i)).append(ChatColor.GRAY).append(" ") - .append(getAdditionalText(context, i)); + text.append("\n").append(getNumberColor(context, i)).append(ChatColor.BOLD).append(i) + .append(ChatColor.RESET).append(" - ").append(getSelectionText(context, i)) + .append(ChatColor.GRAY).append(" ").append(getAdditionalText(context, i)); } return text.toString(); } @@ -733,7 +734,7 @@ public class ActionMainPrompt extends ActionsEditorNumericPrompt { if (context.getPlugin() != null) { context.getPlugin().getServer().getPluginManager().callEvent(event); } - + final StringBuilder mobs = new StringBuilder(ChatColor.LIGHT_PURPLE + getTitle(context) + "\n"); final EntityType[] mobArr = EntityType.values(); for (int i = 0; i < mobArr.length; i++) { @@ -973,10 +974,11 @@ public class ActionMainPrompt extends ActionsEditorNumericPrompt { context.getPlugin().getServer().getPluginManager().callEvent(event); } - final StringBuilder text = new StringBuilder(ChatColor.DARK_AQUA + "- " + getTitle(context) + " -\n"); - if (plugin.getDependencies().getDenizenApi().getScriptNames() != null) { + final StringBuilder text = new StringBuilder(ChatColor.DARK_AQUA + "- " + getTitle(context) + " -"); + if (plugin.getDependencies().getDenizenApi() != null + && plugin.getDependencies().getDenizenApi().getScriptNames() != null) { for (final String s : plugin.getDependencies().getDenizenApi().getScriptNames()) { - text.append(ChatColor.AQUA).append("- ").append(s).append("\n"); + text.append("\n").append(ChatColor.AQUA).append("- ").append(s); } } return text.toString() + ChatColor.YELLOW + getQueryText(context); @@ -1164,7 +1166,8 @@ public class ActionMainPrompt extends ActionsEditorNumericPrompt { final StringBuilder text = new StringBuilder(ChatColor.YELLOW + getQueryText(context)); for (int i = 1; i <= size; i++) { - text.append("\n").append(getNumberColor(context, i)).append(ChatColor.BOLD).append(i).append(ChatColor.RESET).append(" - ").append(getSelectionText(context, i)); + text.append("\n").append(getNumberColor(context, i)).append(ChatColor.BOLD).append(i) + .append(ChatColor.RESET).append(" - ").append(getSelectionText(context, i)); } return QuestsNumericPrompt.sendClickableSelection(text.toString(), context); } diff --git a/core/src/main/java/me/blackvein/quests/convo/actions/tasks/EffectPrompt.java b/core/src/main/java/me/blackvein/quests/convo/actions/tasks/EffectPrompt.java index b5660d5f8..cbee9b871 100644 --- a/core/src/main/java/me/blackvein/quests/convo/actions/tasks/EffectPrompt.java +++ b/core/src/main/java/me/blackvein/quests/convo/actions/tasks/EffectPrompt.java @@ -93,15 +93,15 @@ public class EffectPrompt extends ActionsEditorNumericPrompt { if (context.getSessionData(CK.E_EFFECTS) == null) { return ChatColor.GRAY + "(" + Lang.get("noneSet") + ")"; } else { - final StringBuilder text = new StringBuilder("\n"); + final StringBuilder text = new StringBuilder(); final LinkedList effects = (LinkedList) context.getSessionData(CK.E_EFFECTS); final LinkedList locations = (LinkedList) context.getSessionData(CK.E_EFFECTS_LOCATIONS); if (effects != null && locations != null) { for (final String effect : effects) { - text.append(ChatColor.GRAY).append(" - ").append(ChatColor.AQUA).append(effect) + text.append("\n").append(ChatColor.GRAY).append(" - ").append(ChatColor.AQUA).append(effect) .append(ChatColor.GRAY).append(" at ").append(ChatColor.DARK_AQUA) - .append(locations.get(effects.indexOf(effect))).append("\n"); + .append(locations.get(effects.indexOf(effect))); } } return text.toString(); @@ -110,11 +110,11 @@ public class EffectPrompt extends ActionsEditorNumericPrompt { if (context.getSessionData(CK.E_EXPLOSIONS) == null) { return ChatColor.GRAY + "(" + Lang.get("noneSet") + ")"; } else { - final StringBuilder text = new StringBuilder("\n"); + final StringBuilder text = new StringBuilder(); final LinkedList locations = (LinkedList) context.getSessionData(CK.E_EXPLOSIONS); if (locations != null) { for (final String loc : locations) { - text.append(ChatColor.GRAY).append(" - ").append(ChatColor.AQUA).append(loc).append("\n"); + text.append("\n").append(ChatColor.GRAY).append(" - ").append(ChatColor.AQUA).append(loc); } } return text.toString(); @@ -221,9 +221,9 @@ public class EffectPrompt extends ActionsEditorNumericPrompt { if (context.getSessionData(CK.E_EFFECTS) == null) { return ChatColor.GRAY + "(" + Lang.get("noneSet") + ")"; } else { - final StringBuilder text = new StringBuilder("\n"); + final StringBuilder text = new StringBuilder(); for (final String s : (List) Objects.requireNonNull(context.getSessionData(CK.E_EFFECTS))) { - text.append(ChatColor.GRAY).append(" - ").append(ChatColor.AQUA).append(s).append("\n"); + text.append("\n").append(ChatColor.GRAY).append(" - ").append(ChatColor.AQUA).append(s); } return text.toString(); } @@ -231,10 +231,10 @@ public class EffectPrompt extends ActionsEditorNumericPrompt { if (context.getSessionData(CK.E_EFFECTS_LOCATIONS) == null) { return ChatColor.GRAY + "(" + Lang.get("noneSet") + ")"; } else { - final StringBuilder text = new StringBuilder("\n"); + final StringBuilder text = new StringBuilder(); for (final String s : (List) Objects.requireNonNull(context .getSessionData(CK.E_EFFECTS_LOCATIONS))) { - text.append(ChatColor.GRAY).append(" - ").append(ChatColor.AQUA).append(s).append("\n"); + text.append("\n").append(ChatColor.GRAY).append(" - ").append(ChatColor.AQUA).append(s); } return text.toString(); } @@ -335,7 +335,7 @@ public class EffectPrompt extends ActionsEditorNumericPrompt { final ActionsEditorPostOpenStringPromptEvent event = new ActionsEditorPostOpenStringPromptEvent(context, this); plugin.getServer().getPluginManager().callEvent(event); - + final StringBuilder effects = new StringBuilder(ChatColor.LIGHT_PURPLE + getTitle(context) + "\n"); final Effect[] values = Effect.values(); for (int i = 0; i < values.length; i++) { @@ -345,7 +345,7 @@ public class EffectPrompt extends ActionsEditorNumericPrompt { } else { effects.append(MiscUtil.snakeCaseToUpperCamelCase(eff.name())).append("\n"); } - + } return effects.toString() + ChatColor.YELLOW + getQueryText(context); } diff --git a/core/src/main/java/me/blackvein/quests/convo/actions/tasks/PlayerPrompt.java b/core/src/main/java/me/blackvein/quests/convo/actions/tasks/PlayerPrompt.java index 8aa6cf1f2..3c8bd3bce 100644 --- a/core/src/main/java/me/blackvein/quests/convo/actions/tasks/PlayerPrompt.java +++ b/core/src/main/java/me/blackvein/quests/convo/actions/tasks/PlayerPrompt.java @@ -89,21 +89,21 @@ public class PlayerPrompt extends ActionsEditorNumericPrompt { case 1: return ChatColor.YELLOW + Lang.get("eventEditorSetMessage"); case 2: - return ChatColor.YELLOW + Lang.get("eventEditorClearInv"); - case 3: return ChatColor.YELLOW + Lang.get("eventEditorSetItems"); - case 4: + case 3: return ChatColor.YELLOW + Lang.get("eventEditorSetPotionEffects"); - case 5: + case 4: return ChatColor.YELLOW + Lang.get("eventEditorSetHunger"); - case 6: + case 5: return ChatColor.YELLOW + Lang.get("eventEditorSetSaturation"); - case 7: + case 6: return ChatColor.YELLOW + Lang.get("eventEditorSetHealth"); - case 8: + case 7: return ChatColor.YELLOW + Lang.get("eventEditorSetTeleport"); - case 9: + case 8: return ChatColor.YELLOW + Lang.get("eventEditorSetCommands"); + case 9: + return ChatColor.YELLOW + Lang.get("eventEditorClearInv"); case 10: return ChatColor.GREEN + Lang.get("done"); default: @@ -122,27 +122,25 @@ public class PlayerPrompt extends ActionsEditorNumericPrompt { return ChatColor.GRAY + "(" + ChatColor.AQUA + context.getSessionData(CK.E_MESSAGE) + ChatColor.GRAY + ")"; } case 2: - return ChatColor.AQUA + "" + context.getSessionData(CK.E_CLEAR_INVENTORY); - case 3: if (context.getSessionData(CK.E_ITEMS) == null) { return ChatColor.GRAY + "(" + Lang.get("noneSet") + ")"; } else { - final StringBuilder text = new StringBuilder("\n"); + final StringBuilder text = new StringBuilder(); final LinkedList items = (LinkedList) context.getSessionData(CK.E_ITEMS); if (items != null) { for (final ItemStack is : items) { if (is != null) { - text.append(ChatColor.GRAY).append(" - ").append(ItemUtil.getString(is)).append("\n"); + text.append("\n").append(ChatColor.GRAY).append(" - ").append(ItemUtil.getString(is)); } } return text.toString(); } } - case 4: + case 3: if (context.getSessionData(CK.E_POTION_TYPES) == null) { return ChatColor.GRAY + "(" + Lang.get("noneSet") + ")"; } else { - final StringBuilder text = new StringBuilder("\n"); + final StringBuilder text = new StringBuilder(); final LinkedList types = (LinkedList) context.getSessionData(CK.E_POTION_TYPES); final LinkedList durations = (LinkedList) context.getSessionData(CK.E_POTION_DURATIONS); final LinkedList mags = (LinkedList) context.getSessionData(CK.E_POTION_STRENGTH); @@ -150,53 +148,56 @@ public class PlayerPrompt extends ActionsEditorNumericPrompt { if (types != null && durations != null && mags != null) { for (final String type : types) { index++; - text.append(ChatColor.GRAY).append(" - ").append(ChatColor.AQUA).append(type) + text.append("\n").append(ChatColor.GRAY).append(" - ").append(ChatColor.AQUA).append(type) .append(ChatColor.DARK_PURPLE).append(" ").append(RomanNumeral.getNumeral(mags .get(index))).append(ChatColor.GRAY).append(" -> ").append(ChatColor.DARK_AQUA) - .append(MiscUtil.getTime(durations.get(index) * 50L)).append("\n"); + .append(MiscUtil.getTime(durations.get(index) * 50L)); } } return text.toString(); } - case 5: + case 4: if (context.getSessionData(CK.E_HUNGER) == null) { return ChatColor.GRAY + "(" + Lang.get("noneSet") + ")"; } else { return ChatColor.GRAY + "(" + ChatColor.AQUA + context.getSessionData(CK.E_HUNGER) + ChatColor.GRAY + ")"; } - case 6: + case 5: if (context.getSessionData(CK.E_SATURATION) == null) { return ChatColor.GRAY + "(" + Lang.get("noneSet") + ")"; } else { return ChatColor.GRAY + "(" + ChatColor.AQUA + context.getSessionData(CK.E_SATURATION) + ChatColor.GRAY + ")"; } - case 7: + case 6: if (context.getSessionData(CK.E_HEALTH) == null) { return ChatColor.GRAY + "(" + Lang.get("noneSet") + ")"; } else { return ChatColor.GRAY + "(" + ChatColor.AQUA + context.getSessionData(CK.E_HEALTH) + ChatColor.GRAY + ")"; } - case 8: + case 7: if (context.getSessionData(CK.E_TELEPORT) == null) { return ChatColor.GRAY + "(" + Lang.get("noneSet") + ")"; } else { return ChatColor.GRAY + "(" + ChatColor.AQUA + context.getSessionData(CK.E_TELEPORT) + ChatColor.GRAY + ")"; } - case 9: + case 8: if (context.getSessionData(CK.E_COMMANDS) == null) { return ChatColor.GRAY + "(" + Lang.get("noneSet") + ")"; } else { - final StringBuilder text = new StringBuilder("\n"); + final StringBuilder text = new StringBuilder(); for (final String s : (LinkedList) Objects.requireNonNull(context .getSessionData(CK.E_COMMANDS))) { - text.append(ChatColor.GRAY).append(" - ").append(ChatColor.AQUA).append(s).append("\n"); + text.append("\n").append(ChatColor.GRAY).append(" - ").append(ChatColor.AQUA).append(s); } return text.toString(); } + case 9: + return ChatColor.GRAY + "(" + ChatColor.AQUA + context.getSessionData(CK.E_CLEAR_INVENTORY) + ChatColor.GRAY + + ")"; case 10: return ""; default: @@ -229,26 +230,16 @@ public class PlayerPrompt extends ActionsEditorNumericPrompt { case 1: return new PlayerMessagePrompt(context); case 2: - final String s = (String) context.getSessionData(CK.E_CLEAR_INVENTORY); - if (s != null) { - if (s.equalsIgnoreCase(Lang.get("yesWord"))) { - context.setSessionData(CK.E_CLEAR_INVENTORY, Lang.get("noWord")); - } else { - context.setSessionData(CK.E_CLEAR_INVENTORY, Lang.get("yesWord")); - } - } - return new ActionMainPrompt(context); - case 3: return new PlayerItemListPrompt(context); + case 3: + return new PlayerPotionListPrompt(context); case 4: - return new PlayerPotionEffectPrompt(context); - case 5: return new PlayerHungerPrompt(context); - case 6: + case 5: return new PlayerSaturationPrompt(context); - case 7: + case 6: return new PlayerHealthPrompt(context); - case 8: + case 7: if (context.getForWhom() instanceof Player) { final Map selectedTeleportLocations = plugin.getActionFactory().getSelectedTeleportLocations(); selectedTeleportLocations.put(((Player) context.getForWhom()).getUniqueId(), null); @@ -258,13 +249,23 @@ public class PlayerPrompt extends ActionsEditorNumericPrompt { context.getForWhom().sendRawMessage(ChatColor.YELLOW + Lang.get("consoleError")); return new PlayerPrompt(context); } - case 9: + case 8: if (!plugin.hasLimitedAccess(context.getForWhom())) { return new PlayerCommandsPrompt(context); } else { context.getForWhom().sendRawMessage(ChatColor.RED + Lang.get("noPermission")); return new PlayerPrompt(context); } + case 9: + final String s = (String) context.getSessionData(CK.E_CLEAR_INVENTORY); + if (s != null) { + if (s.equalsIgnoreCase(Lang.get("yesWord"))) { + context.setSessionData(CK.E_CLEAR_INVENTORY, Lang.get("noWord")); + } else { + context.setSessionData(CK.E_CLEAR_INVENTORY, Lang.get("yesWord")); + } + } + return new PlayerPrompt(context); case 10: return new ActionMainPrompt(context); default: @@ -364,11 +365,11 @@ public class PlayerPrompt extends ActionsEditorNumericPrompt { if (context.getSessionData(CK.E_ITEMS) == null) { return ChatColor.GRAY + "(" + Lang.get("noneSet") + ")"; } else { - final StringBuilder text = new StringBuilder("\n"); + final StringBuilder text = new StringBuilder(); for (final ItemStack is : (List) Objects.requireNonNull(context .getSessionData(CK.E_ITEMS))) { - text.append(ChatColor.GRAY).append(" - ").append(ItemUtil.getDisplayString(is)) - .append("\n"); + text.append("\n").append(ChatColor.GRAY).append(" - ") + .append(ItemUtil.getDisplayString(is)); } return text.toString(); } @@ -430,9 +431,9 @@ public class PlayerPrompt extends ActionsEditorNumericPrompt { } } - public class PlayerPotionEffectPrompt extends ActionsEditorNumericPrompt { + public class PlayerPotionListPrompt extends ActionsEditorNumericPrompt { - public PlayerPotionEffectPrompt(final ConversationContext context) { + public PlayerPotionListPrompt(final ConversationContext context) { super(context); } @@ -490,10 +491,10 @@ public class PlayerPrompt extends ActionsEditorNumericPrompt { if (context.getSessionData(CK.E_POTION_TYPES) == null) { return ChatColor.GRAY + "(" + Lang.get("noneSet") + ")"; } else { - final StringBuilder text = new StringBuilder("\n"); + final StringBuilder text = new StringBuilder(); for (final String s : (LinkedList) Objects.requireNonNull(context .getSessionData(CK.E_POTION_TYPES))) { - text.append(ChatColor.GRAY).append(" - ").append(ChatColor.AQUA).append(s).append("\n"); + text.append("\n").append(ChatColor.GRAY).append(" - ").append(ChatColor.AQUA).append(s); } return text.toString(); } @@ -501,11 +502,11 @@ public class PlayerPrompt extends ActionsEditorNumericPrompt { if (context.getSessionData(CK.E_POTION_DURATIONS) == null) { return ChatColor.GRAY + "(" + Lang.get("noneSet") + ")"; } else { - final StringBuilder text = new StringBuilder("\n"); + final StringBuilder text = new StringBuilder(); for (final Long l : (LinkedList) Objects.requireNonNull(context .getSessionData(CK.E_POTION_DURATIONS))) { - text.append(ChatColor.GRAY).append(" - ").append(ChatColor.DARK_AQUA) - .append(MiscUtil.getTime(l * 50L)).append("\n"); + text.append("\n").append(ChatColor.GRAY).append(" - ").append(ChatColor.DARK_AQUA) + .append(MiscUtil.getTime(l * 50L)); } return text.toString(); } @@ -513,11 +514,11 @@ public class PlayerPrompt extends ActionsEditorNumericPrompt { if (context.getSessionData(CK.E_POTION_STRENGTH) == null) { return ChatColor.GRAY + "(" + Lang.get("noneSet") + ")"; } else { - final StringBuilder text = new StringBuilder("\n"); + final StringBuilder text = new StringBuilder(); for (final int i : (LinkedList) Objects.requireNonNull(context .getSessionData(CK.E_POTION_STRENGTH))) { - text.append(ChatColor.GRAY).append(" - ").append(ChatColor.DARK_PURPLE).append(i) - .append("\n"); + text.append("\n").append(ChatColor.GRAY).append(" - ").append(ChatColor.DARK_PURPLE) + .append(i); } return text.toString(); } @@ -553,7 +554,7 @@ public class PlayerPrompt extends ActionsEditorNumericPrompt { case 2: if (context.getSessionData(CK.E_POTION_TYPES) == null) { context.getForWhom().sendRawMessage(ChatColor.RED + Lang.get("eventEditorMustSetPotionTypesFirst")); - return new PlayerPotionEffectPrompt(context); + return new PlayerPotionListPrompt(context); } else { return new PlayerPotionDurationsPrompt(context); } @@ -561,11 +562,11 @@ public class PlayerPrompt extends ActionsEditorNumericPrompt { if (context.getSessionData(CK.E_POTION_TYPES) == null) { context.getForWhom().sendRawMessage(ChatColor.RED + Lang.get("eventEditorMustSetPotionTypesAndDurationsFirst")); - return new PlayerPotionEffectPrompt(context); + return new PlayerPotionListPrompt(context); } else if (context.getSessionData(CK.E_POTION_DURATIONS) == null) { context.getForWhom().sendRawMessage(ChatColor.RED + Lang.get("eventEditorMustSetPotionDurationsFirst")); - return new PlayerPotionEffectPrompt(context); + return new PlayerPotionListPrompt(context); } else { return new PlayerPotionMagnitudesPrompt(context); } @@ -574,7 +575,7 @@ public class PlayerPrompt extends ActionsEditorNumericPrompt { context.setSessionData(CK.E_POTION_TYPES, null); context.setSessionData(CK.E_POTION_DURATIONS, null); context.setSessionData(CK.E_POTION_STRENGTH, null); - return new PlayerPotionEffectPrompt(context); + return new PlayerPotionListPrompt(context); case 5: final int one; final int two; @@ -601,10 +602,10 @@ public class PlayerPrompt extends ActionsEditorNumericPrompt { return new ActionMainPrompt(context); } else { context.getForWhom().sendRawMessage(ChatColor.RED + Lang.get("eventEditorListSizeMismatch")); - return new PlayerPotionEffectPrompt(context); + return new PlayerPotionListPrompt(context); } default: - return new PlayerPotionEffectPrompt(context); + return new PlayerPotionListPrompt(context); } } } @@ -631,9 +632,9 @@ public class PlayerPrompt extends ActionsEditorNumericPrompt { = new ActionsEditorPostOpenStringPromptEvent(context, this); plugin.getServer().getPluginManager().callEvent(event); - final StringBuilder effs = new StringBuilder(ChatColor.LIGHT_PURPLE + getTitle(context) + "\n"); + final StringBuilder effs = new StringBuilder(ChatColor.LIGHT_PURPLE + getTitle(context)); for (final PotionEffectType pet : PotionEffectType.values()) { - effs.append(pet != null ? ChatColor.DARK_PURPLE + pet.getName() + "\n" : ""); + effs.append(pet != null ? "\n" + ChatColor.DARK_PURPLE + pet.getName() : ""); } return effs.toString() + ChatColor.YELLOW + getQueryText(context); } @@ -656,7 +657,7 @@ public class PlayerPrompt extends ActionsEditorNumericPrompt { } } } - return new PlayerPotionEffectPrompt(context); + return new PlayerPotionListPrompt(context); } } @@ -710,7 +711,7 @@ public class PlayerPrompt extends ActionsEditorNumericPrompt { } context.setSessionData(CK.E_POTION_DURATIONS, effDurations); } - return new PlayerPotionEffectPrompt(context); + return new PlayerPotionListPrompt(context); } } @@ -763,7 +764,7 @@ public class PlayerPrompt extends ActionsEditorNumericPrompt { } context.setSessionData(CK.E_POTION_STRENGTH, magAmounts); } - return new PlayerPotionEffectPrompt(context); + return new PlayerPotionListPrompt(context); } } diff --git a/core/src/main/java/me/blackvein/quests/convo/actions/tasks/TimerPrompt.java b/core/src/main/java/me/blackvein/quests/convo/actions/tasks/TimerPrompt.java index 82d2cab72..0bb5786d0 100644 --- a/core/src/main/java/me/blackvein/quests/convo/actions/tasks/TimerPrompt.java +++ b/core/src/main/java/me/blackvein/quests/convo/actions/tasks/TimerPrompt.java @@ -67,7 +67,7 @@ public class TimerPrompt extends ActionsEditorNumericPrompt { case 1: return ChatColor.YELLOW + Lang.get("eventEditorSetTimer"); case 2: - return ChatColor.YELLOW + Lang.get("eventEditorCancelTimer") + ":"; + return ChatColor.YELLOW + Lang.get("eventEditorCancelTimer"); case 3: return ChatColor.GREEN + Lang.get("done"); default: @@ -89,7 +89,8 @@ public class TimerPrompt extends ActionsEditorNumericPrompt { } } case 2: - return ChatColor.AQUA + "" + context.getSessionData(CK.E_CANCEL_TIMER); + return ChatColor.GRAY + "(" + ChatColor.AQUA + context.getSessionData(CK.E_CANCEL_TIMER) + ChatColor.GRAY + + ")"; case 3: return ""; default: diff --git a/core/src/main/java/me/blackvein/quests/convo/actions/tasks/WeatherPrompt.java b/core/src/main/java/me/blackvein/quests/convo/actions/tasks/WeatherPrompt.java index 670a683db..bfffc95e3 100644 --- a/core/src/main/java/me/blackvein/quests/convo/actions/tasks/WeatherPrompt.java +++ b/core/src/main/java/me/blackvein/quests/convo/actions/tasks/WeatherPrompt.java @@ -117,11 +117,11 @@ public class WeatherPrompt extends ActionsEditorNumericPrompt { if (context.getSessionData(CK.E_LIGHTNING) == null) { return ChatColor.GRAY + "(" + Lang.get("noneSet") + ")"; } else { - final StringBuilder text = new StringBuilder("\n"); + final StringBuilder text = new StringBuilder(); final LinkedList locations = (LinkedList) context.getSessionData(CK.E_LIGHTNING); if (locations != null) { for (final String loc : locations) { - text.append(ChatColor.GRAY).append(" - ").append(ChatColor.AQUA).append(loc).append("\n"); + text.append("\n").append(ChatColor.GRAY).append(" - ").append(ChatColor.AQUA).append(loc); } } return text.toString(); @@ -315,10 +315,10 @@ public class WeatherPrompt extends ActionsEditorNumericPrompt { = new ActionsEditorPostOpenStringPromptEvent(context, this); plugin.getServer().getPluginManager().callEvent(event); - StringBuilder effects = new StringBuilder(ChatColor.LIGHT_PURPLE + getTitle(context) + "\n" + StringBuilder effects = new StringBuilder(ChatColor.LIGHT_PURPLE + getTitle(context) + ChatColor.DARK_PURPLE); for (final World w : plugin.getServer().getWorlds()) { - effects.append(w.getName()).append(", "); + effects.append("\n").append(w.getName()).append(", "); } effects = new StringBuilder(effects.substring(0, effects.length())); return ChatColor.YELLOW + effects.toString() + getQueryText(context); @@ -532,10 +532,10 @@ public class WeatherPrompt extends ActionsEditorNumericPrompt { = new ActionsEditorPostOpenStringPromptEvent(context, this); plugin.getServer().getPluginManager().callEvent(event); - StringBuilder effects = new StringBuilder(ChatColor.LIGHT_PURPLE + getTitle(context) + "\n" + StringBuilder effects = new StringBuilder(ChatColor.LIGHT_PURPLE + getTitle(context) + ChatColor.DARK_PURPLE); for (final World w : plugin.getServer().getWorlds()) { - effects.append(w.getName()).append(", "); + effects.append("\n").append(w.getName()).append(", "); } effects = new StringBuilder(effects.substring(0, effects.length())); return ChatColor.YELLOW + effects.toString() + getQueryText(context); diff --git a/core/src/main/java/me/blackvein/quests/convo/conditions/main/ConditionMainPrompt.java b/core/src/main/java/me/blackvein/quests/convo/conditions/main/ConditionMainPrompt.java index 52f6a8cfb..96432efa4 100644 --- a/core/src/main/java/me/blackvein/quests/convo/conditions/main/ConditionMainPrompt.java +++ b/core/src/main/java/me/blackvein/quests/convo/conditions/main/ConditionMainPrompt.java @@ -333,11 +333,11 @@ public class ConditionMainPrompt extends ConditionsEditorNumericPrompt { context.getPlugin().getServer().getPluginManager().callEvent(event); } - final StringBuilder text = new StringBuilder(ChatColor.AQUA + getTitle(context) + "\n"); + final StringBuilder text = new StringBuilder(ChatColor.AQUA + getTitle(context)); for (int i = 1; i <= size; i++) { - text.append(getNumberColor(context, i)).append(ChatColor.BOLD).append(i).append(ChatColor.RESET) - .append(" - ").append(getSelectionText(context, i)).append(" ") - .append(getAdditionalText(context, i)).append("\n"); + text.append("\n").append(getNumberColor(context, i)).append(ChatColor.BOLD).append(i) + .append(ChatColor.RESET).append(" - ").append(getSelectionText(context, i)).append(" ") + .append(getAdditionalText(context, i)); } return text.toString(); } diff --git a/core/src/main/java/me/blackvein/quests/convo/conditions/tasks/EntityPrompt.java b/core/src/main/java/me/blackvein/quests/convo/conditions/tasks/EntityPrompt.java index 1c1875eec..461bc6d9b 100644 --- a/core/src/main/java/me/blackvein/quests/convo/conditions/tasks/EntityPrompt.java +++ b/core/src/main/java/me/blackvein/quests/convo/conditions/tasks/EntityPrompt.java @@ -187,7 +187,7 @@ public class EntityPrompt extends QuestsEditorNumericPrompt { = new QuestsEditorPostOpenStringPromptEvent(context, this); context.getPlugin().getServer().getPluginManager().callEvent(event); } - + final StringBuilder mobs = new StringBuilder(ChatColor.LIGHT_PURPLE + getTitle(context) + "\n"); final List mobArr = new LinkedList<>(Arrays.asList(EntityType.values())); final List toRemove = new LinkedList<>(); @@ -201,7 +201,7 @@ public class EntityPrompt extends QuestsEditorNumericPrompt { for (int i = 0; i < mobArr.size(); i++) { mobs.append(ChatColor.AQUA).append(MiscUtil.snakeCaseToUpperCamelCase(mobArr.get(i).name())); if (i < (mobArr.size() - 1)) { - mobs.append(ChatColor.GRAY).append(", "); + mobs.append(ChatColor.GRAY).append(", "); } } mobs.append("\n").append(ChatColor.YELLOW).append(getQueryText(context)); @@ -266,8 +266,7 @@ public class EntityPrompt extends QuestsEditorNumericPrompt { final Set selectingNpcs = plugin.getQuestFactory().getSelectingNpcs(); selectingNpcs.add(((Player) context.getForWhom()).getUniqueId()); plugin.getQuestFactory().setSelectingNpcs(selectingNpcs); - return ChatColor.YELLOW + getQueryText(context) + "\n" - + ChatColor.GOLD + Lang.get("npcHint"); + return ChatColor.YELLOW + getQueryText(context) + "\n" + ChatColor.GOLD + Lang.get("npcHint"); } else { return ChatColor.YELLOW + getQueryText(context); } diff --git a/core/src/main/java/me/blackvein/quests/convo/conditions/tasks/PlayerPrompt.java b/core/src/main/java/me/blackvein/quests/convo/conditions/tasks/PlayerPrompt.java index cfaeff141..6c943f827 100644 --- a/core/src/main/java/me/blackvein/quests/convo/conditions/tasks/PlayerPrompt.java +++ b/core/src/main/java/me/blackvein/quests/convo/conditions/tasks/PlayerPrompt.java @@ -263,13 +263,13 @@ public class PlayerPrompt extends QuestsEditorNumericPrompt { if (context.getSessionData(CK.C_WHILE_HOLDING_MAIN_HAND) == null) { return ChatColor.GRAY + "(" + Lang.get("noneSet") + ")"; } else { - final StringBuilder text = new StringBuilder("\n"); + final StringBuilder text = new StringBuilder(); final List whileHoldingMainHand = (List) context.getSessionData(CK.C_WHILE_HOLDING_MAIN_HAND); if (whileHoldingMainHand != null) { for (final ItemStack is : whileHoldingMainHand) { - text.append(ChatColor.GRAY).append(" - ").append(ItemUtil.getDisplayString(is)) - .append("\n"); + text.append("\n").append(ChatColor.GRAY).append(" - ") + .append(ItemUtil.getDisplayString(is)); } } return text.toString();