diff --git a/dist/pom.xml b/dist/pom.xml index 27bd667b5..f06aef4c9 100644 --- a/dist/pom.xml +++ b/dist/pom.xml @@ -5,7 +5,7 @@ me.blackvein.quests quests-parent - 3.8.1 + 3.8.2 quests-dist pom diff --git a/main/pom.xml b/main/pom.xml index 10bbef23e..938f149dd 100644 --- a/main/pom.xml +++ b/main/pom.xml @@ -4,7 +4,7 @@ me.blackvein.quests quests-parent - 3.8.1 + 3.8.2 quests-main diff --git a/main/src/main/java/me/blackvein/quests/Dependencies.java b/main/src/main/java/me/blackvein/quests/Dependencies.java index de32622cb..2218c5299 100644 --- a/main/src/main/java/me/blackvein/quests/Dependencies.java +++ b/main/src/main/java/me/blackvein/quests/Dependencies.java @@ -12,9 +12,14 @@ package me.blackvein.quests; +import java.util.UUID; + +import org.bukkit.Location; +import org.bukkit.entity.Player; import org.bukkit.plugin.RegisteredServiceProvider; import me.blackvein.quests.util.DenizenAPI; +import me.blackvein.quests.util.Lang; import me.blackvein.quests.util.WorldGuardAPI; import me.clip.placeholderapi.PlaceholderAPIPlugin; import net.citizensnpcs.api.CitizensPlugin; @@ -27,7 +32,11 @@ import com.alessiodp.parties.api.Parties; import com.alessiodp.parties.api.interfaces.PartiesAPI; import com.codisimus.plugins.phatloots.PhatLoots; import com.gmail.nossr50.mcMMO; +import com.gmail.nossr50.datatypes.player.McMMOPlayer; +import com.gmail.nossr50.datatypes.skills.SkillType; +import com.gmail.nossr50.util.player.UserManager; import com.herocraftonline.heroes.Heroes; +import com.herocraftonline.heroes.characters.Hero; import de.erethon.dungeonsxl.DungeonsXL; @@ -40,7 +49,7 @@ public class Dependencies { private static mcMMO mcmmo = null; private static Heroes heroes = null; private static PhatLoots phatLoots = null; - private static PlaceholderAPIPlugin placeholder = null; + public static PlaceholderAPIPlugin placeholder = null; private static CitizensPlugin citizens = null; private static DenizenAPI denizenApi = null; private static CitizensBooksAPI citizensBooks = null; @@ -215,7 +224,61 @@ public class Dependencies { return (permission != null); } + public String getCurrency(boolean plural) { + if (getVaultEconomy() == null) { + return Lang.get("money"); + } + if (plural) { + if (getVaultEconomy().currencyNamePlural().trim().isEmpty()) { + return Lang.get("money"); + } else { + return getVaultEconomy().currencyNamePlural(); + } + } else { + if (getVaultEconomy().currencyNameSingular().trim().isEmpty()) { + return Lang.get("money"); + } else { + return getVaultEconomy().currencyNameSingular(); + } + } + } + public boolean runDenizenScript(String scriptName, Quester quester) { return plugin.getDenizenTrigger().runDenizenScript(scriptName, quester); } + + public Location getNPCLocation(int id) { + return citizens.getNPCRegistry().getById(id).getStoredLocation(); + } + + public String getNPCName(int id) { + return citizens.getNPCRegistry().getById(id).getName(); + } + + public int getMcmmoSkillLevel(SkillType st, String player) { + McMMOPlayer mPlayer = UserManager.getPlayer(player); + if (mPlayer == null) { + return -1; + } + return mPlayer.getProfile().getSkillLevel(st); + } + + public Hero getHero(UUID uuid) { + Player p = plugin.getServer().getPlayer(uuid); + if (p == null) { + return null; + } + return heroes.getCharacterManager().getHero(p); + } + + public boolean testPrimaryHeroesClass(String primaryClass, UUID uuid) { + Hero hero = getHero(uuid); + return hero.getHeroClass().getName().equalsIgnoreCase(primaryClass); + } + + @SuppressWarnings("deprecation") + public boolean testSecondaryHeroesClass(String secondaryClass, UUID uuid) { + Hero hero = getHero(uuid); + return hero.getSecondClass().getName().equalsIgnoreCase(secondaryClass); + } } diff --git a/main/src/main/java/me/blackvein/quests/Quest.java b/main/src/main/java/me/blackvein/quests/Quest.java index 3097f2433..e59ce1dce 100644 --- a/main/src/main/java/me/blackvein/quests/Quest.java +++ b/main/src/main/java/me/blackvein/quests/Quest.java @@ -41,6 +41,8 @@ import me.blackvein.quests.events.quester.QuesterPreChangeStageEvent; import me.blackvein.quests.events.quester.QuesterPreCompleteQuestEvent; import me.blackvein.quests.events.quester.QuesterPreFailQuestEvent; import me.blackvein.quests.exceptions.InvalidStageException; +import me.blackvein.quests.util.ConfigUtil; +import me.blackvein.quests.util.InventoryUtil; import me.blackvein.quests.util.ItemUtil; import me.blackvein.quests.util.Lang; import me.clip.placeholderapi.PlaceholderAPI; @@ -53,11 +55,11 @@ public class Quest { private String name; protected String description; protected String finished; - protected String region = null; protected ItemStack guiDisplay = null; private LinkedList orderedStages = new LinkedList(); protected NPC npcStart; protected Location blockStart; + protected String regionStart = null; protected Action initialAction; private Requirements reqs = new Requirements(); private Planner pln = new Planner(); @@ -92,12 +94,26 @@ public class Quest { this.finished = finished; } - public String getRegion() { - return region; + public String getRegionStart() { + return regionStart; } + public void setRegionStart(String regionStart) { + this.regionStart = regionStart; + } + + /** + * @deprecated Use {@link #getRegionStart()} + */ + public String getRegion() { + return getRegionStart(); + } + + /** + * @deprecated Use {@link #setRegion(String)} + */ public void setRegion(String region) { - this.region = region; + setRegionStart(region); } public ItemStack getGUIDisplay() { @@ -184,7 +200,7 @@ public class Quest { } String stageCompleteMessage = currentStage.completeMessage; if (stageCompleteMessage != null) { - quester.getPlayer().sendMessage(plugin.parseStringWithPossibleLineBreaks(stageCompleteMessage, + quester.getPlayer().sendMessage(ConfigUtil.parseStringWithPossibleLineBreaks(stageCompleteMessage, this, quester.getPlayer())); } if (plugin.getSettings().canUseCompass()) { @@ -260,7 +276,7 @@ public class Quest { plugin.showObjectives(this, quester, false); String stageStartMessage = quester.getCurrentStage(this).startMessage; if (stageStartMessage != null) { - quester.getPlayer().sendMessage(plugin.parseStringWithPossibleLineBreaks(stageStartMessage, this, + quester.getPlayer().sendMessage(ConfigUtil.parseStringWithPossibleLineBreaks(stageStartMessage, this, quester.getPlayer())); } quester.updateJournal(); @@ -289,9 +305,9 @@ public class Quest { } Location targetLocation = null; if (nextStage.citizensToInteract != null && nextStage.citizensToInteract.size() > 0) { - targetLocation = plugin.getNPCLocation(nextStage.citizensToInteract.getFirst()); + targetLocation = plugin.getDependencies().getNPCLocation(nextStage.citizensToInteract.getFirst()); } else if (nextStage.citizensToKill != null && nextStage.citizensToKill.size() > 0) { - targetLocation = plugin.getNPCLocation(nextStage.citizensToKill.getFirst()); + targetLocation = plugin.getDependencies().getNPCLocation(nextStage.citizensToKill.getFirst()); } else if (nextStage.locationsToReach != null && nextStage.locationsToReach.size() > 0) { targetLocation = nextStage.locationsToReach.getFirst(); } else if (nextStage.itemDeliveryTargets != null && nextStage.itemDeliveryTargets.size() > 0) { @@ -359,12 +375,14 @@ public class Quest { } } if (reqs.getHeroesPrimaryClass() != null) { - if (plugin.testPrimaryHeroesClass(reqs.getHeroesPrimaryClass(), player.getUniqueId()) == false) { + if (plugin.getDependencies() + .testPrimaryHeroesClass(reqs.getHeroesPrimaryClass(), player.getUniqueId()) == false) { return false; } } if (reqs.getHeroesSecondaryClass() != null) { - if (plugin.testSecondaryHeroesClass(reqs.getHeroesSecondaryClass(), player.getUniqueId()) == false) { + if (plugin.getDependencies() + .testSecondaryHeroesClass(reqs.getHeroesSecondaryClass(), player.getUniqueId()) == false) { return false; } } @@ -447,7 +465,7 @@ public class Quest { } for (ItemStack i : rews.getItems()) { try { - Quests.addItem(player, i); + InventoryUtil.addItem(player, i); } catch (Exception e) { plugin.getLogger().severe("Unable to add null reward item to inventory of " + player.getName() + " upon completion of quest " + name); @@ -511,7 +529,7 @@ public class Quest { phatLootItems.addAll(lb.getItemList()); for (ItemStack is : lb.getItemList()) { try { - Quests.addItem(player, is); + InventoryUtil.addItem(player, is); } catch (Exception e) { plugin.getLogger().severe("Unable to add PhatLoots item to inventory of " + player.getName() + " upon completion of quest " + name); @@ -653,12 +671,10 @@ public class Quest { int index = 0; for (String s : rews.getCommands()) { if (rews.getCommandsOverrideDisplay().isEmpty() == false && rews.getCommandsOverrideDisplay().size() - >= index) { - if (rews.getCommandsOverrideDisplay().size() > index) { - if (!rews.getCommandsOverrideDisplay().get(index).trim().equals("")) { - player.sendMessage("- " + ChatColor.DARK_GREEN - + rews.getCommandsOverrideDisplay().get(index)); - } + > index) { + if (!rews.getCommandsOverrideDisplay().get(index).trim().equals("")) { + player.sendMessage("- " + ChatColor.DARK_GREEN + + rews.getCommandsOverrideDisplay().get(index)); } } else { player.sendMessage("- " + ChatColor.DARK_GREEN + s); @@ -779,11 +795,11 @@ public class Quest { * @return true if player is in region */ private boolean isInRegion(Player player) { - if (region == null) { + if (regionStart == null) { return false; } if (plugin.getDependencies().getWorldGuardApi() - .getApplicableRegionsIDs(player.getWorld(), player.getLocation()).contains(region)) { + .getApplicableRegionsIDs(player.getWorld(), player.getLocation()).contains(regionStart)) { return true; } return false; diff --git a/main/src/main/java/me/blackvein/quests/QuestData.java b/main/src/main/java/me/blackvein/quests/QuestData.java index 3b62b0155..26e1a4cf8 100644 --- a/main/src/main/java/me/blackvein/quests/QuestData.java +++ b/main/src/main/java/me/blackvein/quests/QuestData.java @@ -398,21 +398,29 @@ public class QuestData { } }; - public LinkedHashMap itemsDelivered = new LinkedHashMap() { + public LinkedList itemsDelivered = new LinkedList() { private static final long serialVersionUID = 2712497347022734646L; @Override - public Integer put(ItemStack key, Integer val) { - Integer data = super.put(key, val); + public ItemStack set(int index, ItemStack key) { + ItemStack data = super.set(index, key); if (doJournalUpdate) quester.updateJournal(); return data; } @Override - public Integer remove(Object key) { - Integer i = super.remove(key); + public boolean add(ItemStack key) { + boolean data = super.add(key); + if (doJournalUpdate) + quester.updateJournal(); + return data; + } + + @Override + public boolean remove(Object key) { + boolean i = super.remove(key); if (doJournalUpdate) quester.updateJournal(); return i; @@ -426,10 +434,11 @@ public class QuestData { } @Override - public void putAll(Map m) { - super.putAll(m); + public boolean addAll(Collection m) { + boolean i = super.addAll(m); if (doJournalUpdate) quester.updateJournal(); + return i; } }; diff --git a/main/src/main/java/me/blackvein/quests/QuestFactory.java b/main/src/main/java/me/blackvein/quests/QuestFactory.java index 10dcfee35..445742da6 100644 --- a/main/src/main/java/me/blackvein/quests/QuestFactory.java +++ b/main/src/main/java/me/blackvein/quests/QuestFactory.java @@ -58,6 +58,7 @@ import me.blackvein.quests.prompts.RewardsPrompt; import me.blackvein.quests.prompts.PlannerPrompt; import me.blackvein.quests.prompts.StagesPrompt; import me.blackvein.quests.util.CK; +import me.blackvein.quests.util.ConfigUtil; import me.blackvein.quests.util.ItemUtil; import me.blackvein.quests.util.Lang; import me.blackvein.quests.util.MiscUtil; @@ -431,7 +432,7 @@ public class QuestFactory implements ConversationAbandonedListener { + ChatColor.GOLD + " -\n"; for (int i = 1; i <= size; i++) { text += getNumberColor(context, i) + "" + ChatColor.BOLD + i + ChatColor.RESET + " - " - + getSelectionText(context, i) + " " + getAdditionalText(context, i) + "\n"; + + getSelectionText(context, i) + " " + getAdditionalText(context, i) + "\n"; } return text; } @@ -496,7 +497,7 @@ public class QuestFactory implements ConversationAbandonedListener { for (Quest q : plugin.getQuests()) { s += ChatColor.GRAY + "- " + ChatColor.YELLOW + q.getName() + "\n"; } - return s + ChatColor.GOLD + Lang.get("questEditorEditEnterQuestName"); + return s + ChatColor.GOLD + Lang.get("questEditorEnterQuestName"); } @Override @@ -513,6 +514,382 @@ public class QuestFactory implements ConversationAbandonedListener { } } } + + @SuppressWarnings("deprecation") + public static void loadQuest(ConversationContext cc, Quest q) { + cc.setSessionData(CK.ED_QUEST_EDIT, q.getName()); + cc.setSessionData(CK.Q_NAME, q.getName()); + if (q.npcStart != null) { + cc.setSessionData(CK.Q_START_NPC, q.npcStart.getId()); + } + cc.setSessionData(CK.Q_START_BLOCK, q.blockStart); + cc.setSessionData(CK.Q_ASK_MESSAGE, q.description); + cc.setSessionData(CK.Q_FINISH_MESSAGE, q.finished); + if (q.initialAction != null) { + cc.setSessionData(CK.Q_INITIAL_EVENT, q.initialAction.getName()); + } + if (q.regionStart != null) { + cc.setSessionData(CK.Q_REGION, q.regionStart); + } + if (q.guiDisplay != null) { + cc.setSessionData(CK.Q_GUIDISPLAY, q.guiDisplay); + } + Requirements reqs = q.getRequirements(); + if (reqs.getMoney() != 0) { + cc.setSessionData(CK.REQ_MONEY, reqs.getMoney()); + } + if (reqs.getQuestPoints() != 0) { + cc.setSessionData(CK.REQ_QUEST_POINTS, reqs.getQuestPoints()); + } + if (reqs.getItems().isEmpty() == false) { + cc.setSessionData(CK.REQ_ITEMS, reqs.getItems()); + cc.setSessionData(CK.REQ_ITEMS_REMOVE, reqs.getRemoveItems()); + } + if (reqs.getNeededQuests().isEmpty() == false) { + cc.setSessionData(CK.REQ_QUEST, reqs.getNeededQuests()); + } + if (reqs.getBlockQuests().isEmpty() == false) { + cc.setSessionData(CK.REQ_QUEST_BLOCK, reqs.getBlockQuests()); + } + if (reqs.getMcmmoSkills().isEmpty() == false) { + cc.setSessionData(CK.REQ_MCMMO_SKILLS, reqs.getMcmmoAmounts()); + cc.setSessionData(CK.REQ_MCMMO_SKILL_AMOUNTS, reqs.getMcmmoAmounts()); + } + if (reqs.getPermissions().isEmpty() == false) { + cc.setSessionData(CK.REQ_PERMISSION, reqs.getPermissions()); + } + if (reqs.getHeroesPrimaryClass() != null) { + cc.setSessionData(CK.REQ_HEROES_PRIMARY_CLASS, reqs.getHeroesPrimaryClass()); + } + if (reqs.getHeroesSecondaryClass() != null) { + cc.setSessionData(CK.REQ_HEROES_SECONDARY_CLASS, reqs.getHeroesSecondaryClass()); + } + if (reqs.getFailRequirements() != null) { + cc.setSessionData(CK.Q_FAIL_MESSAGE, reqs.getFailRequirements()); + } + if (reqs.getCustomRequirements().isEmpty() == false) { + LinkedList list = new LinkedList(); + LinkedList> datamapList = new LinkedList>(); + for (Entry> entry : reqs.getCustomRequirements().entrySet()) { + list.add(entry.getKey()); + datamapList.add(entry.getValue()); + } + cc.setSessionData(CK.REQ_CUSTOM, list); + cc.setSessionData(CK.REQ_CUSTOM_DATA, datamapList); + } + Rewards rews = q.getRewards(); + if (rews.getMoney() != 0) { + cc.setSessionData(CK.REW_MONEY, rews.getMoney()); + } + if (rews.getQuestPoints() != 0) { + cc.setSessionData(CK.REW_QUEST_POINTS, rews.getQuestPoints()); + } + if (rews.getExp() != 0) { + cc.setSessionData(CK.REW_EXP, rews.getExp()); + } + if (rews.getItems().isEmpty() == false) { + cc.setSessionData(CK.REW_ITEMS, rews.getItems()); + } + if (rews.getCommands().isEmpty() == false) { + cc.setSessionData(CK.REW_COMMAND, rews.getCommands()); + } + if (rews.getCommandsOverrideDisplay().isEmpty() == false) { + cc.setSessionData(CK.REW_COMMAND_OVERRIDE_DISPLAY, rews.getCommandsOverrideDisplay()); + } + if (rews.getPermissions().isEmpty() == false) { + cc.setSessionData(CK.REW_PERMISSION, rews.getPermissions()); + } + if (rews.getMcmmoSkills().isEmpty() == false) { + cc.setSessionData(CK.REW_MCMMO_SKILLS, rews.getMcmmoSkills()); + cc.setSessionData(CK.REW_MCMMO_AMOUNTS, rews.getMcmmoAmounts()); + } + if (rews.getHeroesClasses().isEmpty() == false) { + cc.setSessionData(CK.REW_HEROES_CLASSES, rews.getHeroesClasses()); + cc.setSessionData(CK.REW_HEROES_AMOUNTS, rews.getHeroesAmounts()); + } + if (rews.getPhatLoots().isEmpty() == false) { + cc.setSessionData(CK.REW_PHAT_LOOTS, rews.getPhatLoots()); + } + if (rews.getCustomRewards().isEmpty() == false) { + cc.setSessionData(CK.REW_CUSTOM, new LinkedList(rews.getCustomRewards().keySet())); + cc.setSessionData(CK.REW_CUSTOM_DATA, new LinkedList(rews.getCustomRewards().values())); + } + Planner pln = q.getPlanner(); + if (pln.getStart() != null) { + cc.setSessionData(CK.PLN_START_DATE, pln.getStart()); + } + if (pln.getEnd() != null) { + cc.setSessionData(CK.PLN_END_DATE, pln.getEnd()); + } + if (pln.getRepeat() != -1) { + cc.setSessionData(CK.PLN_REPEAT_CYCLE, pln.getRepeat()); + } + if (pln.getCooldown() != -1) { + cc.setSessionData(CK.PLN_COOLDOWN, pln.getCooldown()); + } + Options opt = q.getOptions(); + cc.setSessionData(CK.OPT_ALLOW_COMMANDS, opt.getAllowCommands()); + 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()); + cc.setSessionData(CK.OPT_REQUIRE_SAME_QUEST, opt.getRequireSameQuest()); + // Stages (Objectives) + int index = 1; + for (Stage stage : q.getStages()) { + final String pref = "stage" + index; + index++; + cc.setSessionData(pref, Boolean.TRUE); + if (stage.blocksToBreak != null) { + LinkedList names = new LinkedList(); + LinkedList amnts = new LinkedList(); + LinkedList durab = new LinkedList(); + for (ItemStack e : stage.blocksToBreak) { + names.add(e.getType().name()); + amnts.add(e.getAmount()); + durab.add(e.getDurability()); + } + cc.setSessionData(pref + CK.S_BREAK_NAMES, names); + cc.setSessionData(pref + CK.S_BREAK_AMOUNTS, amnts); + cc.setSessionData(pref + CK.S_BREAK_DURABILITY, durab); + } + if (stage.blocksToDamage != null) { + LinkedList names = new LinkedList(); + LinkedList amnts = new LinkedList(); + LinkedList durab = new LinkedList(); + for (ItemStack e : stage.blocksToDamage) { + names.add(e.getType().name()); + amnts.add(e.getAmount()); + durab.add(e.getDurability()); + } + cc.setSessionData(pref + CK.S_DAMAGE_NAMES, names); + cc.setSessionData(pref + CK.S_DAMAGE_AMOUNTS, amnts); + cc.setSessionData(pref + CK.S_DAMAGE_DURABILITY, durab); + } + if (stage.blocksToPlace != null) { + LinkedList names = new LinkedList(); + LinkedList amnts = new LinkedList(); + LinkedList durab = new LinkedList(); + for (ItemStack e : stage.blocksToPlace) { + names.add(e.getType().name()); + amnts.add(e.getAmount()); + durab.add(e.getDurability()); + } + cc.setSessionData(pref + CK.S_PLACE_NAMES, names); + cc.setSessionData(pref + CK.S_PLACE_AMOUNTS, amnts); + cc.setSessionData(pref + CK.S_PLACE_DURABILITY, durab); + } + if (stage.blocksToUse != null) { + LinkedList names = new LinkedList(); + LinkedList amnts = new LinkedList(); + LinkedList durab = new LinkedList(); + for (ItemStack e : stage.blocksToUse) { + names.add(e.getType().name()); + amnts.add(e.getAmount()); + durab.add(e.getDurability()); + } + cc.setSessionData(pref + CK.S_USE_NAMES, names); + cc.setSessionData(pref + CK.S_USE_AMOUNTS, amnts); + cc.setSessionData(pref + CK.S_USE_DURABILITY, durab); + } + if (stage.blocksToCut != null) { + LinkedList names = new LinkedList(); + LinkedList amnts = new LinkedList(); + LinkedList durab = new LinkedList(); + for (ItemStack e : stage.blocksToCut) { + names.add(e.getType().name()); + amnts.add(e.getAmount()); + durab.add(e.getDurability()); + } + cc.setSessionData(pref + CK.S_CUT_NAMES, names); + cc.setSessionData(pref + CK.S_CUT_AMOUNTS, amnts); + cc.setSessionData(pref + CK.S_CUT_DURABILITY, durab); + } + if (stage.getItemsToCraft().isEmpty() == false) { + LinkedList items = new LinkedList(); + for (ItemStack is : stage.getItemsToCraft()) { + items.add(is); + } + cc.setSessionData(pref + CK.S_CRAFT_ITEMS, items); + } + if (stage.getItemsToSmelt().isEmpty() == false) { + LinkedList items = new LinkedList(); + for (ItemStack is : stage.getItemsToSmelt()) { + items.add(is); + } + cc.setSessionData(pref + CK.S_SMELT_ITEMS, items); + } + if (stage.itemsToEnchant.isEmpty() == false) { + LinkedList enchants = new LinkedList(); + LinkedList names = new LinkedList(); + LinkedList amounts = new LinkedList(); + for (Entry, Integer> e : stage.itemsToEnchant.entrySet()) { + amounts.add(e.getValue()); + for (Entry e2 : e.getKey().entrySet()) { + names.add(e2.getValue().name()); + enchants.add(ItemUtil.getPrettyEnchantmentName(e2.getKey())); + } + } + cc.setSessionData(pref + CK.S_ENCHANT_TYPES, enchants); + cc.setSessionData(pref + CK.S_ENCHANT_NAMES, names); + cc.setSessionData(pref + CK.S_ENCHANT_AMOUNTS, amounts); + } + if (stage.getItemsToBrew().isEmpty() == false) { + LinkedList items = new LinkedList(); + for (ItemStack is : stage.getItemsToBrew()) { + items.add(is); + } + cc.setSessionData(pref + CK.S_BREW_ITEMS, items); + } + if (stage.fishToCatch != null) { + cc.setSessionData(pref + CK.S_FISH, stage.fishToCatch); + } + if (stage.playersToKill != null) { + cc.setSessionData(pref + CK.S_PLAYER_KILL, stage.playersToKill); + } + if (stage.getItemsToDeliver().isEmpty() == false) { + LinkedList items = new LinkedList(); + LinkedList npcs = new LinkedList(); + for (ItemStack is : stage.getItemsToDeliver()) { + items.add(is); + } + for (Integer n : stage.getItemDeliveryTargets()) { + npcs.add(n); + } + cc.setSessionData(pref + CK.S_DELIVERY_ITEMS, items); + cc.setSessionData(pref + CK.S_DELIVERY_NPCS, npcs); + cc.setSessionData(pref + CK.S_DELIVERY_MESSAGES, stage.deliverMessages); + } + if (stage.citizensToInteract.isEmpty() == false) { + LinkedList npcs = new LinkedList(); + for (Integer n : stage.citizensToInteract) { + npcs.add(n); + } + cc.setSessionData(pref + CK.S_NPCS_TO_TALK_TO, npcs); + } + if (stage.citizensToKill.isEmpty() == false) { + LinkedList npcs = new LinkedList(); + for (Integer n : stage.citizensToKill) { + npcs.add(n); + } + cc.setSessionData(pref + CK.S_NPCS_TO_KILL, npcs); + cc.setSessionData(pref + CK.S_NPCS_TO_KILL_AMOUNTS, stage.citizenNumToKill); + } + if (stage.mobsToKill.isEmpty() == false) { + LinkedList mobs = new LinkedList(); + for (EntityType et : stage.mobsToKill) { + mobs.add(MiscUtil.getPrettyMobName(et)); + } + cc.setSessionData(pref + CK.S_MOB_TYPES, mobs); + cc.setSessionData(pref + CK.S_MOB_AMOUNTS, stage.mobNumToKill); + if (stage.locationsToKillWithin.isEmpty() == false) { + LinkedList locs = new LinkedList(); + for (Location l : stage.locationsToKillWithin) { + locs.add(Quests.getLocationInfo(l)); + } + cc.setSessionData(pref + CK.S_MOB_KILL_LOCATIONS, locs); + cc.setSessionData(pref + CK.S_MOB_KILL_LOCATIONS_RADIUS, stage.radiiToKillWithin); + cc.setSessionData(pref + CK.S_MOB_KILL_LOCATIONS_NAMES, stage.killNames); + } + } + if (stage.locationsToReach.isEmpty() == false) { + LinkedList locs = new LinkedList(); + for (Location l : stage.locationsToReach) { + locs.add(Quests.getLocationInfo(l)); + } + cc.setSessionData(pref + CK.S_REACH_LOCATIONS, locs); + cc.setSessionData(pref + CK.S_REACH_LOCATIONS_RADIUS, stage.radiiToReachWithin); + cc.setSessionData(pref + CK.S_REACH_LOCATIONS_NAMES, stage.locationNames); + } + if (stage.mobsToTame.isEmpty() == false) { + LinkedList mobs = new LinkedList(); + LinkedList amnts = new LinkedList(); + for (Entry e : stage.mobsToTame.entrySet()) { + mobs.add(MiscUtil.getPrettyMobName(e.getKey())); + amnts.add(e.getValue()); + } + cc.setSessionData(pref + CK.S_TAME_TYPES, mobs); + cc.setSessionData(pref + CK.S_TAME_AMOUNTS, amnts); + } + if (stage.sheepToShear.isEmpty() == false) { + LinkedList colors = new LinkedList(); + LinkedList amnts = new LinkedList(); + for (Entry e : stage.sheepToShear.entrySet()) { + colors.add(MiscUtil.getPrettyDyeColorName(e.getKey())); + amnts.add(e.getValue()); + } + cc.setSessionData(pref + CK.S_SHEAR_COLORS, colors); + cc.setSessionData(pref + CK.S_SHEAR_AMOUNTS, amnts); + } + if (stage.passwordDisplays.isEmpty() == false) { + cc.setSessionData(pref + CK.S_PASSWORD_DISPLAYS, stage.passwordDisplays); + cc.setSessionData(pref + CK.S_PASSWORD_PHRASES, stage.passwordPhrases); + } + if (stage.customObjectives.isEmpty() == false) { + LinkedList list = new LinkedList(); + LinkedList countList = new LinkedList(); + LinkedList> datamapList = new LinkedList>(); + for (int i = 0; i < stage.customObjectives.size(); i++) { + list.add(stage.customObjectives.get(i).getName()); + countList.add(stage.customObjectiveCounts.get(i)); + } + datamapList.addAll(stage.customObjectiveData); + cc.setSessionData(pref + CK.S_CUSTOM_OBJECTIVES, list); + cc.setSessionData(pref + CK.S_CUSTOM_OBJECTIVES_COUNT, countList); + cc.setSessionData(pref + CK.S_CUSTOM_OBJECTIVES_DATA, datamapList); + } + if (stage.startEvent != null) { + cc.setSessionData(pref + CK.S_START_EVENT, stage.startEvent.getName()); + } + if (stage.finishEvent != null) { + cc.setSessionData(pref + CK.S_FINISH_EVENT, stage.finishEvent.getName()); + } + if (stage.deathEvent != null) { + cc.setSessionData(pref + CK.S_DEATH_EVENT, stage.deathEvent.getName()); + } + if (stage.disconnectEvent != null) { + cc.setSessionData(pref + CK.S_DISCONNECT_EVENT, stage.disconnectEvent.getName()); + } + if (stage.chatEvents != null) { + LinkedList chatEvents = new LinkedList(); + LinkedList chatEventTriggers = new LinkedList(); + for (String s : stage.chatEvents.keySet()) { + chatEventTriggers.add(s); + chatEvents.add(stage.chatEvents.get(s).getName()); + } + cc.setSessionData(pref + CK.S_CHAT_EVENTS, chatEvents); + cc.setSessionData(pref + CK.S_CHAT_EVENT_TRIGGERS, chatEventTriggers); + } + if (stage.commandEvents != null) { + LinkedList commandEvents = new LinkedList(); + LinkedList commandEventTriggers = new LinkedList(); + for (String s : stage.commandEvents.keySet()) { + commandEventTriggers.add(s); + commandEvents.add(stage.commandEvents.get(s).getName()); + } + cc.setSessionData(pref + CK.S_COMMAND_EVENTS, commandEvents); + cc.setSessionData(pref + CK.S_COMMAND_EVENT_TRIGGERS, commandEventTriggers); + } + if (stage.delay != -1) { + cc.setSessionData(pref + CK.S_DELAY, stage.delay); + if (stage.delayMessage != null) { + cc.setSessionData(pref + CK.S_DELAY_MESSAGE, stage.delayMessage); + } + } + if (stage.script != null) { + cc.setSessionData(pref + CK.S_DENIZEN, stage.script); + } + if (stage.objectiveOverride != null) { + cc.setSessionData(pref + CK.S_OVERRIDE_DISPLAY, stage.objectiveOverride); + } + if (stage.completeMessage != null) { + cc.setSessionData(pref + CK.S_COMPLETE_MESSAGE, stage.completeMessage); + } + if (stage.startMessage != null) { + cc.setSessionData(pref + CK.S_START_MESSAGE, stage.startMessage); + } + } + } private class QuestNamePrompt extends StringPrompt { @@ -1032,7 +1409,7 @@ public class QuestFactory implements ConversationAbandonedListener { npcStart = (Integer) cc.getSessionData(CK.Q_START_NPC); } if (cc.getSessionData(CK.Q_START_BLOCK) != null) { - blockStart = Quests.getLocationInfo((Location) cc.getSessionData(CK.Q_START_BLOCK)); + blockStart = ConfigUtil.getLocationInfo((Location) cc.getSessionData(CK.Q_START_BLOCK)); } if (cc.getSessionData(CK.REQ_MONEY) != null) { moneyReq = (Integer) cc.getSessionData(CK.REQ_MONEY); @@ -1638,382 +2015,6 @@ public class QuestFactory implements ConversationAbandonedListener { sch.set("require-same-quest", requireSameQuestOpt); } - @SuppressWarnings("deprecation") - public static void loadQuest(ConversationContext cc, Quest q) { - cc.setSessionData(CK.ED_QUEST_EDIT, q.getName()); - cc.setSessionData(CK.Q_NAME, q.getName()); - if (q.npcStart != null) { - cc.setSessionData(CK.Q_START_NPC, q.npcStart.getId()); - } - cc.setSessionData(CK.Q_START_BLOCK, q.blockStart); - cc.setSessionData(CK.Q_ASK_MESSAGE, q.description); - cc.setSessionData(CK.Q_FINISH_MESSAGE, q.finished); - if (q.initialAction != null) { - cc.setSessionData(CK.Q_INITIAL_EVENT, q.initialAction.getName()); - } - if (q.region != null) { - cc.setSessionData(CK.Q_REGION, q.region); - } - if (q.guiDisplay != null) { - cc.setSessionData(CK.Q_GUIDISPLAY, q.guiDisplay); - } - Requirements reqs = q.getRequirements(); - if (reqs.getMoney() != 0) { - cc.setSessionData(CK.REQ_MONEY, reqs.getMoney()); - } - if (reqs.getQuestPoints() != 0) { - cc.setSessionData(CK.REQ_QUEST_POINTS, reqs.getQuestPoints()); - } - if (reqs.getItems().isEmpty() == false) { - cc.setSessionData(CK.REQ_ITEMS, reqs.getItems()); - cc.setSessionData(CK.REQ_ITEMS_REMOVE, reqs.getRemoveItems()); - } - if (reqs.getNeededQuests().isEmpty() == false) { - cc.setSessionData(CK.REQ_QUEST, reqs.getNeededQuests()); - } - if (reqs.getBlockQuests().isEmpty() == false) { - cc.setSessionData(CK.REQ_QUEST_BLOCK, reqs.getBlockQuests()); - } - if (reqs.getMcmmoSkills().isEmpty() == false) { - cc.setSessionData(CK.REQ_MCMMO_SKILLS, reqs.getMcmmoAmounts()); - cc.setSessionData(CK.REQ_MCMMO_SKILL_AMOUNTS, reqs.getMcmmoAmounts()); - } - if (reqs.getPermissions().isEmpty() == false) { - cc.setSessionData(CK.REQ_PERMISSION, reqs.getPermissions()); - } - if (reqs.getHeroesPrimaryClass() != null) { - cc.setSessionData(CK.REQ_HEROES_PRIMARY_CLASS, reqs.getHeroesPrimaryClass()); - } - if (reqs.getHeroesSecondaryClass() != null) { - cc.setSessionData(CK.REQ_HEROES_SECONDARY_CLASS, reqs.getHeroesSecondaryClass()); - } - if (reqs.getFailRequirements() != null) { - cc.setSessionData(CK.Q_FAIL_MESSAGE, reqs.getFailRequirements()); - } - if (reqs.getCustomRequirements().isEmpty() == false) { - LinkedList list = new LinkedList(); - LinkedList> datamapList = new LinkedList>(); - for (Entry> entry : reqs.getCustomRequirements().entrySet()) { - list.add(entry.getKey()); - datamapList.add(entry.getValue()); - } - cc.setSessionData(CK.REQ_CUSTOM, list); - cc.setSessionData(CK.REQ_CUSTOM_DATA, datamapList); - } - Rewards rews = q.getRewards(); - if (rews.getMoney() != 0) { - cc.setSessionData(CK.REW_MONEY, rews.getMoney()); - } - if (rews.getQuestPoints() != 0) { - cc.setSessionData(CK.REW_QUEST_POINTS, rews.getQuestPoints()); - } - if (rews.getExp() != 0) { - cc.setSessionData(CK.REW_EXP, rews.getExp()); - } - if (rews.getItems().isEmpty() == false) { - cc.setSessionData(CK.REW_ITEMS, rews.getItems()); - } - if (rews.getCommands().isEmpty() == false) { - cc.setSessionData(CK.REW_COMMAND, rews.getCommands()); - } - if (rews.getCommandsOverrideDisplay().isEmpty() == false) { - cc.setSessionData(CK.REW_COMMAND_OVERRIDE_DISPLAY, rews.getCommandsOverrideDisplay()); - } - if (rews.getPermissions().isEmpty() == false) { - cc.setSessionData(CK.REW_PERMISSION, rews.getPermissions()); - } - if (rews.getMcmmoSkills().isEmpty() == false) { - cc.setSessionData(CK.REW_MCMMO_SKILLS, rews.getMcmmoSkills()); - cc.setSessionData(CK.REW_MCMMO_AMOUNTS, rews.getMcmmoAmounts()); - } - if (rews.getHeroesClasses().isEmpty() == false) { - cc.setSessionData(CK.REW_HEROES_CLASSES, rews.getHeroesClasses()); - cc.setSessionData(CK.REW_HEROES_AMOUNTS, rews.getHeroesAmounts()); - } - if (rews.getPhatLoots().isEmpty() == false) { - cc.setSessionData(CK.REW_PHAT_LOOTS, rews.getPhatLoots()); - } - if (rews.getCustomRewards().isEmpty() == false) { - cc.setSessionData(CK.REW_CUSTOM, new LinkedList(rews.getCustomRewards().keySet())); - cc.setSessionData(CK.REW_CUSTOM_DATA, new LinkedList(rews.getCustomRewards().values())); - } - Planner pln = q.getPlanner(); - if (pln.getStart() != null) { - cc.setSessionData(CK.PLN_START_DATE, pln.getStart()); - } - if (pln.getEnd() != null) { - cc.setSessionData(CK.PLN_END_DATE, pln.getEnd()); - } - if (pln.getRepeat() != -1) { - cc.setSessionData(CK.PLN_REPEAT_CYCLE, pln.getRepeat()); - } - if (pln.getCooldown() != -1) { - cc.setSessionData(CK.PLN_COOLDOWN, pln.getCooldown()); - } - Options opt = q.getOptions(); - cc.setSessionData(CK.OPT_ALLOW_COMMANDS, opt.getAllowCommands()); - 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()); - cc.setSessionData(CK.OPT_REQUIRE_SAME_QUEST, opt.getRequireSameQuest()); - // Stages (Objectives) - int index = 1; - for (Stage stage : q.getStages()) { - final String pref = "stage" + index; - index++; - cc.setSessionData(pref, Boolean.TRUE); - if (stage.blocksToBreak != null) { - LinkedList names = new LinkedList(); - LinkedList amnts = new LinkedList(); - LinkedList durab = new LinkedList(); - for (ItemStack e : stage.blocksToBreak) { - names.add(e.getType().name()); - amnts.add(e.getAmount()); - durab.add(e.getDurability()); - } - cc.setSessionData(pref + CK.S_BREAK_NAMES, names); - cc.setSessionData(pref + CK.S_BREAK_AMOUNTS, amnts); - cc.setSessionData(pref + CK.S_BREAK_DURABILITY, durab); - } - if (stage.blocksToDamage != null) { - LinkedList names = new LinkedList(); - LinkedList amnts = new LinkedList(); - LinkedList durab = new LinkedList(); - for (ItemStack e : stage.blocksToDamage) { - names.add(e.getType().name()); - amnts.add(e.getAmount()); - durab.add(e.getDurability()); - } - cc.setSessionData(pref + CK.S_DAMAGE_NAMES, names); - cc.setSessionData(pref + CK.S_DAMAGE_AMOUNTS, amnts); - cc.setSessionData(pref + CK.S_DAMAGE_DURABILITY, durab); - } - if (stage.blocksToPlace != null) { - LinkedList names = new LinkedList(); - LinkedList amnts = new LinkedList(); - LinkedList durab = new LinkedList(); - for (ItemStack e : stage.blocksToPlace) { - names.add(e.getType().name()); - amnts.add(e.getAmount()); - durab.add(e.getDurability()); - } - cc.setSessionData(pref + CK.S_PLACE_NAMES, names); - cc.setSessionData(pref + CK.S_PLACE_AMOUNTS, amnts); - cc.setSessionData(pref + CK.S_PLACE_DURABILITY, durab); - } - if (stage.blocksToUse != null) { - LinkedList names = new LinkedList(); - LinkedList amnts = new LinkedList(); - LinkedList durab = new LinkedList(); - for (ItemStack e : stage.blocksToUse) { - names.add(e.getType().name()); - amnts.add(e.getAmount()); - durab.add(e.getDurability()); - } - cc.setSessionData(pref + CK.S_USE_NAMES, names); - cc.setSessionData(pref + CK.S_USE_AMOUNTS, amnts); - cc.setSessionData(pref + CK.S_USE_DURABILITY, durab); - } - if (stage.blocksToCut != null) { - LinkedList names = new LinkedList(); - LinkedList amnts = new LinkedList(); - LinkedList durab = new LinkedList(); - for (ItemStack e : stage.blocksToCut) { - names.add(e.getType().name()); - amnts.add(e.getAmount()); - durab.add(e.getDurability()); - } - cc.setSessionData(pref + CK.S_CUT_NAMES, names); - cc.setSessionData(pref + CK.S_CUT_AMOUNTS, amnts); - cc.setSessionData(pref + CK.S_CUT_DURABILITY, durab); - } - if (stage.getItemsToCraft().isEmpty() == false) { - LinkedList items = new LinkedList(); - for (ItemStack is : stage.getItemsToCraft()) { - items.add(is); - } - cc.setSessionData(pref + CK.S_CRAFT_ITEMS, items); - } - if (stage.getItemsToSmelt().isEmpty() == false) { - LinkedList items = new LinkedList(); - for (ItemStack is : stage.getItemsToSmelt()) { - items.add(is); - } - cc.setSessionData(pref + CK.S_SMELT_ITEMS, items); - } - if (stage.itemsToEnchant.isEmpty() == false) { - LinkedList enchants = new LinkedList(); - LinkedList names = new LinkedList(); - LinkedList amounts = new LinkedList(); - for (Entry, Integer> e : stage.itemsToEnchant.entrySet()) { - amounts.add(e.getValue()); - for (Entry e2 : e.getKey().entrySet()) { - names.add(e2.getValue().name()); - enchants.add(ItemUtil.getPrettyEnchantmentName(e2.getKey())); - } - } - cc.setSessionData(pref + CK.S_ENCHANT_TYPES, enchants); - cc.setSessionData(pref + CK.S_ENCHANT_NAMES, names); - cc.setSessionData(pref + CK.S_ENCHANT_AMOUNTS, amounts); - } - if (stage.getItemsToBrew().isEmpty() == false) { - LinkedList items = new LinkedList(); - for (ItemStack is : stage.getItemsToBrew()) { - items.add(is); - } - cc.setSessionData(pref + CK.S_BREW_ITEMS, items); - } - if (stage.fishToCatch != null) { - cc.setSessionData(pref + CK.S_FISH, stage.fishToCatch); - } - if (stage.playersToKill != null) { - cc.setSessionData(pref + CK.S_PLAYER_KILL, stage.playersToKill); - } - if (stage.getItemsToDeliver().isEmpty() == false) { - LinkedList items = new LinkedList(); - LinkedList npcs = new LinkedList(); - for (ItemStack is : stage.getItemsToDeliver()) { - items.add(is); - } - for (Integer n : stage.getItemDeliveryTargets()) { - npcs.add(n); - } - cc.setSessionData(pref + CK.S_DELIVERY_ITEMS, items); - cc.setSessionData(pref + CK.S_DELIVERY_NPCS, npcs); - cc.setSessionData(pref + CK.S_DELIVERY_MESSAGES, stage.deliverMessages); - } - if (stage.citizensToInteract.isEmpty() == false) { - LinkedList npcs = new LinkedList(); - for (Integer n : stage.citizensToInteract) { - npcs.add(n); - } - cc.setSessionData(pref + CK.S_NPCS_TO_TALK_TO, npcs); - } - if (stage.citizensToKill.isEmpty() == false) { - LinkedList npcs = new LinkedList(); - for (Integer n : stage.citizensToKill) { - npcs.add(n); - } - cc.setSessionData(pref + CK.S_NPCS_TO_KILL, npcs); - cc.setSessionData(pref + CK.S_NPCS_TO_KILL_AMOUNTS, stage.citizenNumToKill); - } - if (stage.mobsToKill.isEmpty() == false) { - LinkedList mobs = new LinkedList(); - for (EntityType et : stage.mobsToKill) { - mobs.add(MiscUtil.getPrettyMobName(et)); - } - cc.setSessionData(pref + CK.S_MOB_TYPES, mobs); - cc.setSessionData(pref + CK.S_MOB_AMOUNTS, stage.mobNumToKill); - if (stage.locationsToKillWithin.isEmpty() == false) { - LinkedList locs = new LinkedList(); - for (Location l : stage.locationsToKillWithin) { - locs.add(Quests.getLocationInfo(l)); - } - cc.setSessionData(pref + CK.S_MOB_KILL_LOCATIONS, locs); - cc.setSessionData(pref + CK.S_MOB_KILL_LOCATIONS_RADIUS, stage.radiiToKillWithin); - cc.setSessionData(pref + CK.S_MOB_KILL_LOCATIONS_NAMES, stage.killNames); - } - } - if (stage.locationsToReach.isEmpty() == false) { - LinkedList locs = new LinkedList(); - for (Location l : stage.locationsToReach) { - locs.add(Quests.getLocationInfo(l)); - } - cc.setSessionData(pref + CK.S_REACH_LOCATIONS, locs); - cc.setSessionData(pref + CK.S_REACH_LOCATIONS_RADIUS, stage.radiiToReachWithin); - cc.setSessionData(pref + CK.S_REACH_LOCATIONS_NAMES, stage.locationNames); - } - if (stage.mobsToTame.isEmpty() == false) { - LinkedList mobs = new LinkedList(); - LinkedList amnts = new LinkedList(); - for (Entry e : stage.mobsToTame.entrySet()) { - mobs.add(MiscUtil.getPrettyMobName(e.getKey())); - amnts.add(e.getValue()); - } - cc.setSessionData(pref + CK.S_TAME_TYPES, mobs); - cc.setSessionData(pref + CK.S_TAME_AMOUNTS, amnts); - } - if (stage.sheepToShear.isEmpty() == false) { - LinkedList colors = new LinkedList(); - LinkedList amnts = new LinkedList(); - for (Entry e : stage.sheepToShear.entrySet()) { - colors.add(MiscUtil.getPrettyDyeColorName(e.getKey())); - amnts.add(e.getValue()); - } - cc.setSessionData(pref + CK.S_SHEAR_COLORS, colors); - cc.setSessionData(pref + CK.S_SHEAR_AMOUNTS, amnts); - } - if (stage.passwordDisplays.isEmpty() == false) { - cc.setSessionData(pref + CK.S_PASSWORD_DISPLAYS, stage.passwordDisplays); - cc.setSessionData(pref + CK.S_PASSWORD_PHRASES, stage.passwordPhrases); - } - if (stage.customObjectives.isEmpty() == false) { - LinkedList list = new LinkedList(); - LinkedList countList = new LinkedList(); - LinkedList> datamapList = new LinkedList>(); - for (int i = 0; i < stage.customObjectives.size(); i++) { - list.add(stage.customObjectives.get(i).getName()); - countList.add(stage.customObjectiveCounts.get(i)); - } - datamapList.addAll(stage.customObjectiveData); - cc.setSessionData(pref + CK.S_CUSTOM_OBJECTIVES, list); - cc.setSessionData(pref + CK.S_CUSTOM_OBJECTIVES_COUNT, countList); - cc.setSessionData(pref + CK.S_CUSTOM_OBJECTIVES_DATA, datamapList); - } - if (stage.startEvent != null) { - cc.setSessionData(pref + CK.S_START_EVENT, stage.startEvent.getName()); - } - if (stage.finishEvent != null) { - cc.setSessionData(pref + CK.S_FINISH_EVENT, stage.finishEvent.getName()); - } - if (stage.deathEvent != null) { - cc.setSessionData(pref + CK.S_DEATH_EVENT, stage.deathEvent.getName()); - } - if (stage.disconnectEvent != null) { - cc.setSessionData(pref + CK.S_DISCONNECT_EVENT, stage.disconnectEvent.getName()); - } - if (stage.chatEvents != null) { - LinkedList chatEvents = new LinkedList(); - LinkedList chatEventTriggers = new LinkedList(); - for (String s : stage.chatEvents.keySet()) { - chatEventTriggers.add(s); - chatEvents.add(stage.chatEvents.get(s).getName()); - } - cc.setSessionData(pref + CK.S_CHAT_EVENTS, chatEvents); - cc.setSessionData(pref + CK.S_CHAT_EVENT_TRIGGERS, chatEventTriggers); - } - if (stage.commandEvents != null) { - LinkedList commandEvents = new LinkedList(); - LinkedList commandEventTriggers = new LinkedList(); - for (String s : stage.commandEvents.keySet()) { - commandEventTriggers.add(s); - commandEvents.add(stage.commandEvents.get(s).getName()); - } - cc.setSessionData(pref + CK.S_COMMAND_EVENTS, commandEvents); - cc.setSessionData(pref + CK.S_COMMAND_EVENT_TRIGGERS, commandEventTriggers); - } - if (stage.delay != -1) { - cc.setSessionData(pref + CK.S_DELAY, stage.delay); - if (stage.delayMessage != null) { - cc.setSessionData(pref + CK.S_DELAY_MESSAGE, stage.delayMessage); - } - } - if (stage.script != null) { - cc.setSessionData(pref + CK.S_DENIZEN, stage.script); - } - if (stage.objectiveOverride != null) { - cc.setSessionData(pref + CK.S_OVERRIDE_DISPLAY, stage.objectiveOverride); - } - if (stage.completeMessage != null) { - cc.setSessionData(pref + CK.S_COMPLETE_MESSAGE, stage.completeMessage); - } - if (stage.startMessage != null) { - cc.setSessionData(pref + CK.S_START_MESSAGE, stage.startMessage); - } - } - } - private class SelectDeletePrompt extends StringPrompt { @Override diff --git a/main/src/main/java/me/blackvein/quests/QuestMob.java b/main/src/main/java/me/blackvein/quests/QuestMob.java index 7df200dd6..11bc03999 100644 --- a/main/src/main/java/me/blackvein/quests/QuestMob.java +++ b/main/src/main/java/me/blackvein/quests/QuestMob.java @@ -20,7 +20,9 @@ import org.bukkit.entity.LivingEntity; import org.bukkit.inventory.EntityEquipment; import org.bukkit.inventory.ItemStack; +import me.blackvein.quests.util.ConfigUtil; import me.blackvein.quests.util.ItemUtil; +import me.blackvein.quests.util.MiscUtil; public class QuestMob { @@ -153,7 +155,7 @@ public class QuestMob { string += "::name-" + name; } if (spawnLocation != null) { - string += "::spawn-" + Quests.getLocationInfo(spawnLocation); + string += "::spawn-" + ConfigUtil.getLocationInfo(spawnLocation); } if (spawnAmounts != null) { string += "::amounts-" + spawnAmounts; @@ -191,11 +193,11 @@ public class QuestMob { String[] args = str.split("::"); for (String string : args) { if (string.startsWith("type-")) { - entityType = Quests.getMobType(string.substring(5)); + entityType = MiscUtil.getProperMobType(string.substring(5)); } else if (string.startsWith("name-")) { name = string.substring(5); } else if (string.startsWith("spawn-")) { - loc = Quests.getLocation(string.substring(6)); + loc = ConfigUtil.getLocation(string.substring(6)); } else if (string.startsWith("amounts-")) { amounts = Integer.parseInt(string.substring(8)); } else if (string.startsWith("hand-")) { diff --git a/main/src/main/java/me/blackvein/quests/Quester.java b/main/src/main/java/me/blackvein/quests/Quester.java index 4318c5f53..ca0fd7fc6 100644 --- a/main/src/main/java/me/blackvein/quests/Quester.java +++ b/main/src/main/java/me/blackvein/quests/Quester.java @@ -54,11 +54,14 @@ import de.erethon.dungeonsxl.player.DGroup; import me.blackvein.quests.events.quest.QuestTakeEvent; import me.blackvein.quests.events.quester.QuesterPostStartQuestEvent; import me.blackvein.quests.events.quester.QuesterPreStartQuestEvent; -import me.blackvein.quests.timers.StageTimer; +import me.blackvein.quests.tasks.StageTimer; +import me.blackvein.quests.util.ConfigUtil; +import me.blackvein.quests.util.InventoryUtil; import me.blackvein.quests.util.ItemUtil; import me.blackvein.quests.util.Lang; import me.blackvein.quests.util.LocaleQuery; import me.blackvein.quests.util.MiscUtil; +import me.clip.placeholderapi.PlaceholderAPI; import net.citizensnpcs.api.npc.NPC; public class Quester { @@ -419,7 +422,7 @@ public class Quester { String early = Lang.get("plnTooEarly"); early = early.replace("", ChatColor.AQUA + q.getName() + ChatColor.YELLOW); early = early.replace("