From ed0beae1ece21a74ed5c1811301037e723a40a54 Mon Sep 17 00:00:00 2001 From: PikaMug Date: Tue, 2 Jul 2019 15:35:30 -0400 Subject: [PATCH] Configurable progress sharing level for multiplayer quests, fixes #679 --- .../java/me/blackvein/quests/Options.java | 9 ++ .../main/java/me/blackvein/quests/Quest.java | 62 ++++---- .../me/blackvein/quests/QuestFactory.java | 9 +- .../java/me/blackvein/quests/Quester.java | 143 ++++++++++-------- .../main/java/me/blackvein/quests/Quests.java | 3 + .../quests/actions/ActionFactory.java | 17 +-- .../quests/listeners/CmdExecutor.java | 50 +++--- .../quests/prompts/CreateStagePrompt.java | 9 +- .../quests/prompts/ItemStackPrompt.java | 2 +- .../blackvein/quests/prompts/MobsPrompt.java | 9 +- .../quests/prompts/OptionsPrompt.java | 44 +++++- .../quests/prompts/PlannerPrompt.java | 6 +- .../quests/prompts/RequirementsPrompt.java | 6 +- .../quests/prompts/RewardsPrompt.java | 9 +- .../java/me/blackvein/quests/util/CK.java | 1 + main/src/main/resources/strings.yml | 8 +- 16 files changed, 220 insertions(+), 167 deletions(-) diff --git a/main/src/main/java/me/blackvein/quests/Options.java b/main/src/main/java/me/blackvein/quests/Options.java index e432e187d..f559231c7 100644 --- a/main/src/main/java/me/blackvein/quests/Options.java +++ b/main/src/main/java/me/blackvein/quests/Options.java @@ -17,6 +17,7 @@ public class Options { private boolean allowQuitting = true; private boolean useDungeonsXLPlugin = false; private boolean usePartiesPlugin = true; + private int shareProgressLevel = 1; public boolean getAllowCommands() { return allowCommands; @@ -49,4 +50,12 @@ public class Options { public void setUsePartiesPlugin(boolean usePartiesPlugin) { this.usePartiesPlugin = usePartiesPlugin; } + + public int getShareProgressLevel() { + return shareProgressLevel; + } + + public void setShareProgressLevel(int shareProgressLevel) { + this.shareProgressLevel = shareProgressLevel; + } } \ No newline at end of file diff --git a/main/src/main/java/me/blackvein/quests/Quest.java b/main/src/main/java/me/blackvein/quests/Quest.java index 99c14687c..3bc2b2272 100644 --- a/main/src/main/java/me/blackvein/quests/Quest.java +++ b/main/src/main/java/me/blackvein/quests/Quest.java @@ -14,9 +14,9 @@ package me.blackvein.quests; import java.util.Iterator; import java.util.LinkedList; +import java.util.List; import java.util.Map; import java.util.Map.Entry; -import java.util.UUID; import org.bukkit.Bukkit; import org.bukkit.ChatColor; @@ -27,7 +27,6 @@ import org.bukkit.inventory.ItemFlag; import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.PlayerInventory; -import com.alessiodp.parties.api.interfaces.Party; import com.codisimus.plugins.phatloots.PhatLootsAPI; import com.codisimus.plugins.phatloots.loot.CommandLoot; import com.codisimus.plugins.phatloots.loot.LootBundle; @@ -37,7 +36,6 @@ import com.herocraftonline.heroes.characters.Hero; import com.sk89q.worldguard.protection.ApplicableRegionSet; import com.sk89q.worldguard.protection.regions.ProtectedRegion; -import de.erethon.dungeonsxl.player.DGroup; import me.blackvein.quests.actions.Action; import me.blackvein.quests.events.quester.QuesterPostChangeStageEvent; import me.blackvein.quests.events.quester.QuesterPostCompleteQuestEvent; @@ -185,36 +183,6 @@ public class Quest { if (q.getCurrentStage(this).finishEvent != null) { q.getCurrentStage(this).finishEvent.fire(q, this); } - if (plugin.getDependencies().getPartiesApi() != null) { - if (opts.getUsePartiesPlugin()) { - Party party = plugin.getDependencies().getPartiesApi().getParty(plugin.getDependencies().getPartiesApi().getPartyPlayer(q.getUUID()).getPartyName()); - if (party != null) { - for (UUID id : party.getMembers()) { - if (!id.equals(q.getUUID())) { - if (plugin.getQuester(id).getCurrentQuests().containsKey(this)) { - completeQuest(plugin.getQuester(id)); - } - } - } - plugin.getLogger().info("Quest \'" + name + "\' was completed by party " + party.getName() + " (" + party.getMembers().size() + " members)"); - } - } - } - if (plugin.getDependencies().getDungeonsApi() != null) { - if (opts.getUseDungeonsXLPlugin()) { - DGroup group = DGroup.getByPlayer(q.getPlayer()); - if (group != null) { - for (UUID id : group.getPlayers().getUniqueIds()) { - if (!id.equals(q.getUUID())) { - if (plugin.getQuester(id).getCurrentQuests().containsKey(this)) { - completeQuest(plugin.getQuester(id)); - } - } - } - plugin.getLogger().info("Quest \'" + name + "\' was completed by group " + group.getName() + " (" + group.getPlayers().size() + " players)"); - } - } - } completeQuest(q); } else { try { @@ -225,6 +193,22 @@ public class Quest { } catch (InvalidStageException e) { e.printStackTrace(); } + + // Multiplayer + try { + if (opts.getShareProgressLevel() == 3) { + List mq = q.getMultiplayerQuesters(this); + if (mq != null) { + for (Quester qq : mq) { + if (qq.getCurrentQuests().containsKey(this)) { + setStage(qq, qq.currentQuests.get(this) + 1); + } + } + } + } + } catch (InvalidStageException e) { + e.printStackTrace(); + } } if (q.getQuestData(this) != null) { q.getQuestData(this).delayStartTime = 0; @@ -692,6 +676,18 @@ public class Quest { q.findCompassTarget(); QuesterPostCompleteQuestEvent postEvent = new QuesterPostCompleteQuestEvent(q, this); plugin.getServer().getPluginManager().callEvent(postEvent); + + // Multiplayer + if (opts.getShareProgressLevel() == 4) { + List mq = q.getMultiplayerQuesters(this); + if (mq != null) { + for (Quester qq : mq) { + if (qq.getCurrentQuests().containsKey(this)) { + completeQuest(qq); + } + } + } + } } /** diff --git a/main/src/main/java/me/blackvein/quests/QuestFactory.java b/main/src/main/java/me/blackvein/quests/QuestFactory.java index b79eba2bb..afe53676f 100644 --- a/main/src/main/java/me/blackvein/quests/QuestFactory.java +++ b/main/src/main/java/me/blackvein/quests/QuestFactory.java @@ -387,8 +387,7 @@ public class QuestFactory implements ConversationAbandonedListener { return new CreateMenuPrompt(); } } catch (NumberFormatException e) { - context.getForWhom().sendRawMessage(ChatColor.LIGHT_PURPLE + input + " " + ChatColor.RED - + Lang.get("stageEditorInvalidNumber")); + context.getForWhom().sendRawMessage(ChatColor.RED + Lang.get("reqNotANumber").replace("", input)); return new SetNpcStartPrompt(); } } else if (input.equalsIgnoreCase(Lang.get("cmdClear"))) { @@ -816,6 +815,7 @@ public class QuestFactory implements ConversationAbandonedListener { boolean allowQuittingOpt = true; boolean useDungeonsXLPluginOpt = false; boolean usePartiesPluginOpt = true; + Integer shareProgressLevelOpt = 1; if (cc.getSessionData(CK.Q_START_NPC) != null) { npcStart = (Integer) cc.getSessionData(CK.Q_START_NPC); } @@ -942,6 +942,9 @@ public class QuestFactory implements ConversationAbandonedListener { if (cc.getSessionData(CK.OPT_USE_PARTIES_PLUGIN) != null) { usePartiesPluginOpt = (Boolean) cc.getSessionData(CK.OPT_USE_PARTIES_PLUGIN); } + if (cc.getSessionData(CK.OPT_SHARE_PROGRESS_LEVEL) != null) { + shareProgressLevelOpt = (Integer) cc.getSessionData(CK.OPT_SHARE_PROGRESS_LEVEL); + } cs.set("name", name); cs.set("npc-giver-id", npcStart); cs.set("block-start", blockStart); @@ -1408,6 +1411,7 @@ public class QuestFactory implements ConversationAbandonedListener { sch.set("allow-quitting", allowQuittingOpt); sch.set("use-dungeonsxl-plugin", useDungeonsXLPluginOpt); sch.set("use-parties-plugin", usePartiesPluginOpt); + sch.set("share-progress-level", shareProgressLevelOpt); } @SuppressWarnings("deprecation") @@ -1524,6 +1528,7 @@ public class QuestFactory implements ConversationAbandonedListener { cc.setSessionData(CK.OPT_ALLOW_QUITTING, opt.getAllowQuitting()); cc.setSessionData(CK.OPT_USE_DUNGEONSXL_PLUGIN, opt.getUseDungeonsXLPlugin()); cc.setSessionData(CK.OPT_USE_PARTIES_PLUGIN, opt.getUsePartiesPlugin()); + cc.setSessionData(CK.OPT_SHARE_PROGRESS_LEVEL, opt.getShareProgressLevel()); // Stages (Objectives) int index = 1; for (Stage stage : q.getStages()) { diff --git a/main/src/main/java/me/blackvein/quests/Quester.java b/main/src/main/java/me/blackvein/quests/Quester.java index a793fe64e..3c7512b44 100644 --- a/main/src/main/java/me/blackvein/quests/Quester.java +++ b/main/src/main/java/me/blackvein/quests/Quester.java @@ -46,6 +46,9 @@ import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.meta.BookMeta; import org.bukkit.inventory.meta.ItemMeta; +import com.alessiodp.parties.api.interfaces.Party; + +import de.erethon.dungeonsxl.player.DGroup; import me.blackvein.quests.events.quester.QuesterPostStartQuestEvent; import me.blackvein.quests.events.quester.QuesterPreStartQuestEvent; import me.blackvein.quests.timers.StageTimer; @@ -1050,6 +1053,18 @@ public class Quester { } } } + + // Multiplayer + if (quest.getOptions().getShareProgressLevel() == 1) { + List mq = getMultiplayerQuesters(quest); + if (mq != null) { + for (Quester q : mq) { + if (q.getCurrentQuests().containsKey(quest)) { + q.breakBlock(quest, m); + } + } + } + } } /** @@ -1740,19 +1755,11 @@ public class Quester { EntityType mob, String extra, NPC npc, Location location, DyeColor color, String pass, CustomObjective co) { Player p = getPlayer(); if (getCurrentStage(quest).objectiveOverride != null) { - if (testComplete(quest)) { - String message = ChatColor.GREEN + "(" + Lang.get(p, "completed") + ") " + getCurrentStage(quest).objectiveOverride; - p.sendMessage(message); - quest.nextStage(this); - } - return; - } - if (objective.equalsIgnoreCase("password")) { + String message = ChatColor.GREEN + "(" + Lang.get(p, "completed") + ") " + getCurrentStage(quest).objectiveOverride; + p.sendMessage(message); + } else if (objective.equalsIgnoreCase("password")) { String message = ChatColor.GREEN + "(" + Lang.get(p, "completed") + ") " + pass; p.sendMessage(message); - if (testComplete(quest)) { - quest.nextStage(this); - } } else if (objective.equalsIgnoreCase("breakBlock")) { String message = ChatColor.GREEN + "(" + Lang.get(p, "completed") + ") " + Lang.get(p, "break") + " "; message = message + " " + goal.getAmount() + "/" + goal.getAmount(); @@ -1761,9 +1768,6 @@ public class Quester { } else { p.sendMessage(message.replace("", ItemUtil.getName(increment))); } - if (testComplete(quest)) { - quest.nextStage(this); - } } else if (objective.equalsIgnoreCase("damageBlock")) { String message = ChatColor.GREEN + "(" + Lang.get(p, "completed") + ") " + Lang.get(p, "damage") + " "; message = message + " " + goal.getAmount() + "/" + goal.getAmount(); @@ -1772,9 +1776,6 @@ public class Quester { } else { p.sendMessage(message.replace("", ItemUtil.getName(increment))); } - if (testComplete(quest)) { - quest.nextStage(this); - } } else if (objective.equalsIgnoreCase("placeBlock")) { String message = ChatColor.GREEN + "(" + Lang.get(p, "completed") + ") " + Lang.get(p, "place") + " "; message = message + " " + goal.getAmount() + "/" + goal.getAmount(); @@ -1783,9 +1784,6 @@ public class Quester { } else { p.sendMessage(message.replace("", ItemUtil.getName(increment))); } - if (testComplete(quest)) { - quest.nextStage(this); - } } else if (objective.equalsIgnoreCase("useBlock")) { String message = ChatColor.GREEN + "(" + Lang.get(p, "completed") + ") " + Lang.get(p, "use") + " "; message = message + " " + goal.getAmount() + "/" + goal.getAmount(); @@ -1794,9 +1792,6 @@ public class Quester { } else { p.sendMessage(message.replace("", ItemUtil.getName(increment))); } - if (testComplete(quest)) { - quest.nextStage(this); - } } else if (objective.equalsIgnoreCase("cutBlock")) { String message = ChatColor.GREEN + "(" + Lang.get(p, "completed") + ") " + Lang.get(p, "cut") + " "; message = message + " " + goal.getAmount() + "/" + goal.getAmount(); @@ -1805,9 +1800,6 @@ public class Quester { } else { p.sendMessage(message.replace("", ItemUtil.getName(increment))); } - if (testComplete(quest)) { - quest.nextStage(this); - } } else if (objective.equalsIgnoreCase("craftItem")) { ItemStack is = getCurrentStage(quest).itemsToCraft.get(getCurrentStage(quest).itemsToCraft.indexOf(goal)); String message = ChatColor.GREEN + "(" + Lang.get(p, "completed") + ") " + Lang.get(p, "craft") + " " @@ -1817,9 +1809,6 @@ public class Quester { } else { p.sendMessage(message.replace("", ItemUtil.getName(is))); } - if (testComplete(quest)) { - quest.nextStage(this); - } } else if (objective.equalsIgnoreCase("smeltItem")) { ItemStack is = getCurrentStage(quest).itemsToSmelt.get(getCurrentStage(quest).itemsToSmelt.indexOf(goal)); String message = ChatColor.GREEN + "(" + Lang.get(p, "completed") + ") " + Lang.get(p, "smelt") + " " @@ -1829,9 +1818,6 @@ public class Quester { } else { p.sendMessage(message.replace("", ItemUtil.getName(is))); } - if (testComplete(quest)) { - quest.nextStage(this); - } } else if (objective.equalsIgnoreCase("enchantItem")) { String obj = Lang.get(p, "enchantItem"); String message = ChatColor.GREEN + "(" + Lang.get(p, "completed") + ") " + obj; @@ -1849,9 +1835,6 @@ public class Quester { p.sendMessage(message.replace("", ItemUtil.getName(increment)) .replace("", enchantment.getName())); } - if (testComplete(quest)) { - quest.nextStage(this); - } } else if (objective.equalsIgnoreCase("deliverItem")) { String obj = Lang.get(p, "deliver"); obj = obj.replace("", plugin.getNPCName(getCurrentStage(quest).itemDeliveryTargets.get(getCurrentStage(quest).itemsToDeliver.indexOf(goal)))); @@ -1862,16 +1845,10 @@ public class Quester { } else { p.sendMessage(message.replace("", ItemUtil.getName(is))); } - if (testComplete(quest)) { - quest.nextStage(this); - } } else if (objective.equalsIgnoreCase("catchFish")) { String message = ChatColor.GREEN + "(" + Lang.get(p, "completed") + ") " + Lang.get(p, "catchFish") + " "; message = message + " " + getCurrentStage(quest).fishToCatch + "/" + getCurrentStage(quest).fishToCatch; p.sendMessage(message); - if (testComplete(quest)) { - quest.nextStage(this); - } } else if (objective.equalsIgnoreCase("killMob")) { String message = ChatColor.GREEN + "(" + Lang.get(p, "completed") + ") " + Lang.get(p, "kill") + " "; message = message + " " + getCurrentStage(quest).mobNumToKill.get(getCurrentStage(quest).mobsToKill.indexOf(mob)) + "/" + getCurrentStage(quest).mobNumToKill.get(getCurrentStage(quest).mobsToKill.indexOf(mob)); @@ -1880,31 +1857,19 @@ public class Quester { } else { p.sendMessage(message.replace("", MiscUtil.getProperMobName(mob))); } - if (testComplete(quest)) { - quest.nextStage(this); - } } else if (objective.equalsIgnoreCase("killPlayer")) { String message = ChatColor.GREEN + "(" + Lang.get(p, "completed") + ") " + Lang.get(p, "killPlayer"); message = message + " " + getCurrentStage(quest).playersToKill + "/" + getCurrentStage(quest).playersToKill; p.sendMessage(message); - if (testComplete(quest)) { - quest.nextStage(this); - } } else if (objective.equalsIgnoreCase("talkToNPC")) { String obj = Lang.get(p, "talkTo"); obj = obj.replace("", plugin.getNPCName(npc.getId())); String message = ChatColor.GREEN + "(" + Lang.get(p, "completed") + ") " + obj; p.sendMessage(message); - if (testComplete(quest)) { - quest.nextStage(this); - } } else if (objective.equalsIgnoreCase("killNPC")) { String message = ChatColor.GREEN + "(" + Lang.get(p, "completed") + ") " + Lang.get(p, "kill") + " " + npc.getName(); message = message + " " + getCurrentStage(quest).citizenNumToKill.get(getCurrentStage(quest).citizensToKill.indexOf(npc.getId())) + "/" + getCurrentStage(quest).citizenNumToKill.get(getCurrentStage(quest).citizensToKill.indexOf(npc.getId())); p.sendMessage(message); - if (testComplete(quest)) { - quest.nextStage(this); - } } else if (objective.equalsIgnoreCase("tameMob")) { String message = ChatColor.GREEN + "(" + Lang.get(p, "completed") + ") " + Lang.get(p, "tame") + " "; message = message + " " + getCurrentStage(quest).mobsToTame.get(mob) + "/" + getCurrentStage(quest).mobsToTame.get(mob); @@ -1913,26 +1878,17 @@ public class Quester { } else { p.sendMessage(message.replace("", MiscUtil.getProperMobName(mob))); } - if (testComplete(quest)) { - quest.nextStage(this); - } } else if (objective.equalsIgnoreCase("shearSheep")) { String obj = Lang.get(p, "shearSheep"); obj = obj.replace("", color.name().toLowerCase()); String message = ChatColor.GREEN + "(" + Lang.get(p, "completed") + ") " + obj; message = message + " " + getCurrentStage(quest).sheepToShear.get(color) + "/" + getCurrentStage(quest).sheepToShear.get(color); p.sendMessage(message); - if (testComplete(quest)) { - quest.nextStage(this); - } } else if (objective.equalsIgnoreCase("reachLocation")) { String obj = Lang.get(p, "goTo"); obj = obj.replace("", getCurrentStage(quest).locationNames.get(getCurrentStage(quest).locationsToReach.indexOf(location))); String message = ChatColor.GREEN + "(" + Lang.get(p, "completed") + ") " + obj; p.sendMessage(message); - if (testComplete(quest)) { - quest.nextStage(this); - } } else if (co != null) { String message = ChatColor.GREEN + "(" + Lang.get(p, "completed") + ") " + co.getDisplay(); int index = -1; @@ -1954,17 +1910,29 @@ public class Quester { message = message.replace("%count%", getCurrentStage(quest).customObjectiveCounts.get(index) + "/" + getCurrentStage(quest).customObjectiveCounts.get(index)); } p.sendMessage(message); - if (testComplete(quest)) { - quest.nextStage(this); + } + if (testComplete(quest)) { + quest.nextStage(this); + } + + // Multiplayer + if (quest.getOptions().getShareProgressLevel() == 2) { + List mq = getMultiplayerQuesters(quest); + if (mq != null) { + for (Quester q : mq) { + if (q.getCurrentQuests().containsKey(quest)) { + quest.nextStage(q); + } + } } } } /** - * Check whether a quest has been marked as complete + * Check whether this Quester has completed all objectives for their current stage * - * @param quest The quest being checked - * @return true if marked complete + * @param quest The quest with the current stage being checked + * @return true if all stage objectives are marked complete */ public boolean testComplete(Quest quest) { for (String s : getObjectives(quest, true)) { @@ -3029,6 +2997,47 @@ public class Quester { return playerAmount >= is.getAmount(); } + /** + * Get a list of follow Questers in a party or group + * + * @param quest The quest which uses a linked plugin, i.e. Parties or DungeonsXL + * @return null if quest is null, no linked plugins, or party/group is null + */ + public List getMultiplayerQuesters(Quest quest) { + if (quest == null) { + return null; + } + if (plugin.getDependencies().getPartiesApi() != null) { + if (quest.getOptions().getUsePartiesPlugin()) { + Party party = plugin.getDependencies().getPartiesApi().getParty(plugin.getDependencies().getPartiesApi().getPartyPlayer(getUUID()).getPartyName()); + if (party != null) { + List mq = new LinkedList(); + for (UUID id : party.getMembers()) { + if (!id.equals(getUUID())) { + mq.add(plugin.getQuester(id)); + } + } + return mq; + } + } + } + if (plugin.getDependencies().getDungeonsApi() != null) { + if (quest.getOptions().getUseDungeonsXLPlugin()) { + DGroup group = DGroup.getByPlayer(getPlayer()); + if (group != null) { + List mq = new LinkedList(); + for (UUID id : group.getPlayers()) { + if (!id.equals(getUUID())) { + mq.add(plugin.getQuester(id)); + } + } + return mq; + } + } + } + return null; + } + // I'm not sure why these methods are here. They've been in the class for a long time but aren't used anywhere? /*public static String checkPlacement(Inventory inv, int rawSlot) { diff --git a/main/src/main/java/me/blackvein/quests/Quests.java b/main/src/main/java/me/blackvein/quests/Quests.java index 81cb9d6e8..a6b4610b5 100644 --- a/main/src/main/java/me/blackvein/quests/Quests.java +++ b/main/src/main/java/me/blackvein/quests/Quests.java @@ -1814,6 +1814,9 @@ public class Quests extends JavaPlugin implements ConversationAbandonedListener if (config.contains("quests." + questKey + ".options.use-parties-plugin")) { opts.setUsePartiesPlugin(config.getBoolean("quests." + questKey + ".options.use-parties-plugin")); } + if (config.contains("quests." + questKey + ".options.share-progress-level")) { + opts.setShareProgressLevel(config.getInt("quests." + questKey + ".options.share-progress-level")); + } } private void skipQuestProcess(String[] msgs) throws SkipQuest { diff --git a/main/src/main/java/me/blackvein/quests/actions/ActionFactory.java b/main/src/main/java/me/blackvein/quests/actions/ActionFactory.java index be009b518..1f747ba06 100644 --- a/main/src/main/java/me/blackvein/quests/actions/ActionFactory.java +++ b/main/src/main/java/me/blackvein/quests/actions/ActionFactory.java @@ -1651,7 +1651,7 @@ public class ActionFactory implements ConversationAbandonedListener { try { inp = Integer.parseInt(input); } catch (NumberFormatException e) { - context.getForWhom().sendRawMessage(ChatColor.RED + Lang.get("eventEditorNotANumber")); + context.getForWhom().sendRawMessage(ChatColor.RED + Lang.get("reqNotANumber").replace("", input)); return new MobPrompt(); } if (inp == types.size() + 1) { @@ -1889,7 +1889,7 @@ public class ActionFactory implements ConversationAbandonedListener { questMob.setSpawnAmounts(i); return new QuestMobPrompt(mobIndex, questMob); } catch (NumberFormatException e) { - player.sendMessage(ChatColor.LIGHT_PURPLE + input + " " + ChatColor.RED + Lang.get("eventEditorNotANumber")); + player.sendMessage(ChatColor.RED + Lang.get("reqNotANumber").replace("", input)); return new MobAmountPrompt(mobIndex, questMob); } } @@ -2174,7 +2174,7 @@ public class ActionFactory implements ConversationAbandonedListener { } effDurations.add(l / 50L); } catch (NumberFormatException e) { - player.sendMessage(ChatColor.LIGHT_PURPLE + s + " " + ChatColor.RED + Lang.get("eventEditorNotANumber")); + player.sendMessage(ChatColor.RED + Lang.get("reqNotANumber").replace("", s)); return new PotionDurationsPrompt(); } } @@ -2205,7 +2205,7 @@ public class ActionFactory implements ConversationAbandonedListener { } magAmounts.add(i); } catch (NumberFormatException e) { - player.sendMessage(ChatColor.LIGHT_PURPLE + s + " " + ChatColor.RED + Lang.get("eventEditorNotANumber")); + player.sendMessage(ChatColor.RED + Lang.get("reqNotANumber").replace("", s)); return new PotionMagnitudesPrompt(); } } @@ -2234,8 +2234,7 @@ public class ActionFactory implements ConversationAbandonedListener { context.setSessionData(CK.E_HUNGER, (Integer) i); } } catch (NumberFormatException e) { - context.getForWhom().sendRawMessage(ChatColor.LIGHT_PURPLE + input + " " + ChatColor.RED - + Lang.get("stageEditorInvalidNumber")); + context.getForWhom().sendRawMessage(ChatColor.RED + Lang.get("reqNotANumber").replace("", input)); return new HungerPrompt(); } } else { @@ -2264,8 +2263,7 @@ public class ActionFactory implements ConversationAbandonedListener { context.setSessionData(CK.E_SATURATION, (Integer) i); } } catch (NumberFormatException e) { - context.getForWhom().sendRawMessage(ChatColor.LIGHT_PURPLE + input + " " + ChatColor.RED - + Lang.get("stageEditorInvalidNumber")); + context.getForWhom().sendRawMessage(ChatColor.RED + Lang.get("reqNotANumber").replace("", input)); return new SaturationPrompt(); } } else { @@ -2294,8 +2292,7 @@ public class ActionFactory implements ConversationAbandonedListener { context.setSessionData(CK.E_HEALTH, (Integer) i); } } catch (NumberFormatException e) { - context.getForWhom().sendRawMessage(ChatColor.LIGHT_PURPLE + input + " " + ChatColor.RED - + Lang.get("stageEditorInvalidNumber")); + context.getForWhom().sendRawMessage(ChatColor.RED + Lang.get("reqNotANumber").replace("", input)); return new HealthPrompt(); } } else { diff --git a/main/src/main/java/me/blackvein/quests/listeners/CmdExecutor.java b/main/src/main/java/me/blackvein/quests/listeners/CmdExecutor.java index 2f5f1208d..dbaa4593a 100644 --- a/main/src/main/java/me/blackvein/quests/listeners/CmdExecutor.java +++ b/main/src/main/java/me/blackvein/quests/listeners/CmdExecutor.java @@ -82,7 +82,7 @@ public class CmdExecutor implements CommandExecutor { if (cmd.getName().equalsIgnoreCase("quest")) { return questCommandHandler(cs, args); } else if (cmd.getName().equalsIgnoreCase("quests")) { - return questActionsCommandHandler(cs, args); + return questsCommandHandler(cs, args); } else if (cmd.getName().equalsIgnoreCase("questadmin")) { return questAdminCommandHandler(cs, args); } @@ -196,7 +196,7 @@ public class CmdExecutor implements CommandExecutor { showQuestDetails(cs, args); } } else { - cs.sendMessage(ChatColor.RED + Lang.get("NoPermission")); + cs.sendMessage(ChatColor.RED + Lang.get("noPermission")); return true; } } else { @@ -206,7 +206,7 @@ public class CmdExecutor implements CommandExecutor { return true; } - private boolean questActionsCommandHandler(final CommandSender cs, String[] args) { + private boolean questsCommandHandler(final CommandSender cs, String[] args) { if (cs instanceof Player) { if (args.length == 0) { questsHelp(cs); @@ -419,7 +419,7 @@ public class CmdExecutor implements CommandExecutor { cs.sendMessage(ChatColor.YELLOW + Lang.get("questNotFound")); } } else { - cs.sendMessage(ChatColor.RED + Lang.get("NoPermission")); + cs.sendMessage(ChatColor.RED + Lang.get("noPermission")); } } @@ -443,7 +443,7 @@ public class CmdExecutor implements CommandExecutor { cs.sendMessage(ChatColor.RED + Lang.get("duplicateEditor")); } } else { - cs.sendMessage(ChatColor.RED + Lang.get("NoPermission")); + cs.sendMessage(ChatColor.RED + Lang.get("noPermission")); } return true; } @@ -457,7 +457,7 @@ public class CmdExecutor implements CommandExecutor { cs.sendMessage(ChatColor.RED + Lang.get("duplicateEditor")); } } else { - cs.sendMessage(ChatColor.RED + Lang.get("NoPermission")); + cs.sendMessage(ChatColor.RED + Lang.get("noPermission")); } return true; } @@ -649,7 +649,7 @@ public class CmdExecutor implements CommandExecutor { player.sendMessage(ChatColor.YELLOW + Lang.get(player, "noActiveQuest")); } } else { - player.sendMessage(ChatColor.RED + Lang.get(player, "NoPermission")); + player.sendMessage(ChatColor.RED + Lang.get(player, "noPermission")); } } @@ -742,7 +742,7 @@ public class CmdExecutor implements CommandExecutor { } } } else { - player.sendMessage(ChatColor.RED + Lang.get(player, "NoPermission")); + player.sendMessage(ChatColor.RED + Lang.get(player, "noPermission")); } } else { player.sendMessage(ChatColor.YELLOW + Lang.get(player, "questTakeDisabled")); @@ -768,7 +768,7 @@ public class CmdExecutor implements CommandExecutor { plugin.listQuests((Player) cs, page); } } else { - cs.sendMessage(ChatColor.RED + Lang.get("NoPermission")); + cs.sendMessage(ChatColor.RED + Lang.get("noPermission")); } } @@ -777,7 +777,7 @@ public class CmdExecutor implements CommandExecutor { Player p = (Player) cs; printHelp(p); } else { - cs.sendMessage(ChatColor.RED + Lang.get("NoPermission")); + cs.sendMessage(ChatColor.RED + Lang.get("noPermission")); } } @@ -839,7 +839,7 @@ public class CmdExecutor implements CommandExecutor { if (cs.hasPermission("quests.admin.*") || cs.hasPermission("quests.admin")) { printAdminHelp(cs); } else { - cs.sendMessage(ChatColor.RED + Lang.get("NoPermission")); + cs.sendMessage(ChatColor.RED + Lang.get("noPermission")); } } @@ -851,7 +851,7 @@ public class CmdExecutor implements CommandExecutor { msg = msg.replace("", ChatColor.DARK_PURPLE + String.valueOf(plugin.getQuests().size()) + ChatColor.GOLD); cs.sendMessage(ChatColor.GOLD + msg); } else { - cs.sendMessage(ChatColor.RED + Lang.get("NoPermission")); + cs.sendMessage(ChatColor.RED + Lang.get("noPermission")); } } @@ -887,7 +887,7 @@ public class CmdExecutor implements CommandExecutor { cs.sendMessage(ChatColor.RED + Lang.get("unknownError")); } } else { - cs.sendMessage(ChatColor.RED + Lang.get("NoPermission")); + cs.sendMessage(ChatColor.RED + Lang.get("noPermission")); } } @@ -922,7 +922,7 @@ public class CmdExecutor implements CommandExecutor { } } } else { - cs.sendMessage(ChatColor.RED + Lang.get("NoPermission")); + cs.sendMessage(ChatColor.RED + Lang.get("noPermission")); } } @@ -958,7 +958,7 @@ public class CmdExecutor implements CommandExecutor { quester.saveData(); } } else { - cs.sendMessage(ChatColor.RED + Lang.get("NoPermission")); + cs.sendMessage(ChatColor.RED + Lang.get("noPermission")); } } @@ -994,7 +994,7 @@ public class CmdExecutor implements CommandExecutor { quester.saveData(); } } else { - cs.sendMessage(ChatColor.RED + Lang.get("NoPermission")); + cs.sendMessage(ChatColor.RED + Lang.get("noPermission")); } } @@ -1051,7 +1051,7 @@ public class CmdExecutor implements CommandExecutor { } } } else { - cs.sendMessage(ChatColor.RED + Lang.get("NoPermission")); + cs.sendMessage(ChatColor.RED + Lang.get("noPermission")); } } @@ -1126,7 +1126,7 @@ public class CmdExecutor implements CommandExecutor { } thread.start(); } else { - cs.sendMessage(ChatColor.RED + Lang.get("NoPermission")); + cs.sendMessage(ChatColor.RED + Lang.get("noPermission")); } } @@ -1166,7 +1166,7 @@ public class CmdExecutor implements CommandExecutor { } } } else { - cs.sendMessage(ChatColor.RED + Lang.get("NoPermission")); + cs.sendMessage(ChatColor.RED + Lang.get("noPermission")); } } @@ -1224,7 +1224,7 @@ public class CmdExecutor implements CommandExecutor { } } } else { - cs.sendMessage(ChatColor.RED + Lang.get("NoPermission")); + cs.sendMessage(ChatColor.RED + Lang.get("noPermission")); } } @@ -1264,7 +1264,7 @@ public class CmdExecutor implements CommandExecutor { } } } else { - cs.sendMessage(ChatColor.RED + Lang.get("NoPermission")); + cs.sendMessage(ChatColor.RED + Lang.get("noPermission")); } } @@ -1306,7 +1306,7 @@ public class CmdExecutor implements CommandExecutor { } } } else { - cs.sendMessage(ChatColor.RED + Lang.get("NoPermission")); + cs.sendMessage(ChatColor.RED + Lang.get("noPermission")); } } catch (NullPointerException npe) { npe.printStackTrace(); @@ -1353,7 +1353,7 @@ public class CmdExecutor implements CommandExecutor { temp2.add(quester); plugin.setQuesters(temp2); } else { - cs.sendMessage(ChatColor.RED + Lang.get("NoPermission")); + cs.sendMessage(ChatColor.RED + Lang.get("noPermission")); } } @@ -1361,7 +1361,7 @@ public class CmdExecutor implements CommandExecutor { if (cs.hasPermission("quests.admin.*") && cs.hasPermission("quests.admin.stats")) { questsStats(cs, args); } else { - cs.sendMessage(ChatColor.RED + Lang.get("NoPermission")); + cs.sendMessage(ChatColor.RED + Lang.get("noPermission")); } } @@ -1390,7 +1390,7 @@ public class CmdExecutor implements CommandExecutor { quester.saveData(); quester.updateJournal(); } else { - cs.sendMessage(ChatColor.RED + Lang.get("NoPermission")); + cs.sendMessage(ChatColor.RED + Lang.get("noPermission")); } } diff --git a/main/src/main/java/me/blackvein/quests/prompts/CreateStagePrompt.java b/main/src/main/java/me/blackvein/quests/prompts/CreateStagePrompt.java index e71bd4862..5c2f3cda9 100644 --- a/main/src/main/java/me/blackvein/quests/prompts/CreateStagePrompt.java +++ b/main/src/main/java/me/blackvein/quests/prompts/CreateStagePrompt.java @@ -462,8 +462,7 @@ public class CreateStagePrompt extends FixedSetPrompt { context.setSessionData(pref + CK.S_PLAYER_KILL, i); } } catch (NumberFormatException e) { - context.getForWhom().sendRawMessage(ChatColor.LIGHT_PURPLE + input + " " + ChatColor.RED - + Lang.get("stageEditorInvalidNumber")); + context.getForWhom().sendRawMessage(ChatColor.RED + Lang.get("reqNotANumber").replace("", input)); return new KillPlayerPrompt(); } } else if (input.equalsIgnoreCase(Lang.get("cmdClear"))) { @@ -652,7 +651,7 @@ public class CreateStagePrompt extends FixedSetPrompt { } radii.add(i); } catch (NumberFormatException e) { - player.sendMessage(ChatColor.LIGHT_PURPLE + input + " " + ChatColor.RED + Lang.get("stageEditorInvalidNumber")); + player.sendMessage(ChatColor.RED + Lang.get("reqNotANumber").replace("", input)); return new ReachRadiiPrompt(); } } @@ -1133,7 +1132,7 @@ public class CreateStagePrompt extends FixedSetPrompt { int i = Integer.parseInt(input); stageDelay = i * 1000; } catch (NumberFormatException e) { - player.sendMessage(ChatColor.LIGHT_PURPLE + input + " " + ChatColor.RED + Lang.get("stageEditorInvalidNumber")); + player.sendMessage(ChatColor.RED + Lang.get("reqNotANumber").replace("", input)); return new DelayPrompt(); } if (stageDelay < 1000) { @@ -1405,7 +1404,7 @@ public class CreateStagePrompt extends FixedSetPrompt { return new CreateStagePrompt(plugin, stageNum, questFactory); } } catch (NumberFormatException e) { - context.getForWhom().sendRawMessage(ChatColor.LIGHT_PURPLE + input + " " + ChatColor.RED + Lang.get("stageEditorInvalidNumber")); + context.getForWhom().sendRawMessage(ChatColor.RED + Lang.get("reqNotANumber").replace("", input)); return new CustomObjectiveCountPrompt(); } } diff --git a/main/src/main/java/me/blackvein/quests/prompts/ItemStackPrompt.java b/main/src/main/java/me/blackvein/quests/prompts/ItemStackPrompt.java index db888f23b..ccaf8d05c 100644 --- a/main/src/main/java/me/blackvein/quests/prompts/ItemStackPrompt.java +++ b/main/src/main/java/me/blackvein/quests/prompts/ItemStackPrompt.java @@ -435,7 +435,7 @@ public class ItemStackPrompt extends FixedSetPrompt { return new ItemStackPrompt(oldPrompt); } } catch (NumberFormatException e) { - cc.getForWhom().sendRawMessage(ChatColor.RED + Lang.get("itemCreateNotNumber")); + cc.getForWhom().sendRawMessage(ChatColor.RED + Lang.get("reqNotANumber").replace("", input)); return new LevelPrompt(enchantment); } } diff --git a/main/src/main/java/me/blackvein/quests/prompts/MobsPrompt.java b/main/src/main/java/me/blackvein/quests/prompts/MobsPrompt.java index f0e986de1..91492ea71 100644 --- a/main/src/main/java/me/blackvein/quests/prompts/MobsPrompt.java +++ b/main/src/main/java/me/blackvein/quests/prompts/MobsPrompt.java @@ -370,7 +370,7 @@ public class MobsPrompt extends FixedSetPrompt { } mobAmounts.add(i); } catch (NumberFormatException e) { - player.sendMessage(ChatColor.LIGHT_PURPLE + input + " " + ChatColor.RED + Lang.get("stageEditorInvalidNumber")); + player.sendMessage(ChatColor.RED + Lang.get("reqNotANumber").replace("", input)); return new MobAmountsPrompt(); } } @@ -490,8 +490,7 @@ public class MobsPrompt extends FixedSetPrompt { context.setSessionData(pref + CK.S_FISH, i); } } catch (NumberFormatException e) { - context.getForWhom().sendRawMessage(ChatColor.LIGHT_PURPLE + input + " " + ChatColor.RED - + Lang.get("stageEditorInvalidNumber")); + context.getForWhom().sendRawMessage(ChatColor.RED + Lang.get("reqNotANumber").replace("", input)); return new FishPrompt(); } } else if (input.equalsIgnoreCase(Lang.get("cmdClear"))) { @@ -648,7 +647,7 @@ public class MobsPrompt extends FixedSetPrompt { } mobAmounts.add(i); } catch (NumberFormatException e) { - player.sendMessage(ChatColor.LIGHT_PURPLE + input + " " + ChatColor.RED + Lang.get("stageEditorInvalidNumber")); + player.sendMessage(ChatColor.RED + Lang.get("reqNotANumber").replace("", input)); return new TameAmountsPrompt(); } } @@ -798,7 +797,7 @@ public class MobsPrompt extends FixedSetPrompt { } shearAmounts.add(i); } catch (NumberFormatException e) { - player.sendMessage(ChatColor.LIGHT_PURPLE + input + " " + ChatColor.RED + Lang.get("stageEditorInvalidNumber")); + player.sendMessage(ChatColor.RED + Lang.get("reqNotANumber").replace("", input)); return new ShearAmountsPrompt(); } } diff --git a/main/src/main/java/me/blackvein/quests/prompts/OptionsPrompt.java b/main/src/main/java/me/blackvein/quests/prompts/OptionsPrompt.java index dfed56aba..48e1faba3 100644 --- a/main/src/main/java/me/blackvein/quests/prompts/OptionsPrompt.java +++ b/main/src/main/java/me/blackvein/quests/prompts/OptionsPrompt.java @@ -92,6 +92,35 @@ public class OptionsPrompt extends FixedSetPrompt { } } + private class NumberPrompt extends StringPrompt { + + @Override + public String getPromptText(ConversationContext context) { + String text = Lang.get("optNumberPrompt"); + text += "\n" + ChatColor.GRAY + "\u2515 " + ChatColor.GOLD + "1" + ChatColor.RESET + " = " + ChatColor.GOLD + Lang.get("everything"); + text += "\n" + ChatColor.GRAY + "\u2515 " + ChatColor.GOLD + "2" + ChatColor.RESET + " = " + ChatColor.GOLD + Lang.get("objectives");; + text += "\n" + ChatColor.GRAY + "\u2515 " + ChatColor.GOLD + "3" + ChatColor.RESET + " = " + ChatColor.GOLD + Lang.get("stageEditorStages"); + text += "\n" + ChatColor.GRAY + "\u2515 " + ChatColor.GOLD + "4" + ChatColor.RESET + " = " + ChatColor.GOLD + Lang.get("quests"); + return ChatColor.YELLOW + text; + } + + @Override + public Prompt acceptInput(ConversationContext context, String input) { + if (input.equalsIgnoreCase(Lang.get("cmdCancel")) == false && input.equalsIgnoreCase(Lang.get("cmdClear")) == false) { + try { + int i = Integer.parseInt(input); + context.setSessionData(tempKey, i); + } catch (Exception e) { + context.getForWhom().sendRawMessage(ChatColor.RED + Lang.get("reqNotANumber").replace("", input)); + } + } else if (input.equalsIgnoreCase(Lang.get("cmdClear"))) { + context.setSessionData(tempKey, null); + return tempPrompt; + } + return tempPrompt; + } + } + private class GeneralPrompt extends StringPrompt { @Override @@ -166,7 +195,16 @@ public class OptionsPrompt extends FixedSetPrompt { text += ChatColor.BLUE + "" + ChatColor.BOLD + "2" + ChatColor.RESET + ChatColor.YELLOW + " - " + Lang.get("optUsePartiesPlugin") + " (" + (partiesOpt ? ChatColor.GREEN + String.valueOf(partiesOpt) : ChatColor.RED + String.valueOf(partiesOpt)) + ChatColor.YELLOW + ")\n"; } - text += ChatColor.GREEN + "" + ChatColor.BOLD + "3" + ChatColor.RESET + ChatColor.YELLOW + " - " + Lang.get("done"); + if (context.getSessionData(CK.OPT_SHARE_PROGRESS_LEVEL) == null) { + int defaultOpt = new Options().getShareProgressLevel(); + text += ChatColor.BLUE + "" + ChatColor.BOLD + "3" + ChatColor.RESET + ChatColor.YELLOW + " - " + Lang.get("optShareProgressLevel") + " (" + + ChatColor.AQUA + String.valueOf(defaultOpt) + ChatColor.YELLOW + ")\n"; + } else { + int shareOpt = (Integer) context.getSessionData(CK.OPT_SHARE_PROGRESS_LEVEL); + text += ChatColor.BLUE + "" + ChatColor.BOLD + "3" + ChatColor.RESET + ChatColor.YELLOW + " - " + Lang.get("optShareProgressLevel") + " (" + + ChatColor.AQUA + String.valueOf(shareOpt) + ChatColor.YELLOW + ")\n"; + } + text += ChatColor.GREEN + "" + ChatColor.BOLD + "4" + ChatColor.RESET + ChatColor.YELLOW + " - " + Lang.get("done"); return text; } @@ -181,6 +219,10 @@ public class OptionsPrompt extends FixedSetPrompt { tempPrompt = new MultiplayerPrompt(); return new TrueFalsePrompt(); } else if (input.equalsIgnoreCase("3")) { + tempKey = CK.OPT_SHARE_PROGRESS_LEVEL; + tempPrompt = new MultiplayerPrompt(); + return new NumberPrompt(); + } else if (input.equalsIgnoreCase("4")) { tempKey = null; tempPrompt = null; try { diff --git a/main/src/main/java/me/blackvein/quests/prompts/PlannerPrompt.java b/main/src/main/java/me/blackvein/quests/prompts/PlannerPrompt.java index 6c10e5605..87617a357 100644 --- a/main/src/main/java/me/blackvein/quests/prompts/PlannerPrompt.java +++ b/main/src/main/java/me/blackvein/quests/prompts/PlannerPrompt.java @@ -130,8 +130,7 @@ public class PlannerPrompt extends FixedSetPrompt { context.setSessionData(CK.PLN_REPEAT_CYCLE, delay); } } catch (NumberFormatException e) { - context.getForWhom().sendRawMessage(ChatColor.LIGHT_PURPLE + input + " " + ChatColor.RED - + Lang.get("stageEditorInvalidNumber")); + context.getForWhom().sendRawMessage(ChatColor.RED + Lang.get("reqNotANumber").replace("", input)); return new RepeatPrompt(); } return new PlannerPrompt(plugin, factory); @@ -164,8 +163,7 @@ public class PlannerPrompt extends FixedSetPrompt { context.setSessionData(CK.PLN_COOLDOWN, delay); } } catch (NumberFormatException e) { - context.getForWhom().sendRawMessage(ChatColor.LIGHT_PURPLE + input + " " + ChatColor.RED - + Lang.get("stageEditorInvalidNumber")); + context.getForWhom().sendRawMessage(ChatColor.RED + Lang.get("reqNotANumber").replace("", input)); return new CooldownPrompt(); } return new PlannerPrompt(plugin, factory); diff --git a/main/src/main/java/me/blackvein/quests/prompts/RequirementsPrompt.java b/main/src/main/java/me/blackvein/quests/prompts/RequirementsPrompt.java index 4821bb2a6..7d6f5814e 100644 --- a/main/src/main/java/me/blackvein/quests/prompts/RequirementsPrompt.java +++ b/main/src/main/java/me/blackvein/quests/prompts/RequirementsPrompt.java @@ -211,8 +211,7 @@ public class RequirementsPrompt extends FixedSetPrompt { return new MoneyPrompt(); } } catch (NumberFormatException e) { - context.getForWhom().sendRawMessage(ChatColor.LIGHT_PURPLE + input + " " + ChatColor.RED - + Lang.get("stageEditorInvalidNumber")); + context.getForWhom().sendRawMessage(ChatColor.RED + Lang.get("reqNotANumber").replace("", input)); return new MoneyPrompt(); } } else if (input.equalsIgnoreCase(Lang.get("cmdClear"))) { @@ -242,8 +241,7 @@ public class RequirementsPrompt extends FixedSetPrompt { return new QuestPointsPrompt(); } } catch (NumberFormatException e) { - context.getForWhom().sendRawMessage(ChatColor.LIGHT_PURPLE + input + " " + ChatColor.RED - + Lang.get("stageEditorInvalidNumber")); + context.getForWhom().sendRawMessage(ChatColor.RED + Lang.get("reqNotANumber").replace("", input)); return new QuestPointsPrompt(); } } else if (input.equalsIgnoreCase(Lang.get("cmdClear"))) { diff --git a/main/src/main/java/me/blackvein/quests/prompts/RewardsPrompt.java b/main/src/main/java/me/blackvein/quests/prompts/RewardsPrompt.java index 4f8c0a8e5..dbeff0023 100644 --- a/main/src/main/java/me/blackvein/quests/prompts/RewardsPrompt.java +++ b/main/src/main/java/me/blackvein/quests/prompts/RewardsPrompt.java @@ -210,8 +210,7 @@ public class RewardsPrompt extends FixedSetPrompt { return new MoneyPrompt(); } } catch (NumberFormatException e) { - context.getForWhom().sendRawMessage(ChatColor.LIGHT_PURPLE + input + " " + ChatColor.RED - + Lang.get("stageEditorInvalidNumber")); + context.getForWhom().sendRawMessage(ChatColor.RED + Lang.get("reqNotANumber").replace("", input)); return new MoneyPrompt(); } } else if (input.equalsIgnoreCase(Lang.get("cmdClear"))) { @@ -241,8 +240,7 @@ public class RewardsPrompt extends FixedSetPrompt { return new ExperiencePrompt(); } } catch (NumberFormatException e) { - context.getForWhom().sendRawMessage(ChatColor.LIGHT_PURPLE + input + " " + ChatColor.RED - + Lang.get("stageEditorInvalidNumber")); + context.getForWhom().sendRawMessage(ChatColor.RED + Lang.get("reqNotANumber").replace("", input)); return new ExperiencePrompt(); } } else if (input.equalsIgnoreCase(Lang.get("cmdClear"))) { @@ -272,8 +270,7 @@ public class RewardsPrompt extends FixedSetPrompt { return new QuestPointsPrompt(); } } catch (NumberFormatException e) { - context.getForWhom().sendRawMessage(ChatColor.LIGHT_PURPLE + input + " " + ChatColor.RED - + Lang.get("stageEditorInvalidNumber")); + context.getForWhom().sendRawMessage(ChatColor.RED + Lang.get("reqNotANumber").replace("", input)); return new QuestPointsPrompt(); } } else if (input.equalsIgnoreCase(Lang.get("cmdClear"))) { diff --git a/main/src/main/java/me/blackvein/quests/util/CK.java b/main/src/main/java/me/blackvein/quests/util/CK.java index 74db34a6a..beb43652f 100644 --- a/main/src/main/java/me/blackvein/quests/util/CK.java +++ b/main/src/main/java/me/blackvein/quests/util/CK.java @@ -134,6 +134,7 @@ public class CK { public static final String OPT_ALLOW_QUITTING = "allowQuittingOpt"; public static final String OPT_USE_DUNGEONSXL_PLUGIN = "useDungeonsXLPluginOpt"; public static final String OPT_USE_PARTIES_PLUGIN = "usePartiesPluginOpt"; + public static final String OPT_SHARE_PROGRESS_LEVEL = "shareProgressLevelOpt"; // Events public static final String E_OLD_EVENT = "oldEvent"; public static final String E_NAME = "evtName"; diff --git a/main/src/main/resources/strings.yml b/main/src/main/resources/strings.yml index 9e340ff34..0ce514fa9 100644 --- a/main/src/main/resources/strings.yml +++ b/main/src/main/resources/strings.yml @@ -255,7 +255,6 @@ stageEditorInvalidEnchantment: "is not a valid enchantment name!" stageEditorInvalidNPC: "is not a valid NPC ID!" stageEditorInvalidMob: "is not a valid mob name!" stageEditorInvalidItemName: "is not a valid item name!" -stageEditorInvalidNumber: "is not a number!" stageEditorInvalidDye: "is not a valid dye color!" stageEditorInvalidEvent: "is not a valid action name!" stageEditorDuplicateEvent: "Action is already in the list!" @@ -351,7 +350,6 @@ eventEditorSetItemAmounts: "Set item amounts" eventEditorNoNames: "No names set" eventEditorMustSetNames: "You must set item names first!" eventEditorInvalidName: "is not a valid item name!" -eventEditorNotANumber: "is not a number!" eventEditorStorm: "Action Storm" eventEditorSetWorld: "Set world" eventEditorSetDuration: "Set duration" @@ -485,11 +483,13 @@ plnTooLate: " was last active