mirror of
https://github.com/PikaMug/Quests.git
synced 2024-11-13 22:25:50 +01:00
Supply external conversation hooks, part 15
This commit is contained in:
parent
c05933d414
commit
d8c430146f
@ -432,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;
|
||||
}
|
||||
@ -514,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.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<String> list = new LinkedList<String>();
|
||||
LinkedList<Map<String, Object>> datamapList = new LinkedList<Map<String, Object>>();
|
||||
for (Entry<String, Map<String, Object>> 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<String>(rews.getCustomRewards().keySet()));
|
||||
cc.setSessionData(CK.REW_CUSTOM_DATA, new LinkedList<Object>(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<String> names = new LinkedList<String>();
|
||||
LinkedList<Integer> amnts = new LinkedList<Integer>();
|
||||
LinkedList<Short> durab = new LinkedList<Short>();
|
||||
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<String> names = new LinkedList<String>();
|
||||
LinkedList<Integer> amnts = new LinkedList<Integer>();
|
||||
LinkedList<Short> durab = new LinkedList<Short>();
|
||||
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<String> names = new LinkedList<String>();
|
||||
LinkedList<Integer> amnts = new LinkedList<Integer>();
|
||||
LinkedList<Short> durab = new LinkedList<Short>();
|
||||
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<String> names = new LinkedList<String>();
|
||||
LinkedList<Integer> amnts = new LinkedList<Integer>();
|
||||
LinkedList<Short> durab = new LinkedList<Short>();
|
||||
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<String> names = new LinkedList<String>();
|
||||
LinkedList<Integer> amnts = new LinkedList<Integer>();
|
||||
LinkedList<Short> durab = new LinkedList<Short>();
|
||||
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<ItemStack> items = new LinkedList<ItemStack>();
|
||||
for (ItemStack is : stage.getItemsToCraft()) {
|
||||
items.add(is);
|
||||
}
|
||||
cc.setSessionData(pref + CK.S_CRAFT_ITEMS, items);
|
||||
}
|
||||
if (stage.getItemsToSmelt().isEmpty() == false) {
|
||||
LinkedList<ItemStack> items = new LinkedList<ItemStack>();
|
||||
for (ItemStack is : stage.getItemsToSmelt()) {
|
||||
items.add(is);
|
||||
}
|
||||
cc.setSessionData(pref + CK.S_SMELT_ITEMS, items);
|
||||
}
|
||||
if (stage.itemsToEnchant.isEmpty() == false) {
|
||||
LinkedList<String> enchants = new LinkedList<String>();
|
||||
LinkedList<String> names = new LinkedList<String>();
|
||||
LinkedList<Integer> amounts = new LinkedList<Integer>();
|
||||
for (Entry<Map<Enchantment, Material>, Integer> e : stage.itemsToEnchant.entrySet()) {
|
||||
amounts.add(e.getValue());
|
||||
for (Entry<Enchantment, Material> 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<ItemStack> items = new LinkedList<ItemStack>();
|
||||
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<ItemStack> items = new LinkedList<ItemStack>();
|
||||
LinkedList<Integer> npcs = new LinkedList<Integer>();
|
||||
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<Integer> npcs = new LinkedList<Integer>();
|
||||
for (Integer n : stage.citizensToInteract) {
|
||||
npcs.add(n);
|
||||
}
|
||||
cc.setSessionData(pref + CK.S_NPCS_TO_TALK_TO, npcs);
|
||||
}
|
||||
if (stage.citizensToKill.isEmpty() == false) {
|
||||
LinkedList<Integer> npcs = new LinkedList<Integer>();
|
||||
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<String> mobs = new LinkedList<String>();
|
||||
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<String> locs = new LinkedList<String>();
|
||||
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<String> locs = new LinkedList<String>();
|
||||
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<String> mobs = new LinkedList<String>();
|
||||
LinkedList<Integer> amnts = new LinkedList<Integer>();
|
||||
for (Entry<EntityType, Integer> 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<String> colors = new LinkedList<String>();
|
||||
LinkedList<Integer> amnts = new LinkedList<Integer>();
|
||||
for (Entry<DyeColor, Integer> 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<String> list = new LinkedList<String>();
|
||||
LinkedList<Integer> countList = new LinkedList<Integer>();
|
||||
LinkedList<Entry<String, Object>> datamapList = new LinkedList<Entry<String, Object>>();
|
||||
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<String> chatEvents = new LinkedList<String>();
|
||||
LinkedList<String> chatEventTriggers = new LinkedList<String>();
|
||||
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<String> commandEvents = new LinkedList<String>();
|
||||
LinkedList<String> commandEventTriggers = new LinkedList<String>();
|
||||
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 {
|
||||
|
||||
@ -1639,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<String> list = new LinkedList<String>();
|
||||
LinkedList<Map<String, Object>> datamapList = new LinkedList<Map<String, Object>>();
|
||||
for (Entry<String, Map<String, Object>> 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<String>(rews.getCustomRewards().keySet()));
|
||||
cc.setSessionData(CK.REW_CUSTOM_DATA, new LinkedList<Object>(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<String> names = new LinkedList<String>();
|
||||
LinkedList<Integer> amnts = new LinkedList<Integer>();
|
||||
LinkedList<Short> durab = new LinkedList<Short>();
|
||||
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<String> names = new LinkedList<String>();
|
||||
LinkedList<Integer> amnts = new LinkedList<Integer>();
|
||||
LinkedList<Short> durab = new LinkedList<Short>();
|
||||
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<String> names = new LinkedList<String>();
|
||||
LinkedList<Integer> amnts = new LinkedList<Integer>();
|
||||
LinkedList<Short> durab = new LinkedList<Short>();
|
||||
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<String> names = new LinkedList<String>();
|
||||
LinkedList<Integer> amnts = new LinkedList<Integer>();
|
||||
LinkedList<Short> durab = new LinkedList<Short>();
|
||||
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<String> names = new LinkedList<String>();
|
||||
LinkedList<Integer> amnts = new LinkedList<Integer>();
|
||||
LinkedList<Short> durab = new LinkedList<Short>();
|
||||
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<ItemStack> items = new LinkedList<ItemStack>();
|
||||
for (ItemStack is : stage.getItemsToCraft()) {
|
||||
items.add(is);
|
||||
}
|
||||
cc.setSessionData(pref + CK.S_CRAFT_ITEMS, items);
|
||||
}
|
||||
if (stage.getItemsToSmelt().isEmpty() == false) {
|
||||
LinkedList<ItemStack> items = new LinkedList<ItemStack>();
|
||||
for (ItemStack is : stage.getItemsToSmelt()) {
|
||||
items.add(is);
|
||||
}
|
||||
cc.setSessionData(pref + CK.S_SMELT_ITEMS, items);
|
||||
}
|
||||
if (stage.itemsToEnchant.isEmpty() == false) {
|
||||
LinkedList<String> enchants = new LinkedList<String>();
|
||||
LinkedList<String> names = new LinkedList<String>();
|
||||
LinkedList<Integer> amounts = new LinkedList<Integer>();
|
||||
for (Entry<Map<Enchantment, Material>, Integer> e : stage.itemsToEnchant.entrySet()) {
|
||||
amounts.add(e.getValue());
|
||||
for (Entry<Enchantment, Material> 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<ItemStack> items = new LinkedList<ItemStack>();
|
||||
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<ItemStack> items = new LinkedList<ItemStack>();
|
||||
LinkedList<Integer> npcs = new LinkedList<Integer>();
|
||||
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<Integer> npcs = new LinkedList<Integer>();
|
||||
for (Integer n : stage.citizensToInteract) {
|
||||
npcs.add(n);
|
||||
}
|
||||
cc.setSessionData(pref + CK.S_NPCS_TO_TALK_TO, npcs);
|
||||
}
|
||||
if (stage.citizensToKill.isEmpty() == false) {
|
||||
LinkedList<Integer> npcs = new LinkedList<Integer>();
|
||||
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<String> mobs = new LinkedList<String>();
|
||||
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<String> locs = new LinkedList<String>();
|
||||
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<String> locs = new LinkedList<String>();
|
||||
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<String> mobs = new LinkedList<String>();
|
||||
LinkedList<Integer> amnts = new LinkedList<Integer>();
|
||||
for (Entry<EntityType, Integer> 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<String> colors = new LinkedList<String>();
|
||||
LinkedList<Integer> amnts = new LinkedList<Integer>();
|
||||
for (Entry<DyeColor, Integer> 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<String> list = new LinkedList<String>();
|
||||
LinkedList<Integer> countList = new LinkedList<Integer>();
|
||||
LinkedList<Entry<String, Object>> datamapList = new LinkedList<Entry<String, Object>>();
|
||||
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<String> chatEvents = new LinkedList<String>();
|
||||
LinkedList<String> chatEventTriggers = new LinkedList<String>();
|
||||
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<String> commandEvents = new LinkedList<String>();
|
||||
LinkedList<String> commandEventTriggers = new LinkedList<String>();
|
||||
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
|
||||
|
@ -51,6 +51,8 @@ import me.blackvein.quests.QuestMob;
|
||||
import me.blackvein.quests.Quester;
|
||||
import me.blackvein.quests.Quests;
|
||||
import me.blackvein.quests.Stage;
|
||||
import me.blackvein.quests.events.editor.actions.ActionsEditorPostOpenCreatePromptEvent;
|
||||
import me.blackvein.quests.events.editor.actions.ActionsEditorPostOpenMenuPromptEvent;
|
||||
import me.blackvein.quests.prompts.ItemStackPrompt;
|
||||
import me.blackvein.quests.util.CK;
|
||||
import me.blackvein.quests.util.ConfigUtil;
|
||||
@ -146,104 +148,285 @@ public class ActionFactory implements ConversationAbandonedListener {
|
||||
}
|
||||
}
|
||||
|
||||
private class MenuPrompt extends FixedSetPrompt {
|
||||
|
||||
public MenuPrompt() {
|
||||
super("1", "2", "3", "4");
|
||||
public class MenuPrompt extends NumericPrompt {
|
||||
private final int size = 4;
|
||||
|
||||
public int getSize() {
|
||||
return size;
|
||||
}
|
||||
|
||||
public String getTitle() {
|
||||
return Lang.get("eventEditorTitle");
|
||||
}
|
||||
|
||||
public ChatColor getNumberColor(ConversationContext context, int number) {
|
||||
switch (number) {
|
||||
case 1:
|
||||
case 2:
|
||||
case 3:
|
||||
return ChatColor.BLUE;
|
||||
case 4:
|
||||
return ChatColor.RED;
|
||||
default:
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public String getSelectionText(ConversationContext context, int number) {
|
||||
switch (number) {
|
||||
case 1:
|
||||
return ChatColor.YELLOW + Lang.get("eventEditorCreate");
|
||||
case 2:
|
||||
return ChatColor.YELLOW + Lang.get("eventEditorEdit");
|
||||
case 3:
|
||||
return ChatColor.YELLOW + Lang.get("eventEditorDelete");
|
||||
case 4:
|
||||
return ChatColor.RED + Lang.get("exit");
|
||||
default:
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getPromptText(ConversationContext context) {
|
||||
String text = ChatColor.GOLD + Lang.get("eventEditorTitle") + "\n" + ChatColor.BLUE + "" + ChatColor.BOLD
|
||||
+ "1" + ChatColor.RESET + ChatColor.YELLOW + " - " + Lang.get("eventEditorCreate") + "\n"
|
||||
+ ChatColor.BLUE + "" + ChatColor.BOLD + "2" + ChatColor.RESET + ChatColor.YELLOW + " - "
|
||||
+ Lang.get("eventEditorEdit") + "\n" + ChatColor.BLUE + "" + ChatColor.BOLD + "3" + ChatColor.RESET
|
||||
+ ChatColor.YELLOW + " - " + Lang.get("eventEditorDelete") + "\n" + ChatColor.GREEN + ""
|
||||
+ ChatColor.BOLD + "4" + ChatColor.RESET + ChatColor.YELLOW + " - " + Lang.get("exit");
|
||||
ActionsEditorPostOpenMenuPromptEvent event = new ActionsEditorPostOpenMenuPromptEvent(context);
|
||||
plugin.getServer().getPluginManager().callEvent(event);
|
||||
String text = ChatColor.GOLD + getTitle() + "\n";
|
||||
for (int i = 1; i <= size; i++) {
|
||||
text += getNumberColor(context, i) + "" + ChatColor.BOLD + i + ChatColor.RESET + " - "
|
||||
+ getSelectionText(context, i) + "\n";
|
||||
}
|
||||
return text;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Prompt acceptValidatedInput(ConversationContext context, String input) {
|
||||
protected Prompt acceptValidatedInput(ConversationContext context, Number input) {
|
||||
final Player player = (Player) context.getForWhom();
|
||||
if (input.equalsIgnoreCase("1")) {
|
||||
if (player.hasPermission("quests.editor.actions.create")
|
||||
|| player.hasPermission("quests.editor.events.create")) {
|
||||
context.setSessionData(CK.E_OLD_EVENT, "");
|
||||
return new ActionNamePrompt();
|
||||
} else {
|
||||
player.sendMessage(ChatColor.RED + Lang.get("noPermission"));
|
||||
return new MenuPrompt();
|
||||
}
|
||||
} else if (input.equalsIgnoreCase("2")) {
|
||||
if (player.hasPermission("quests.editor.actions.edit")
|
||||
|| player.hasPermission("quests.editor.events.edit")) {
|
||||
if (plugin.getActions().isEmpty()) {
|
||||
((Player) context.getForWhom()).sendMessage(ChatColor.YELLOW
|
||||
+ Lang.get("eventEditorNoneToEdit"));
|
||||
return new MenuPrompt();
|
||||
switch (input.intValue()) {
|
||||
case 1:
|
||||
if (player.hasPermission("quests.editor.actions.create")
|
||||
|| player.hasPermission("quests.editor.events.create")) {
|
||||
context.setSessionData(CK.E_OLD_EVENT, "");
|
||||
return new ActionNamePrompt();
|
||||
} else {
|
||||
return new SelectEditPrompt();
|
||||
}
|
||||
} else {
|
||||
player.sendMessage(ChatColor.RED + Lang.get("noPermission"));
|
||||
return new MenuPrompt();
|
||||
}
|
||||
} else if (input.equalsIgnoreCase("3")) {
|
||||
if (player.hasPermission("quests.editor.actions.delete")
|
||||
|| player.hasPermission("quests.editor.events.delete")) {
|
||||
if (plugin.getActions().isEmpty()) {
|
||||
((Player) context.getForWhom()).sendMessage(ChatColor.YELLOW
|
||||
+ Lang.get("eventEditorNoneToDelete"));
|
||||
player.sendMessage(ChatColor.RED + Lang.get("noPermission"));
|
||||
return new MenuPrompt();
|
||||
} else {
|
||||
return new SelectDeletePrompt();
|
||||
}
|
||||
} else {
|
||||
player.sendMessage(ChatColor.RED + Lang.get("noPermission"));
|
||||
return new MenuPrompt();
|
||||
}
|
||||
} else if (input.equalsIgnoreCase("4")) {
|
||||
((Player) context.getForWhom()).sendMessage(ChatColor.YELLOW + Lang.get("exited"));
|
||||
return Prompt.END_OF_CONVERSATION;
|
||||
case 2:
|
||||
if (player.hasPermission("quests.editor.actions.edit")
|
||||
|| player.hasPermission("quests.editor.events.edit")) {
|
||||
if (plugin.getActions().isEmpty()) {
|
||||
((Player) context.getForWhom()).sendMessage(ChatColor.YELLOW
|
||||
+ Lang.get("eventEditorNoneToEdit"));
|
||||
return new MenuPrompt();
|
||||
} else {
|
||||
return new SelectEditPrompt();
|
||||
}
|
||||
} else {
|
||||
player.sendMessage(ChatColor.RED + Lang.get("noPermission"));
|
||||
return new MenuPrompt();
|
||||
}
|
||||
case 3:
|
||||
if (player.hasPermission("quests.editor.actions.delete")
|
||||
|| player.hasPermission("quests.editor.events.delete")) {
|
||||
if (plugin.getActions().isEmpty()) {
|
||||
((Player) context.getForWhom()).sendMessage(ChatColor.YELLOW
|
||||
+ Lang.get("eventEditorNoneToDelete"));
|
||||
return new MenuPrompt();
|
||||
} else {
|
||||
return new SelectDeletePrompt();
|
||||
}
|
||||
} else {
|
||||
player.sendMessage(ChatColor.RED + Lang.get("noPermission"));
|
||||
return new MenuPrompt();
|
||||
}
|
||||
case 4:
|
||||
((Player) context.getForWhom()).sendMessage(ChatColor.YELLOW + Lang.get("exited"));
|
||||
return Prompt.END_OF_CONVERSATION;
|
||||
default:
|
||||
return null;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public Prompt returnToMenu() {
|
||||
return new CreateMenuPrompt();
|
||||
}
|
||||
|
||||
public class CreateMenuPrompt extends NumericPrompt {
|
||||
private final int size = 9;
|
||||
|
||||
public int getSize() {
|
||||
return size;
|
||||
}
|
||||
|
||||
public String getTitle(ConversationContext context) {
|
||||
return Lang.get("event") + ": " + context.getSessionData(CK.E_NAME);
|
||||
}
|
||||
|
||||
public ChatColor getNumberColor(ConversationContext context, int number) {
|
||||
switch (number) {
|
||||
case 1:
|
||||
case 2:
|
||||
case 3:
|
||||
case 4:
|
||||
case 5:
|
||||
case 6:
|
||||
case 7:
|
||||
return ChatColor.BLUE;
|
||||
case 8:
|
||||
return ChatColor.GREEN;
|
||||
case 9:
|
||||
return ChatColor.RED;
|
||||
default:
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public String getSelectionText(ConversationContext context, int number) {
|
||||
switch (number) {
|
||||
case 1:
|
||||
return ChatColor.YELLOW + Lang.get("eventEditorSetName");
|
||||
case 2:
|
||||
return ChatColor.GOLD + Lang.get("eventEditorPlayer");
|
||||
case 3:
|
||||
return ChatColor.GOLD + Lang.get("eventEditorTimer");
|
||||
case 4:
|
||||
return ChatColor.GOLD + Lang.get("eventEditorEffect");
|
||||
case 5:
|
||||
return ChatColor.GOLD + Lang.get("eventEditorWeather");
|
||||
case 6:
|
||||
return ChatColor.YELLOW + Lang.get("eventEditorSetMobSpawns");
|
||||
case 7:
|
||||
return ChatColor.YELLOW + Lang.get("eventEditorFailQuest") + ":";
|
||||
case 8:
|
||||
return ChatColor.GREEN + Lang.get("save");
|
||||
case 9:
|
||||
return ChatColor.RED + Lang.get("exit");
|
||||
default:
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
public String getAdditionalText(ConversationContext context, int number) {
|
||||
switch (number) {
|
||||
case 1:
|
||||
case 2:
|
||||
case 3:
|
||||
case 4:
|
||||
case 5:
|
||||
return "";
|
||||
case 6:
|
||||
if (context.getSessionData(CK.E_MOB_TYPES) == null) {
|
||||
return ChatColor.GRAY + "(" + Lang.get("noneSet") + ")";
|
||||
} else {
|
||||
LinkedList<String> types = (LinkedList<String>) context.getSessionData(CK.E_MOB_TYPES);
|
||||
String text = "";
|
||||
for (String s : types) {
|
||||
QuestMob qm = QuestMob.fromString(s);
|
||||
text += ChatColor.GRAY + " - " + ChatColor.AQUA + qm.getType().name()
|
||||
+ ((qm.getName() != null) ? ": " + qm.getName() : "") + ChatColor.GRAY + " x "
|
||||
+ ChatColor.DARK_AQUA + qm.getSpawnAmounts() + ChatColor.GRAY + " -> "
|
||||
+ ChatColor.GREEN + ConfigUtil.getLocationInfo(qm.getSpawnLocation()) + "\n";
|
||||
}
|
||||
return text;
|
||||
}
|
||||
case 7:
|
||||
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);
|
||||
case 8:
|
||||
case 9:
|
||||
return "";
|
||||
default:
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public static void clearData(ConversationContext context) {
|
||||
context.setSessionData(CK.E_OLD_EVENT, null);
|
||||
context.setSessionData(CK.E_NAME, null);
|
||||
context.setSessionData(CK.E_MESSAGE, null);
|
||||
context.setSessionData(CK.E_CLEAR_INVENTORY, null);
|
||||
context.setSessionData(CK.E_FAIL_QUEST, null);
|
||||
context.setSessionData(CK.E_ITEMS, null);
|
||||
context.setSessionData(CK.E_ITEMS_AMOUNTS, null);
|
||||
context.setSessionData(CK.E_EXPLOSIONS, null);
|
||||
context.setSessionData(CK.E_EFFECTS, null);
|
||||
context.setSessionData(CK.E_EFFECTS_LOCATIONS, null);
|
||||
context.setSessionData(CK.E_WORLD_STORM, null);
|
||||
context.setSessionData(CK.E_WORLD_STORM_DURATION, null);
|
||||
context.setSessionData(CK.E_WORLD_THUNDER, null);
|
||||
context.setSessionData(CK.E_WORLD_THUNDER_DURATION, null);
|
||||
context.setSessionData(CK.E_MOB_TYPES, null);
|
||||
context.setSessionData(CK.E_LIGHTNING, null);
|
||||
context.setSessionData(CK.E_POTION_TYPES, null);
|
||||
context.setSessionData(CK.E_POTION_DURATIONS, null);
|
||||
context.setSessionData(CK.E_POTION_STRENGHT, null);
|
||||
context.setSessionData(CK.E_HUNGER, null);
|
||||
context.setSessionData(CK.E_SATURATION, null);
|
||||
context.setSessionData(CK.E_HEALTH, null);
|
||||
context.setSessionData(CK.E_TELEPORT, null);
|
||||
context.setSessionData(CK.E_COMMANDS, null);
|
||||
context.setSessionData(CK.E_TIMER, null);
|
||||
context.setSessionData(CK.E_CANCEL_TIMER, null);
|
||||
@Override
|
||||
public String getPromptText(ConversationContext context) {
|
||||
ActionsEditorPostOpenCreatePromptEvent event = new ActionsEditorPostOpenCreatePromptEvent(context);
|
||||
plugin.getServer().getPluginManager().callEvent(event);
|
||||
|
||||
String text = ChatColor.GOLD + "- " + getTitle(context).replaceFirst(": ", ": " + ChatColor.AQUA)
|
||||
+ 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";
|
||||
}
|
||||
return text;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Prompt acceptValidatedInput(ConversationContext context, Number input) {
|
||||
switch (input.intValue()) {
|
||||
case 1:
|
||||
return new SetNamePrompt();
|
||||
case 2:
|
||||
return new PlayerPrompt();
|
||||
case 3:
|
||||
return new TimerPrompt();
|
||||
case 4:
|
||||
return new EffectPrompt();
|
||||
case 5:
|
||||
return new WeatherPrompt();
|
||||
case 6:
|
||||
return new MobPrompt();
|
||||
case 7:
|
||||
String s = (String) context.getSessionData(CK.E_FAIL_QUEST);
|
||||
if (s.equalsIgnoreCase(Lang.get("yesWord"))) {
|
||||
context.setSessionData(CK.E_FAIL_QUEST, Lang.get("noWord"));
|
||||
} else {
|
||||
context.setSessionData(CK.E_FAIL_QUEST, Lang.get("yesWord"));
|
||||
}
|
||||
return new CreateMenuPrompt();
|
||||
case 8:
|
||||
if (context.getSessionData(CK.E_OLD_EVENT) != null) {
|
||||
return new SavePrompt((String) context.getSessionData(CK.E_OLD_EVENT));
|
||||
} else {
|
||||
return new SavePrompt(null);
|
||||
}
|
||||
case 9:
|
||||
return new ExitPrompt();
|
||||
default:
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private class SelectEditPrompt extends StringPrompt {
|
||||
|
||||
@Override
|
||||
public String getPromptText(ConversationContext context) {
|
||||
String text = ChatColor.GOLD + "- " + Lang.get("eventEditorEdit") + " -\n";
|
||||
for (Action a : plugin.getActions()) {
|
||||
text += ChatColor.AQUA + a.getName() + ChatColor.YELLOW + ", ";
|
||||
}
|
||||
text = text.substring(0, text.length() - 2) + "\n";
|
||||
text += ChatColor.YELLOW + Lang.get("eventEditorEnterEventName");
|
||||
return text;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Prompt acceptInput(ConversationContext context, String input) {
|
||||
if (input.equalsIgnoreCase(Lang.get("cmdCancel")) == false) {
|
||||
Action a = plugin.getAction(input);
|
||||
if (a != null) {
|
||||
context.setSessionData(CK.E_OLD_EVENT, a.getName());
|
||||
context.setSessionData(CK.E_NAME, a.getName());
|
||||
loadData(a, context);
|
||||
return new CreateMenuPrompt();
|
||||
}
|
||||
((Player) context.getForWhom()).sendMessage(ChatColor.RED + Lang.get("eventEditorNotFound"));
|
||||
return new SelectEditPrompt();
|
||||
} else {
|
||||
return new MenuPrompt();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static void loadData(Action event, ConversationContext context) {
|
||||
if (event.message != null) {
|
||||
context.setSessionData(CK.E_MESSAGE, event.message);
|
||||
@ -338,37 +521,6 @@ public class ActionFactory implements ConversationAbandonedListener {
|
||||
}
|
||||
}
|
||||
|
||||
private class SelectEditPrompt extends StringPrompt {
|
||||
|
||||
@Override
|
||||
public String getPromptText(ConversationContext context) {
|
||||
String text = ChatColor.GOLD + "- " + Lang.get("eventEditorEdit") + " -\n";
|
||||
for (Action a : plugin.getActions()) {
|
||||
text += ChatColor.AQUA + a.getName() + ChatColor.YELLOW + ", ";
|
||||
}
|
||||
text = text.substring(0, text.length() - 2) + "\n";
|
||||
text += ChatColor.YELLOW + Lang.get("eventEditorEnterEventName");
|
||||
return text;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Prompt acceptInput(ConversationContext context, String input) {
|
||||
if (input.equalsIgnoreCase(Lang.get("cmdCancel")) == false) {
|
||||
Action a = plugin.getAction(input);
|
||||
if (a != null) {
|
||||
context.setSessionData(CK.E_OLD_EVENT, a.getName());
|
||||
context.setSessionData(CK.E_NAME, a.getName());
|
||||
loadData(a, context);
|
||||
return new CreateMenuPrompt();
|
||||
}
|
||||
((Player) context.getForWhom()).sendMessage(ChatColor.RED + Lang.get("eventEditorNotFound"));
|
||||
return new SelectEditPrompt();
|
||||
} else {
|
||||
return new MenuPrompt();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private class SelectDeletePrompt extends StringPrompt {
|
||||
|
||||
@Override
|
||||
@ -443,90 +595,6 @@ public class ActionFactory implements ConversationAbandonedListener {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private class CreateMenuPrompt extends FixedSetPrompt {
|
||||
|
||||
public CreateMenuPrompt() {
|
||||
super("1", "2", "3", "4", "5", "6", "7", "8", "9");
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
@Override
|
||||
public String getPromptText(ConversationContext context) {
|
||||
String text = ChatColor.GOLD + "- " + Lang.get("event") + ": " + ChatColor.AQUA
|
||||
+ context.getSessionData(CK.E_NAME) + ChatColor.GOLD + " -\n";
|
||||
text += ChatColor.BLUE + "" + ChatColor.BOLD + "1" + ChatColor.RESET + ChatColor.YELLOW + " - "
|
||||
+ Lang.get("eventEditorSetName") + "\n";
|
||||
text += ChatColor.BLUE + "" + ChatColor.BOLD + "2" + ChatColor.RESET + ChatColor.GOLD + " - "
|
||||
+ Lang.get("eventEditorPlayer") + "\n";
|
||||
text += ChatColor.BLUE + "" + ChatColor.BOLD + "3" + ChatColor.RESET + ChatColor.GOLD + " - "
|
||||
+ Lang.get("eventEditorTimer") +"\n";
|
||||
text += ChatColor.BLUE + "" + ChatColor.BOLD + "4" + ChatColor.RESET + ChatColor.GOLD + " - "
|
||||
+ Lang.get("eventEditorEffect") +"\n";
|
||||
text += ChatColor.BLUE + "" + ChatColor.BOLD + "5" + ChatColor.RESET + ChatColor.GOLD + " - "
|
||||
+ Lang.get("eventEditorWeather") +"\n";
|
||||
if (context.getSessionData(CK.E_MOB_TYPES) == null) {
|
||||
text += ChatColor.BLUE + "" + ChatColor.BOLD + "6" + ChatColor.RESET + ChatColor.YELLOW + " - "
|
||||
+ Lang.get("eventEditorSetMobSpawns") + ChatColor.GRAY + " (" + Lang.get("noneSet") + ")\n";
|
||||
} else {
|
||||
LinkedList<String> types = (LinkedList<String>) context.getSessionData(CK.E_MOB_TYPES);
|
||||
text += ChatColor.BLUE + "" + ChatColor.BOLD + "6" + ChatColor.RESET + ChatColor.YELLOW + " - "
|
||||
+ Lang.get("eventEditorSetMobSpawns") + "\n";
|
||||
for (String s : types) {
|
||||
QuestMob qm = QuestMob.fromString(s);
|
||||
text += ChatColor.GRAY + " - " + ChatColor.AQUA + qm.getType().name()
|
||||
+ ((qm.getName() != null) ? ": " + qm.getName() : "") + ChatColor.GRAY + " x "
|
||||
+ ChatColor.DARK_AQUA + qm.getSpawnAmounts() + ChatColor.GRAY + " -> " + ChatColor.GREEN
|
||||
+ ConfigUtil.getLocationInfo(qm.getSpawnLocation()) + "\n";
|
||||
}
|
||||
}
|
||||
if (context.getSessionData(CK.E_FAIL_QUEST) == null) {
|
||||
context.setSessionData(CK.E_FAIL_QUEST, Lang.get("noWord"));
|
||||
}
|
||||
text += ChatColor.BLUE + "" + ChatColor.BOLD + "7" + ChatColor.RESET + ChatColor.YELLOW + " - "
|
||||
+ Lang.get("eventEditorFailQuest") + ": " + ChatColor.AQUA + context.getSessionData(CK.E_FAIL_QUEST)
|
||||
+ "\n";
|
||||
text += ChatColor.BLUE + "" + ChatColor.BOLD + "8" + ChatColor.RESET + ChatColor.GREEN + " - "
|
||||
+ Lang.get("save") + "\n";
|
||||
text += ChatColor.BLUE + "" + ChatColor.BOLD + "9" + ChatColor.RESET + ChatColor.RED + " - "
|
||||
+ Lang.get("exit");
|
||||
return text;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Prompt acceptValidatedInput(ConversationContext context, String input) {
|
||||
if (input.equalsIgnoreCase("1")) {
|
||||
return new SetNamePrompt();
|
||||
} else if (input.equalsIgnoreCase("2")) {
|
||||
return new PlayerPrompt();
|
||||
} else if (input.equalsIgnoreCase("3")) {
|
||||
return new TimerPrompt();
|
||||
} else if (input.equalsIgnoreCase("4")) {
|
||||
return new EffectPrompt();
|
||||
} else if (input.equalsIgnoreCase("5")) {
|
||||
return new WeatherPrompt();
|
||||
} else if (input.equalsIgnoreCase("6")) {
|
||||
return new MobPrompt();
|
||||
} else if (input.equalsIgnoreCase("7")) {
|
||||
String s = (String) context.getSessionData(CK.E_FAIL_QUEST);
|
||||
if (s.equalsIgnoreCase(Lang.get("yesWord"))) {
|
||||
context.setSessionData(CK.E_FAIL_QUEST, Lang.get("noWord"));
|
||||
} else {
|
||||
context.setSessionData(CK.E_FAIL_QUEST, Lang.get("yesWord"));
|
||||
}
|
||||
return new CreateMenuPrompt();
|
||||
} else if (input.equalsIgnoreCase("8")) {
|
||||
if (context.getSessionData(CK.E_OLD_EVENT) != null) {
|
||||
return new SavePrompt((String) context.getSessionData(CK.E_OLD_EVENT));
|
||||
} else {
|
||||
return new SavePrompt(null);
|
||||
}
|
||||
} else if (input.equalsIgnoreCase("9")) {
|
||||
return new ExitPrompt();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
private class PlayerPrompt extends FixedSetPrompt {
|
||||
|
||||
@ -904,6 +972,35 @@ public class ActionFactory implements ConversationAbandonedListener {
|
||||
}
|
||||
}
|
||||
|
||||
public static void clearData(ConversationContext context) {
|
||||
context.setSessionData(CK.E_OLD_EVENT, null);
|
||||
context.setSessionData(CK.E_NAME, null);
|
||||
context.setSessionData(CK.E_MESSAGE, null);
|
||||
context.setSessionData(CK.E_CLEAR_INVENTORY, null);
|
||||
context.setSessionData(CK.E_FAIL_QUEST, null);
|
||||
context.setSessionData(CK.E_ITEMS, null);
|
||||
context.setSessionData(CK.E_ITEMS_AMOUNTS, null);
|
||||
context.setSessionData(CK.E_EXPLOSIONS, null);
|
||||
context.setSessionData(CK.E_EFFECTS, null);
|
||||
context.setSessionData(CK.E_EFFECTS_LOCATIONS, null);
|
||||
context.setSessionData(CK.E_WORLD_STORM, null);
|
||||
context.setSessionData(CK.E_WORLD_STORM_DURATION, null);
|
||||
context.setSessionData(CK.E_WORLD_THUNDER, null);
|
||||
context.setSessionData(CK.E_WORLD_THUNDER_DURATION, null);
|
||||
context.setSessionData(CK.E_MOB_TYPES, null);
|
||||
context.setSessionData(CK.E_LIGHTNING, null);
|
||||
context.setSessionData(CK.E_POTION_TYPES, null);
|
||||
context.setSessionData(CK.E_POTION_DURATIONS, null);
|
||||
context.setSessionData(CK.E_POTION_STRENGHT, null);
|
||||
context.setSessionData(CK.E_HUNGER, null);
|
||||
context.setSessionData(CK.E_SATURATION, null);
|
||||
context.setSessionData(CK.E_HEALTH, null);
|
||||
context.setSessionData(CK.E_TELEPORT, null);
|
||||
context.setSessionData(CK.E_COMMANDS, null);
|
||||
context.setSessionData(CK.E_TIMER, null);
|
||||
context.setSessionData(CK.E_CANCEL_TIMER, null);
|
||||
}
|
||||
|
||||
// Convenience methods to reduce typecasting
|
||||
private static String getCString(ConversationContext context, String path) {
|
||||
return (String) context.getSessionData(path);
|
||||
|
@ -0,0 +1,30 @@
|
||||
package me.blackvein.quests.events.editor.actions;
|
||||
|
||||
import org.bukkit.conversations.ConversationContext;
|
||||
|
||||
import me.blackvein.quests.events.QuestsEvent;
|
||||
|
||||
/**
|
||||
* Represents an Actions Editor-related event
|
||||
*/
|
||||
public abstract class ActionsEditorEvent extends QuestsEvent {
|
||||
protected ConversationContext context;
|
||||
|
||||
public ActionsEditorEvent(final ConversationContext context) {
|
||||
this.context = context;
|
||||
}
|
||||
|
||||
public ActionsEditorEvent(final ConversationContext context, boolean async) {
|
||||
super(async);
|
||||
this.context = context;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the context involved in this event
|
||||
*
|
||||
* @return ConversationContext which is involved in this event
|
||||
*/
|
||||
public final ConversationContext getConversationContext() {
|
||||
return context;
|
||||
}
|
||||
}
|
@ -0,0 +1,22 @@
|
||||
package me.blackvein.quests.events.editor.actions;
|
||||
|
||||
import org.bukkit.conversations.ConversationContext;
|
||||
import org.bukkit.event.HandlerList;
|
||||
|
||||
public class ActionsEditorPostOpenCreatePromptEvent extends ActionsEditorEvent {
|
||||
private static final HandlerList handlers = new HandlerList();
|
||||
|
||||
public ActionsEditorPostOpenCreatePromptEvent(ConversationContext context) {
|
||||
super(context);
|
||||
this.context = context;
|
||||
}
|
||||
|
||||
@Override
|
||||
public HandlerList getHandlers() {
|
||||
return handlers;
|
||||
}
|
||||
|
||||
public static HandlerList getHandlerList() {
|
||||
return handlers;
|
||||
}
|
||||
}
|
@ -0,0 +1,22 @@
|
||||
package me.blackvein.quests.events.editor.actions;
|
||||
|
||||
import org.bukkit.conversations.ConversationContext;
|
||||
import org.bukkit.event.HandlerList;
|
||||
|
||||
public class ActionsEditorPostOpenMenuPromptEvent extends ActionsEditorEvent {
|
||||
private static final HandlerList handlers = new HandlerList();
|
||||
|
||||
public ActionsEditorPostOpenMenuPromptEvent(ConversationContext context) {
|
||||
super(context);
|
||||
this.context = context;
|
||||
}
|
||||
|
||||
@Override
|
||||
public HandlerList getHandlers() {
|
||||
return handlers;
|
||||
}
|
||||
|
||||
public static HandlerList getHandlerList() {
|
||||
return handlers;
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user