Supply external conversation hooks, part 9. Per #570

This commit is contained in:
PikaMug 2019-09-02 05:08:52 -04:00
parent 1f637ad6ef
commit b584a4b0f8
5 changed files with 673 additions and 364 deletions

View File

@ -838,7 +838,7 @@ public class QuestFactory implements ConversationAbandonedListener {
} else if (context.getSessionData(CK.Q_FINISH_MESSAGE) == null) {
context.getForWhom().sendRawMessage(ChatColor.RED + Lang.get("questEditorNeedFinishMessage"));
return new CreateMenuPrompt();
} else if (StagesPrompt.getStages(context) == 0) {
} else if (new StagesPrompt(plugin, QuestFactory.this).getStages(context) == 0) {
context.getForWhom().sendRawMessage(ChatColor.RED + Lang.get("questEditorNeedStages"));
return new CreateMenuPrompt();
}
@ -1225,7 +1225,7 @@ public class QuestFactory implements ConversationAbandonedListener {
String delayMessage;
String startMessage;
String completeMessage;
for (int i = 1; i <= StagesPrompt.getStages(cc); i++) {
for (int i = 1; i <= new StagesPrompt(plugin, this).getStages(cc); i++) {
pref = "stage" + i;
ConfigurationSection stage = ordered.createSection("" + i);
breakNames = null;

View File

@ -0,0 +1,36 @@
package me.blackvein.quests.events.editor.quests;
import org.bukkit.conversations.ConversationContext;
import org.bukkit.event.HandlerList;
import me.blackvein.quests.QuestFactory;
public class QuestsEditorPostOpenCreateStagePromptEvent extends QuestsEditorEvent {
private static final HandlerList handlers = new HandlerList();
private final QuestFactory factory;
private final int stageNum;
public QuestsEditorPostOpenCreateStagePromptEvent(QuestFactory factory, int stageNum, ConversationContext context) {
super(context);
this.context = context;
this.factory = factory;
this.stageNum = stageNum;
}
public QuestFactory getQuestFactory() {
return factory;
}
public int getStageNumber() {
return stageNum;
}
@Override
public HandlerList getHandlers() {
return handlers;
}
public static HandlerList getHandlerList() {
return handlers;
}
}

View File

@ -0,0 +1,30 @@
package me.blackvein.quests.events.editor.quests;
import org.bukkit.conversations.ConversationContext;
import org.bukkit.event.HandlerList;
import me.blackvein.quests.QuestFactory;
public class QuestsEditorPostOpenStagesPromptEvent extends QuestsEditorEvent {
private static final HandlerList handlers = new HandlerList();
private final QuestFactory factory;
public QuestsEditorPostOpenStagesPromptEvent(QuestFactory factory, ConversationContext context) {
super(context);
this.context = context;
this.factory = factory;
}
public QuestFactory getQuestFactory() {
return factory;
}
@Override
public HandlerList getHandlers() {
return handlers;
}
public static HandlerList getHandlerList() {
return handlers;
}
}

View File

@ -25,6 +25,7 @@ import org.bukkit.Location;
import org.bukkit.block.Block;
import org.bukkit.conversations.ConversationContext;
import org.bukkit.conversations.FixedSetPrompt;
import org.bukkit.conversations.NumericPrompt;
import org.bukkit.conversations.Prompt;
import org.bukkit.conversations.StringPrompt;
import org.bukkit.entity.Player;
@ -33,83 +34,244 @@ import me.blackvein.quests.CustomObjective;
import me.blackvein.quests.QuestFactory;
import me.blackvein.quests.Quests;
import me.blackvein.quests.actions.Action;
import me.blackvein.quests.events.editor.quests.QuestsEditorPostOpenCreateStagePromptEvent;
import me.blackvein.quests.util.CK;
import me.blackvein.quests.util.Lang;
public class CreateStagePrompt extends FixedSetPrompt {
public class CreateStagePrompt extends NumericPrompt {
private final Quests plugin;
private final int stageNum;
private final String pref;
private final QuestFactory questFactory;
private boolean hasObjective = false;
private final int size = 17;
public CreateStagePrompt(Quests plugin, int stageNum, QuestFactory qf) {
super("1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12", "13", "14", "15", "16", "17");
this.plugin = plugin;
this.stageNum = stageNum;
this.pref = "stage" + stageNum;
this.questFactory = qf;
}
@SuppressWarnings({ "unchecked" })
@Override
public String getPromptText(ConversationContext context) {
try {
context.setSessionData(pref, Boolean.TRUE);
String text = ChatColor.LIGHT_PURPLE + "- " + ChatColor.AQUA + (String) context.getSessionData(CK.Q_NAME) + ChatColor.LIGHT_PURPLE + " | " + Lang.get("stageEditorStage") + " " + stageNum + " -\n";
public int getSize() {
return size;
}
public String getTitle(ConversationContext context) {
return ChatColor.AQUA + (String) context.getSessionData(CK.Q_NAME) + ChatColor.LIGHT_PURPLE + " | " + Lang.get("stageEditorStage") + " " + stageNum;
}
public ChatColor getNumberColor(ConversationContext context, int number) {
switch (number) {
case 1:
case 2:
case 3:
case 4:
case 5:
case 6:
case 7:
case 8:
return ChatColor.BLUE;
case 9:
if (!hasObjective) {
return ChatColor.GRAY;
} else {
return ChatColor.BLUE;
}
case 10:
if (!hasObjective) {
return ChatColor.GRAY;
} else {
return ChatColor.BLUE;
}
case 11:
if (context.getSessionData(pref + CK.S_DELAY) == null) {
return ChatColor.GRAY;
} else {
return ChatColor.BLUE;
}
case 12:
if (plugin.getDependencies().getDenizenAPI() == null) {
return ChatColor.GRAY;
} else {
if (!hasObjective) {
return ChatColor.GRAY;
} else {
return ChatColor.BLUE;
}
}
case 13:
if (context.getSessionData(pref + CK.S_START_MESSAGE) == null) {
if (!hasObjective) {
return ChatColor.GRAY;
} else {
return ChatColor.BLUE;
}
} else {
return ChatColor.BLUE;
}
case 14:
if (context.getSessionData(pref + CK.S_COMPLETE_MESSAGE) == null) {
if (!hasObjective) {
return ChatColor.GRAY;
} else {
return ChatColor.BLUE;
}
} else {
return ChatColor.BLUE;
}
case 15:
if (context.getSessionData(pref + CK.S_OVERRIDE_DISPLAY) == null) {
if (!hasObjective) {
return ChatColor.GRAY;
} else {
return ChatColor.BLUE;
}
} else {
return ChatColor.BLUE;
}
case 16:
return ChatColor.RED;
case 17:
return ChatColor.GREEN;
default:
return null;
}
}
public String getSelectionText(ConversationContext context, int number) {
switch (number) {
case 1:
return ChatColor.GOLD + Lang.get("stageEditorBlocks");
case 2:
return ChatColor.GOLD + Lang.get("stageEditorItems");
case 3:
return ChatColor.GOLD + Lang.get("stageEditorNPCs");
case 4:
return ChatColor.GOLD + Lang.get("stageEditorMobs");
case 5:
return ChatColor.YELLOW + Lang.get("stageEditorKillPlayers");
case 6:
return ChatColor.YELLOW + Lang.get("stageEditorReachLocs");
case 7:
return ChatColor.YELLOW + Lang.get("stageEditorPassword");
case 8:
return ChatColor.DARK_PURPLE + Lang.get("stageEditorCustom");
case 9:
if (!hasObjective) {
return ChatColor.GRAY + Lang.get("stageEditorEvents");
} else {
return ChatColor.AQUA + Lang.get("stageEditorEvents");
}
case 10:
if (!hasObjective) {
return ChatColor.GRAY + Lang.get("delay");
} else {
return ChatColor.YELLOW + Lang.get("delay");
}
case 11:
if (context.getSessionData(pref + CK.S_DELAY) == null) {
return ChatColor.GRAY + Lang.get("stageEditorDelayMessage");
} else {
return ChatColor.YELLOW + Lang.get("stageEditorDelayMessage");
}
case 12:
if (plugin.getDependencies().getDenizenAPI() == null) {
return ChatColor.GRAY + Lang.get("stageEditorDenizenScript");
} else {
if (!hasObjective) {
return ChatColor.GRAY + Lang.get("stageEditorDenizenScript");
} else {
return ChatColor.YELLOW + Lang.get("stageEditorDenizenScript");
}
}
case 13:
if (context.getSessionData(pref + CK.S_START_MESSAGE) == null) {
if (!hasObjective) {
return ChatColor.GRAY + Lang.get("stageEditorStartMessage");
} else {
return ChatColor.YELLOW + Lang.get("stageEditorStartMessage");
}
} else {
return ChatColor.YELLOW + Lang.get("stageEditorStartMessage");
}
case 14:
if (context.getSessionData(pref + CK.S_COMPLETE_MESSAGE) == null) {
if (!hasObjective) {
return ChatColor.GRAY + Lang.get("stageEditorCompleteMessage");
} else {
return ChatColor.YELLOW + Lang.get("stageEditorCompleteMessage");
}
} else {
return ChatColor.YELLOW + Lang.get("stageEditorCompleteMessage");
}
case 15:
if (context.getSessionData(pref + CK.S_OVERRIDE_DISPLAY) == null) {
if (!hasObjective) {
return ChatColor.GRAY + Lang.get("stageEditorObjectiveOverride");
} else {
return ChatColor.YELLOW + Lang.get("stageEditorObjectiveOverride");
}
} else {
return ChatColor.YELLOW + Lang.get("stageEditorObjectiveOverride");
}
case 16:
return ChatColor.RED + Lang.get("stageEditorDelete");
case 17:
return ChatColor.GREEN + Lang.get("done");
default:
return null;
}
}
@SuppressWarnings("unchecked")
public String getAdditionalText(ConversationContext context, int number) {
switch (number) {
case 1:
if (context.getSessionData(pref + CK.S_BREAK_NAMES) == null && context.getSessionData(pref + CK.S_DAMAGE_NAMES) == null
&& context.getSessionData(pref + CK.S_PLACE_NAMES) == null && context.getSessionData(pref + CK.S_USE_NAMES) == null
&& context.getSessionData(pref + CK.S_CUT_NAMES) == null) {
text += ChatColor.BLUE + "" + ChatColor.BOLD + "1" + ChatColor.RESET + ChatColor.GOLD + " - " + Lang.get("stageEditorBlocks") + ChatColor.GRAY + " (" + Lang.get("noneSet") + ")\n";
} else {
hasObjective = true;
text += ChatColor.BLUE + "" + ChatColor.BOLD + "1" + ChatColor.RESET + ChatColor.GOLD + " - " + Lang.get("stageEditorBlocks") + "\n";
return ChatColor.GRAY + "(" + Lang.get("noneSet") + ")";
}
case 2:
if (context.getSessionData(pref + CK.S_CRAFT_ITEMS) == null && context.getSessionData(pref + CK.S_SMELT_ITEMS) == null && context.getSessionData(pref + CK.S_ENCHANT_TYPES) == null && context.getSessionData(pref + CK.S_BREW_ITEMS) == null) {
text += ChatColor.BLUE + "" + ChatColor.BOLD + "2" + ChatColor.RESET + ChatColor.GOLD + " - " + Lang.get("stageEditorItems") + ChatColor.GRAY + " (" + Lang.get("noneSet") + ")\n";
} else {
hasObjective = true;
text += ChatColor.BLUE + "" + ChatColor.BOLD + "2" + ChatColor.RESET + ChatColor.GOLD + " - " + Lang.get("stageEditorItems") + "\n";
return ChatColor.GRAY + "(" + Lang.get("noneSet") + ")";
}
case 3:
if (context.getSessionData(pref + CK.S_DELIVERY_NPCS) == null && context.getSessionData(pref + CK.S_NPCS_TO_TALK_TO) == null && context.getSessionData(pref + CK.S_NPCS_TO_KILL) == null) {
text += ChatColor.BLUE + "" + ChatColor.BOLD + "3" + ChatColor.RESET + ChatColor.GOLD + " - " + Lang.get("stageEditorNPCs") + ChatColor.GRAY + " (" + Lang.get("noneSet") + ")\n";
} else {
hasObjective = true;
text += ChatColor.BLUE + "" + ChatColor.BOLD + "3" + ChatColor.RESET + ChatColor.GOLD + " - " + Lang.get("stageEditorNPCs") + "\n";
return ChatColor.GRAY + "(" + Lang.get("noneSet") + ")";
}
case 4:
if (context.getSessionData(pref + CK.S_MOB_TYPES) == null && context.getSessionData(pref + CK.S_FISH) == null && context.getSessionData(pref + CK.S_TAME_TYPES) == null && context.getSessionData(pref + CK.S_SHEAR_COLORS) == null) {
text += ChatColor.BLUE + "" + ChatColor.BOLD + "4" + ChatColor.RESET + ChatColor.GOLD + " - " + Lang.get("stageEditorMobs") + ChatColor.GRAY + " (" + Lang.get("noneSet") + ")\n";
} else {
hasObjective = true;
text += ChatColor.BLUE + "" + ChatColor.BOLD + "4" + ChatColor.RESET + ChatColor.GOLD + " - " + Lang.get("stageEditorMobs") + "\n";
return ChatColor.GRAY + "(" + Lang.get("noneSet") + ")";
}
case 5:
if (context.getSessionData(pref + CK.S_PLAYER_KILL) == null) {
text += ChatColor.BLUE + "" + ChatColor.BOLD + "5" + ChatColor.RESET + ChatColor.YELLOW + " - " + Lang.get("stageEditorKillPlayers") + ChatColor.GRAY + " (" + Lang.get("noneSet") + ")\n";
return ChatColor.GRAY + "(" + Lang.get("noneSet") + ")";
} else {
hasObjective = true;
Integer players = (Integer) context.getSessionData(pref + CK.S_PLAYER_KILL);
text += ChatColor.BLUE + "" + ChatColor.BOLD + "5" + ChatColor.RESET + ChatColor.YELLOW + " - " + Lang.get("stageEditorKillPlayers") + ChatColor.GRAY + " (" + ChatColor.AQUA + players + " " + Lang.get("stageEditorPlayers") + ChatColor.GRAY + ")\n";
return ChatColor.GRAY + "(" + ChatColor.AQUA + players + " " + Lang.get("stageEditorPlayers") + ChatColor.GRAY + ")";
}
case 6:
if (context.getSessionData(pref + CK.S_REACH_LOCATIONS) == null) {
text += ChatColor.BLUE + "" + ChatColor.BOLD + "6" + ChatColor.RESET + ChatColor.YELLOW + " - " + Lang.get("stageEditorReachLocs") + ChatColor.GRAY + " (" + Lang.get("noneSet") + ")\n";
return ChatColor.GRAY + "(" + Lang.get("noneSet") + ")";
} else {
hasObjective = true;
text += ChatColor.BLUE + "" + ChatColor.BOLD + "6" + ChatColor.RESET + ChatColor.YELLOW + " - " + Lang.get("stageEditorReachLocs") + "\n";
String text = "";
LinkedList<String> locations = (LinkedList<String>) context.getSessionData(pref + CK.S_REACH_LOCATIONS);
LinkedList<Integer> radii = (LinkedList<Integer>) context.getSessionData(pref + CK.S_REACH_LOCATIONS_RADIUS);
LinkedList<String> names = (LinkedList<String>) context.getSessionData(pref + CK.S_REACH_LOCATIONS_NAMES);
for (int i = 0; i < locations.size(); i++) {
text += ChatColor.GRAY + " - " + Lang.get("stageEditorReachRadii1") + " " + ChatColor.BLUE + radii.get(i) + ChatColor.GRAY + " " + Lang.get("stageEditorReachRadii2") + " " + ChatColor.AQUA + names.get(i) + ChatColor.GRAY + " (" + ChatColor.DARK_AQUA + locations.get(i) + ChatColor.GRAY + ")\n";
}
return text;
}
case 7:
if (context.getSessionData(pref + CK.S_PASSWORD_PHRASES) == null) {
text += ChatColor.BLUE + "" + ChatColor.BOLD + "7" + ChatColor.RESET + ChatColor.YELLOW + " - " + Lang.get("stageEditorPassword") + ChatColor.GRAY + " (" + Lang.get("noneSet") + ")\n";
return ChatColor.GRAY + "(" + Lang.get("noneSet") + ")";
} else {
hasObjective = true;
String text = "";
LinkedList<LinkedList<String>> passPhrases = (LinkedList<LinkedList<String>>) context.getSessionData(pref + CK.S_PASSWORD_PHRASES);
LinkedList<String> passDisplays = (LinkedList<String>) context.getSessionData(pref + CK.S_PASSWORD_DISPLAYS);
text += ChatColor.BLUE + "" + ChatColor.BOLD + "7" + ChatColor.RESET + ChatColor.YELLOW + " - " + Lang.get("stageEditorPassword") + "\n";
for (int i = 0; i < passPhrases.size(); i++) {
text += ChatColor.AQUA + " - \"" + passDisplays.get(i) + "\"\n";
LinkedList<String> phrases = passPhrases.get(i);
@ -117,129 +279,151 @@ public class CreateStagePrompt extends FixedSetPrompt {
text += ChatColor.DARK_AQUA + " - " + phrase + "\n";
}
}
return text;
}
case 8:
if (context.getSessionData(pref + CK.S_CUSTOM_OBJECTIVES) == null) {
text += ChatColor.BLUE + "" + ChatColor.BOLD + "8" + ChatColor.RESET + ChatColor.DARK_PURPLE + " - " + Lang.get("stageEditorCustom") + ChatColor.GRAY + " (" + Lang.get("noneSet") + ")\n";
return ChatColor.GRAY + "(" + Lang.get("noneSet") + ")";
} else {
hasObjective = true;
String text = "";
LinkedList<String> customObjs = (LinkedList<String>) context.getSessionData(pref + CK.S_CUSTOM_OBJECTIVES);
text += ChatColor.BLUE + "" + ChatColor.BOLD + "8" + ChatColor.RESET + ChatColor.DARK_PURPLE + " - " + Lang.get("stageEditorCustom") + "\n";
for (String s : customObjs) {
text += ChatColor.LIGHT_PURPLE + " - " + ChatColor.GOLD + s + "\n";
}
return text;
}
case 9:
if (!hasObjective) {
text += ChatColor.GRAY + "" + ChatColor.BOLD + "9" + ChatColor.RESET + ChatColor.GRAY + " - " + Lang.get("stageEditorEvents") + ChatColor.GRAY + " (" + Lang.get("stageEditorOptional") + ")\n";
} else {
text += ChatColor.BLUE + "" + ChatColor.BOLD + "9" + ChatColor.RESET + ChatColor.AQUA + " - " + Lang.get("stageEditorEvents") + "\n";
return ChatColor.GRAY + "(" + Lang.get("stageEditorOptional") + ")";
}
case 10:
if (!hasObjective) {
text += ChatColor.GRAY + "" + ChatColor.BOLD + "10" + ChatColor.RESET + ChatColor.GRAY + " - " + Lang.get("delay") + ChatColor.GRAY + " (" + Lang.get("stageEditorOptional") + ")\n";
return ChatColor.GRAY + "(" + Lang.get("stageEditorOptional") + ")";
} else {
if (context.getSessionData(pref + CK.S_DELAY) == null) {
text += ChatColor.BLUE + "" + ChatColor.BOLD + "10" + ChatColor.RESET + ChatColor.YELLOW + " - " + Lang.get("delay") + ChatColor.GRAY + " (" + Lang.get("noneSet") + ")\n";
return ChatColor.GRAY + "(" + Lang.get("noneSet") + ")";
} else {
long time = (Long) context.getSessionData(pref + CK.S_DELAY);
text += ChatColor.BLUE + "" + ChatColor.BOLD + "10" + ChatColor.RESET + ChatColor.YELLOW + " - " + Lang.get("delay") + ChatColor.GRAY + " (" + ChatColor.AQUA + Quests.getTime(time) + ChatColor.GRAY + ")\n";
return ChatColor.GRAY + "(" + ChatColor.AQUA + Quests.getTime(time) + ChatColor.GRAY + ")";
}
}
case 11:
if (context.getSessionData(pref + CK.S_DELAY) == null) {
text += ChatColor.GRAY + "" + ChatColor.BOLD + "11" + ChatColor.RESET + ChatColor.GRAY + " - " + Lang.get("stageEditorDelayMessage") + ChatColor.GRAY + " (" + Lang.get("noDelaySet") + ")\n";
return ChatColor.GRAY + "(" + Lang.get("noDelaySet") + ")";
} else if (context.getSessionData(pref + CK.S_DELAY_MESSAGE) == null) {
text += ChatColor.BLUE + "" + ChatColor.BOLD + "11" + ChatColor.RESET + ChatColor.YELLOW + " - " + Lang.get("stageEditorDelayMessage") + ChatColor.GRAY + " (" + Lang.get("noneSet") + ")\n";
return ChatColor.GRAY + "(" + Lang.get("noneSet") + ")";
} else {
text += ChatColor.BLUE + "" + ChatColor.BOLD + "11" + ChatColor.RESET + ChatColor.YELLOW + " - " + Lang.get("stageEditorDelayMessage") + ChatColor.GRAY + " (" + ChatColor.AQUA + "\"" + context.getSessionData(pref + CK.S_DELAY_MESSAGE) + "\"" + ChatColor.GRAY + ")\n";
return ChatColor.GRAY + "(" + ChatColor.AQUA + "\"" + context.getSessionData(pref + CK.S_DELAY_MESSAGE) + "\"" + ChatColor.GRAY + ")";
}
case 12:
if (plugin.getDependencies().getDenizenAPI() == null) {
text += ChatColor.GRAY + "" + ChatColor.BOLD + "12" + ChatColor.RESET + ChatColor.GRAY + " - " + Lang.get("stageEditorDenizenScript") + ChatColor.GRAY + " (" + Lang.get("notInstalled") + ")\n";
return ChatColor.GRAY + "(" + Lang.get("notInstalled") + ")";
} else {
if (!hasObjective) {
text += ChatColor.GRAY + "" + ChatColor.BOLD + "12" + ChatColor.RESET + ChatColor.GRAY + " - " + Lang.get("stageEditorDenizenScript") + ChatColor.GRAY + " (" + Lang.get("stageEditorOptional") + ")\n";
return ChatColor.GRAY + "(" + Lang.get("stageEditorOptional") + ")";
} else {
if (context.getSessionData(pref + CK.S_DENIZEN) == null) {
text += ChatColor.BLUE + "" + ChatColor.BOLD + "12" + ChatColor.RESET + ChatColor.YELLOW + " - " + Lang.get("stageEditorDenizenScript") + ChatColor.GRAY + " (" + Lang.get("noneSet") + ")\n";
return ChatColor.GRAY + "(" + Lang.get("noneSet") + ")";
} else {
hasObjective = true;
text += ChatColor.BLUE + "" + ChatColor.BOLD + "12" + ChatColor.RESET + ChatColor.YELLOW + " - " + Lang.get("stageEditorDenizenScript") + ChatColor.GRAY + " (" + ChatColor.AQUA + context.getSessionData(pref + CK.S_DENIZEN) + ChatColor.GRAY + ")\n";
return ChatColor.GRAY + "(" + ChatColor.AQUA + context.getSessionData(pref + CK.S_DENIZEN) + ChatColor.GRAY + ")";
}
}
}
case 13:
if (context.getSessionData(pref + CK.S_START_MESSAGE) == null) {
if (!hasObjective) {
text += ChatColor.GRAY + "" + ChatColor.BOLD + "13" + ChatColor.RESET + ChatColor.GRAY + " - " + Lang.get("stageEditorStartMessage") + ChatColor.GRAY + " (" + Lang.get("stageEditorOptional") + ")\n";
return ChatColor.GRAY + "(" + Lang.get("stageEditorOptional") + ")";
} else {
text += ChatColor.BLUE + "" + ChatColor.BOLD + "13" + ChatColor.RESET + ChatColor.YELLOW + " - " + Lang.get("stageEditorStartMessage") + ChatColor.GRAY + " (" + Lang.get("noneSet") + ")\n";
return ChatColor.GRAY + "(" + Lang.get("noneSet") + ")";
}
} else {
text += ChatColor.BLUE + "" + ChatColor.BOLD + "13" + ChatColor.RESET + ChatColor.YELLOW + " - " + Lang.get("stageEditorStartMessage") + ChatColor.GRAY + " (" + ChatColor.AQUA + "\"" + context.getSessionData(pref + CK.S_START_MESSAGE) + "\"" + ChatColor.GRAY + ")\n";
return ChatColor.GRAY + "(" + ChatColor.AQUA + "\"" + context.getSessionData(pref + CK.S_START_MESSAGE) + "\"" + ChatColor.GRAY + ")";
}
case 14:
if (context.getSessionData(pref + CK.S_COMPLETE_MESSAGE) == null) {
if (!hasObjective) {
text += ChatColor.GRAY + "" + ChatColor.BOLD + "14" + ChatColor.RESET + ChatColor.GRAY + " - " + Lang.get("stageEditorCompleteMessage") + ChatColor.GRAY + " (" + Lang.get("stageEditorOptional") + ")\n";
return ChatColor.GRAY + "(" + Lang.get("stageEditorOptional") + ")";
} else {
text += ChatColor.BLUE + "" + ChatColor.BOLD + "14" + ChatColor.RESET + ChatColor.YELLOW + " - " + Lang.get("stageEditorCompleteMessage") + ChatColor.GRAY + " (" + Lang.get("noneSet") + ")\n";
return ChatColor.GRAY + "(" + Lang.get("noneSet") + ")";
}
} else {
text += ChatColor.BLUE + "" + ChatColor.BOLD + "14" + ChatColor.RESET + ChatColor.YELLOW + " - " + Lang.get("stageEditorCompleteMessage") + ChatColor.GRAY + " (" + ChatColor.AQUA + "\"" + context.getSessionData(pref + CK.S_COMPLETE_MESSAGE) + "\"" + ChatColor.GRAY + ")\n";
return ChatColor.GRAY + "(" + ChatColor.AQUA + "\"" + context.getSessionData(pref + CK.S_COMPLETE_MESSAGE) + "\"" + ChatColor.GRAY + ")";
}
case 15:
if (context.getSessionData(pref + CK.S_OVERRIDE_DISPLAY) == null) {
if (!hasObjective) {
text += ChatColor.GRAY + "" + ChatColor.BOLD + "15" + ChatColor.RESET + ChatColor.GRAY + " - " + Lang.get("stageEditorObjectiveOverride") + ChatColor.GRAY + " (" + Lang.get("stageEditorOptional") + ")\n";
return ChatColor.GRAY + "(" + Lang.get("stageEditorOptional") + ")";
} else {
text += ChatColor.BLUE + "" + ChatColor.BOLD + "15" + ChatColor.RESET + ChatColor.YELLOW + " - " + Lang.get("stageEditorObjectiveOverride") + ChatColor.GRAY + " (" + Lang.get("noneSet") + ")\n";
return ChatColor.GRAY + "(" + Lang.get("noneSet") + ")";
}
} else {
text += ChatColor.BLUE + "" + ChatColor.BOLD + "15" + ChatColor.RESET + ChatColor.YELLOW + " - " + Lang.get("stageEditorObjectiveOverride") + ChatColor.GRAY + " (" + ChatColor.AQUA + "\"" + context.getSessionData(pref + CK.S_OVERRIDE_DISPLAY) + "\"" + ChatColor.GRAY + ")\n";
return ChatColor.GRAY + "(" + ChatColor.AQUA + "\"" + context.getSessionData(pref + CK.S_OVERRIDE_DISPLAY) + "\"" + ChatColor.GRAY + ")";
}
text += ChatColor.RED + "" + ChatColor.BOLD + "16" + ChatColor.RESET + ChatColor.RED + " - " + Lang.get("stageEditorDelete") + "\n";
text += ChatColor.GREEN + "" + ChatColor.BOLD + "17" + ChatColor.RESET + ChatColor.GREEN + " - " + Lang.get("done") + "\n";
return text;
} catch (Exception e) {
e.printStackTrace();
return "error";
case 16:
case 17:
return "";
default:
return null;
}
}
@Override
protected Prompt acceptValidatedInput(ConversationContext context, String input) {
if (input.equalsIgnoreCase("1")) {
public String getPromptText(ConversationContext context) {
context.setSessionData(pref, Boolean.TRUE);
checkObjective(context);
QuestsEditorPostOpenCreateStagePromptEvent event = new QuestsEditorPostOpenCreateStagePromptEvent(questFactory, stageNum, context);
plugin.getServer().getPluginManager().callEvent(event);
String text = ChatColor.LIGHT_PURPLE + "- " + getTitle(context) + " -\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
protected Prompt acceptValidatedInput(ConversationContext context, Number input) {
switch (input.intValue()) {
case 1:
return new BlocksPrompt(plugin, stageNum, questFactory);
} else if (input.equalsIgnoreCase("2")) {
case 2:
return new ItemsPrompt(plugin, stageNum, questFactory);
} else if (input.equalsIgnoreCase("3")) {
case 3:
return new NPCsPrompt(plugin, stageNum, questFactory);
} else if (input.equalsIgnoreCase("4")) {
case 4:
return new MobsPrompt(plugin, stageNum, questFactory);
} else if (input.equalsIgnoreCase("5")) {
case 5:
return new KillPlayerPrompt();
} else if (input.equalsIgnoreCase("6")) {
case 6:
return new ReachListPrompt();
} else if (input.equalsIgnoreCase("7")) {
case 7:
return new PasswordListPrompt();
} else if (input.equalsIgnoreCase("8")) {
case 8:
return new CustomObjectivesPrompt();
} else if (input.equalsIgnoreCase("9")) {
case 9:
if (hasObjective) {
return new EventListPrompt();
} else {
context.getForWhom().sendRawMessage(ChatColor.RED + Lang.get("invalidOption"));
return new CreateStagePrompt(plugin, stageNum, questFactory);
}
} else if (input.equalsIgnoreCase("10")) {
case 10:
if (hasObjective) {
return new DelayPrompt();
} else {
context.getForWhom().sendRawMessage(ChatColor.RED + Lang.get("invalidOption"));
return new CreateStagePrompt(plugin, stageNum, questFactory);
}
} else if (input.equalsIgnoreCase("11")) {
case 11:
if (context.getSessionData(pref + CK.S_DELAY) == null) {
context.getForWhom().sendRawMessage(ChatColor.RED + Lang.get("stageEditorNoDelaySet"));
return new CreateStagePrompt(plugin, stageNum, questFactory);
} else {
return new DelayMessagePrompt();
}
} else if (input.equalsIgnoreCase("12")) {
case 12:
if (plugin.getDependencies().getDenizenAPI() == null) {
context.getForWhom().sendRawMessage(ChatColor.RED + Lang.get("stageEditorNoDenizen"));
return new CreateStagePrompt(plugin, stageNum, questFactory);
@ -251,36 +435,65 @@ public class CreateStagePrompt extends FixedSetPrompt {
return new CreateStagePrompt(plugin, stageNum, questFactory);
}
}
} else if (input.equalsIgnoreCase("13")) {
case 13:
if (hasObjective) {
return new StartMessagePrompt();
} else {
context.getForWhom().sendRawMessage(ChatColor.RED + Lang.get("invalidOption"));
return new CreateStagePrompt(plugin, stageNum, questFactory);
}
} else if (input.equalsIgnoreCase("14")) {
case 14:
if (hasObjective) {
return new CompleteMessagePrompt();
} else {
context.getForWhom().sendRawMessage(ChatColor.RED + Lang.get("invalidOption"));
return new CreateStagePrompt(plugin, stageNum, questFactory);
}
} else if (input.equalsIgnoreCase("15")) {
case 15:
if (hasObjective) {
return new OverrideDisplayPrompt();
} else {
context.getForWhom().sendRawMessage(ChatColor.RED + Lang.get("invalidOption"));
return new CreateStagePrompt(plugin, stageNum, questFactory);
}
} else if (input.equalsIgnoreCase("16")) {
case 16:
return new DeletePrompt();
} else if (input.equalsIgnoreCase("17")) {
case 17:
return new StagesPrompt(plugin, questFactory);
} else {
default:
return new CreateStagePrompt(plugin, stageNum, questFactory);
}
}
public void checkObjective(ConversationContext context) {
if (context.getSessionData(pref + CK.S_BREAK_NAMES) != null || context.getSessionData(pref + CK.S_DAMAGE_NAMES) != null
|| context.getSessionData(pref + CK.S_PLACE_NAMES) != null || context.getSessionData(pref + CK.S_USE_NAMES) != null
|| context.getSessionData(pref + CK.S_CUT_NAMES) != null) {
hasObjective = true;
}
if (context.getSessionData(pref + CK.S_CRAFT_ITEMS) != null || context.getSessionData(pref + CK.S_SMELT_ITEMS) != null || context.getSessionData(pref + CK.S_ENCHANT_TYPES) != null || context.getSessionData(pref + CK.S_BREW_ITEMS) != null) {
hasObjective = true;
}
if (context.getSessionData(pref + CK.S_DELIVERY_NPCS) != null || context.getSessionData(pref + CK.S_NPCS_TO_TALK_TO) != null || context.getSessionData(pref + CK.S_NPCS_TO_KILL) != null) {
hasObjective = true;
}
if (context.getSessionData(pref + CK.S_MOB_TYPES) != null || context.getSessionData(pref + CK.S_FISH) != null || context.getSessionData(pref + CK.S_TAME_TYPES) != null || context.getSessionData(pref + CK.S_SHEAR_COLORS) != null) {
hasObjective = true;
}
if (context.getSessionData(pref + CK.S_PLAYER_KILL) != null) {
hasObjective = true;
}
if (context.getSessionData(pref + CK.S_REACH_LOCATIONS) != null) {
hasObjective = true;
}
if (context.getSessionData(pref + CK.S_PASSWORD_PHRASES) != null) {
hasObjective = true;
}
if (context.getSessionData(pref + CK.S_CUSTOM_OBJECTIVES) == null) {
hasObjective = true;
}
}
private class PasswordListPrompt extends FixedSetPrompt {
public PasswordListPrompt() {
@ -1221,7 +1434,7 @@ public class CreateStagePrompt extends FixedSetPrompt {
public Prompt acceptInput(ConversationContext context, String input) {
Player player = (Player) context.getForWhom();
if (input.equalsIgnoreCase("1") || input.equalsIgnoreCase("Yes")) {
StagesPrompt.deleteStage(context, stageNum);
new StagesPrompt(plugin, questFactory).deleteStage(context, stageNum);
player.sendMessage(ChatColor.YELLOW + Lang.get("stageEditorDeleteSucces"));
return new StagesPrompt(plugin, questFactory);
} else if (input.equalsIgnoreCase("2") || input.equalsIgnoreCase("No")) {

View File

@ -14,64 +14,94 @@ package me.blackvein.quests.prompts;
import org.bukkit.ChatColor;
import org.bukkit.conversations.ConversationContext;
import org.bukkit.conversations.NumericPrompt;
import org.bukkit.conversations.Prompt;
import org.bukkit.conversations.StringPrompt;
import me.blackvein.quests.QuestFactory;
import me.blackvein.quests.Quests;
import me.blackvein.quests.events.editor.quests.QuestsEditorPostOpenStagesPromptEvent;
import me.blackvein.quests.util.CK;
import me.blackvein.quests.util.Lang;
public class StagesPrompt extends StringPrompt {
public class StagesPrompt extends NumericPrompt {
private final Quests plugin;
private final QuestFactory questFactory;
private int size = 2;
public StagesPrompt(Quests plugin, QuestFactory qf) {
this.plugin = plugin;
questFactory = qf;
}
@Override
public String getPromptText(ConversationContext cc) {
String text = ChatColor.LIGHT_PURPLE + "- " + Lang.get("stageEditorStages") + " -\n";
int stages = getStages(cc);
for (int i = 1; i <= stages; i++) {
text += ChatColor.BLUE + "" + ChatColor.BOLD + i + " - " + ChatColor.RESET + ChatColor.GOLD + Lang.get("stageEditorEditStage") + " " + i + "\n";
public int getSize(ConversationContext context) {
return size;
}
public String getTitle() {
return ChatColor.LIGHT_PURPLE + Lang.get("stageEditorStages");
}
public ChatColor getNumberColor(ConversationContext context, int number) {
int stages = getStages(context);
if (number > 0) {
if (number < (stages + 1) && number > 0) {
return ChatColor.BLUE;
} else if (number == (stages + 1)) {
return ChatColor.BLUE;
} else if (number == (stages + 2)) {
return ChatColor.GREEN;
}
}
return null;
}
public String getSelectionText(ConversationContext context, int number) {
int stages = getStages(context);
if (number > 0) {
if (number < (stages + 1) && number > 0) {
return ChatColor.GOLD + Lang.get("stageEditorEditStage") + " " + number;
} else if (number == (stages + 1)) {
return ChatColor.YELLOW + Lang.get("stageEditorNewStage");
} else if (number == (stages + 2)) {
return ChatColor.YELLOW + Lang.get("done");
}
}
return null;
}
@Override
public String getPromptText(ConversationContext context) {
QuestsEditorPostOpenStagesPromptEvent event = new QuestsEditorPostOpenStagesPromptEvent(questFactory, context);
plugin.getServer().getPluginManager().callEvent(event);
String text = ChatColor.LIGHT_PURPLE + "- " + getTitle() + " -\n";
for (int i = 1; i <= (getStages(context) + size); i++) {
text += getNumberColor(context, i) + "" + ChatColor.BOLD + i + ChatColor.RESET + " - " + getSelectionText(context, i) + "\n";
}
stages++;
text += "\n" + ChatColor.BLUE + "" + ChatColor.BOLD + stages + " - " + ChatColor.RESET + ChatColor.YELLOW + Lang.get("stageEditorNewStage");
stages++;
text += "\n" + ChatColor.GREEN + "" + ChatColor.BOLD + stages + " - " + ChatColor.RESET + ChatColor.YELLOW + Lang.get("done");
return text;
}
@Override
public Prompt acceptInput(ConversationContext cc, String string) {
int i;
try {
i = Integer.parseInt(string);
} catch (NumberFormatException e) {
return new StagesPrompt(plugin, questFactory);
}
int stages = getStages(cc);
if (i < 0) {
return new StagesPrompt(plugin, questFactory);
} else if (i < (stages + 1) && i > 0) {
protected Prompt acceptValidatedInput(ConversationContext context, Number input) {
int i = input.intValue();
int stages = getStages(context);
if (i > 0) {
if (i < (stages + 1) && i > 0) {
return new CreateStagePrompt(plugin, (i), questFactory);
} else if (i == (stages + 1)) {
return new CreateStagePrompt(plugin, (stages + 1), questFactory);
} else if (i == (stages + 2)) {
return questFactory.returnToMenu();
} else {
}
}
return new StagesPrompt(plugin, questFactory);
}
}
public static int getStages(ConversationContext cc) {
public int getStages(ConversationContext context) {
int num = 1;
while (true) {
if (cc.getSessionData("stage" + num) != null) {
if (context.getSessionData("stage" + num) != null) {
num++;
} else {
break;
@ -80,8 +110,8 @@ public class StagesPrompt extends StringPrompt {
return (num - 1);
}
public static void deleteStage(ConversationContext cc, int stageNum) {
int stages = getStages(cc);
public void deleteStage(ConversationContext context, int stageNum) {
int stages = getStages(context);
int current = stageNum;
String pref = "stage" + current;
String newPref;
@ -97,135 +127,135 @@ public class StagesPrompt extends StringPrompt {
}
pref = "stage" + current;
newPref = "stage" + (current - 1);
cc.setSessionData(newPref + CK.S_BREAK_NAMES, cc.getSessionData(pref + CK.S_BREAK_NAMES));
cc.setSessionData(newPref + CK.S_BREAK_AMOUNTS, cc.getSessionData(pref + CK.S_BREAK_AMOUNTS));
cc.setSessionData(newPref + CK.S_BREAK_DURABILITY, cc.getSessionData(pref + CK.S_BREAK_DURABILITY));
cc.setSessionData(newPref + CK.S_DAMAGE_NAMES, cc.getSessionData(pref + CK.S_DAMAGE_NAMES));
cc.setSessionData(newPref + CK.S_DAMAGE_AMOUNTS, cc.getSessionData(pref + CK.S_DAMAGE_AMOUNTS));
cc.setSessionData(newPref + CK.S_DAMAGE_DURABILITY, cc.getSessionData(pref + CK.S_DAMAGE_DURABILITY));
cc.setSessionData(newPref + CK.S_PLACE_NAMES, cc.getSessionData(pref + CK.S_PLACE_NAMES));
cc.setSessionData(newPref + CK.S_PLACE_NAMES, cc.getSessionData(pref + CK.S_PLACE_AMOUNTS));
cc.setSessionData(newPref + CK.S_PLACE_DURABILITY, cc.getSessionData(pref + CK.S_PLACE_DURABILITY));
cc.setSessionData(newPref + CK.S_USE_NAMES, cc.getSessionData(pref + CK.S_USE_NAMES));
cc.setSessionData(newPref + CK.S_USE_AMOUNTS, cc.getSessionData(pref + CK.S_USE_AMOUNTS));
cc.setSessionData(newPref + CK.S_USE_DURABILITY, cc.getSessionData(pref + CK.S_USE_DURABILITY));
cc.setSessionData(newPref + CK.S_CUT_NAMES, cc.getSessionData(pref + CK.S_CUT_NAMES));
cc.setSessionData(newPref + CK.S_CUT_AMOUNTS, cc.getSessionData(pref + CK.S_CUT_AMOUNTS));
cc.setSessionData(newPref + CK.S_CUT_DURABILITY, cc.getSessionData(pref + CK.S_CUT_DURABILITY));
cc.setSessionData(newPref + CK.S_CRAFT_ITEMS, cc.getSessionData(pref + CK.S_CRAFT_ITEMS));
cc.setSessionData(newPref + CK.S_SMELT_ITEMS, cc.getSessionData(pref + CK.S_SMELT_ITEMS));
cc.setSessionData(newPref + CK.S_ENCHANT_TYPES, cc.getSessionData(pref + CK.S_ENCHANT_TYPES));
cc.setSessionData(newPref + CK.S_ENCHANT_NAMES, cc.getSessionData(pref + CK.S_ENCHANT_NAMES));
cc.setSessionData(newPref + CK.S_ENCHANT_AMOUNTS, cc.getSessionData(pref + CK.S_ENCHANT_AMOUNTS));
cc.setSessionData(newPref + CK.S_BREW_ITEMS, cc.getSessionData(pref + CK.S_BREW_ITEMS));
cc.setSessionData(newPref + CK.S_FISH, cc.getSessionData(pref + CK.S_FISH));
cc.setSessionData(newPref + CK.S_PLAYER_KILL, cc.getSessionData(pref + CK.S_PLAYER_KILL));
cc.setSessionData(newPref + CK.S_DELIVERY_ITEMS, cc.getSessionData(pref + CK.S_DELIVERY_ITEMS));
cc.setSessionData(newPref + CK.S_DELIVERY_NPCS, cc.getSessionData(pref + CK.S_DELIVERY_NPCS));
cc.setSessionData(newPref + CK.S_DELIVERY_MESSAGES, cc.getSessionData(pref + CK.S_DELIVERY_MESSAGES));
cc.setSessionData(newPref + CK.S_NPCS_TO_TALK_TO, cc.getSessionData(pref + CK.S_NPCS_TO_TALK_TO));
cc.setSessionData(newPref + CK.S_NPCS_TO_KILL, cc.getSessionData(pref + CK.S_NPCS_TO_KILL));
cc.setSessionData(newPref + CK.S_NPCS_TO_KILL_AMOUNTS, cc.getSessionData(pref + CK.S_NPCS_TO_KILL_AMOUNTS));
cc.setSessionData(newPref + CK.S_MOB_TYPES, cc.getSessionData(pref + CK.S_MOB_TYPES));
cc.setSessionData(newPref + CK.S_MOB_AMOUNTS, cc.getSessionData(pref + CK.S_MOB_AMOUNTS));
cc.setSessionData(newPref + CK.S_MOB_KILL_LOCATIONS, cc.getSessionData(pref + CK.S_MOB_KILL_LOCATIONS));
cc.setSessionData(newPref + CK.S_MOB_KILL_LOCATIONS_RADIUS, cc.getSessionData(pref + CK.S_MOB_KILL_LOCATIONS_RADIUS));
cc.setSessionData(newPref + CK.S_MOB_KILL_LOCATIONS_NAMES, cc.getSessionData(pref + CK.S_MOB_KILL_LOCATIONS_NAMES));
cc.setSessionData(newPref + CK.S_REACH_LOCATIONS, cc.getSessionData(pref + CK.S_REACH_LOCATIONS));
cc.setSessionData(newPref + CK.S_REACH_LOCATIONS_RADIUS, cc.getSessionData(pref + CK.S_REACH_LOCATIONS_RADIUS));
cc.setSessionData(newPref + CK.S_REACH_LOCATIONS_NAMES, cc.getSessionData(pref + CK.S_REACH_LOCATIONS_NAMES));
cc.setSessionData(newPref + CK.S_TAME_TYPES, cc.getSessionData(pref + CK.S_TAME_TYPES));
cc.setSessionData(newPref + CK.S_TAME_AMOUNTS, cc.getSessionData(pref + CK.S_TAME_AMOUNTS));
cc.setSessionData(newPref + CK.S_SHEAR_COLORS, cc.getSessionData(pref + CK.S_SHEAR_COLORS));
cc.setSessionData(newPref + CK.S_SHEAR_AMOUNTS, cc.getSessionData(pref + CK.S_SHEAR_AMOUNTS));
cc.setSessionData(newPref + CK.S_START_EVENT, cc.getSessionData(pref + CK.S_START_EVENT));
cc.setSessionData(newPref + CK.S_DISCONNECT_EVENT, cc.getSessionData(pref + CK.S_DISCONNECT_EVENT));
cc.setSessionData(newPref + CK.S_DEATH_EVENT, cc.getSessionData(pref + CK.S_DEATH_EVENT));
cc.setSessionData(newPref + CK.S_CHAT_EVENTS, cc.getSessionData(pref + CK.S_CHAT_EVENTS));
cc.setSessionData(newPref + CK.S_CHAT_EVENT_TRIGGERS, cc.getSessionData(pref + CK.S_CHAT_EVENT_TRIGGERS));
cc.setSessionData(newPref + CK.S_FINISH_EVENT, cc.getSessionData(pref + CK.S_FINISH_EVENT));
cc.setSessionData(newPref + CK.S_CUSTOM_OBJECTIVES, cc.getSessionData(pref + CK.S_CUSTOM_OBJECTIVES));
cc.setSessionData(newPref + CK.S_CUSTOM_OBJECTIVES_DATA, cc.getSessionData(pref + CK.S_CUSTOM_OBJECTIVES_DATA));
cc.setSessionData(newPref + CK.S_CUSTOM_OBJECTIVES_COUNT, cc.getSessionData(pref + CK.S_CUSTOM_OBJECTIVES_COUNT));
cc.setSessionData(newPref + CK.S_CUSTOM_OBJECTIVES_DATA_DESCRIPTIONS, cc.getSessionData(pref + CK.S_CUSTOM_OBJECTIVES_DATA_DESCRIPTIONS));
cc.setSessionData(newPref + CK.S_CUSTOM_OBJECTIVES_DATA_TEMP, cc.getSessionData(pref + CK.S_CUSTOM_OBJECTIVES_DATA_TEMP));
cc.setSessionData(newPref + CK.S_PASSWORD_DISPLAYS, cc.getSessionData(pref + CK.S_PASSWORD_DISPLAYS));
cc.setSessionData(newPref + CK.S_PASSWORD_PHRASES, cc.getSessionData(pref + CK.S_PASSWORD_PHRASES));
cc.setSessionData(newPref + CK.S_OVERRIDE_DISPLAY, cc.getSessionData(pref + CK.S_OVERRIDE_DISPLAY));
cc.setSessionData(newPref + CK.S_DELAY, cc.getSessionData(pref + CK.S_DELAY));
cc.setSessionData(newPref + CK.S_DELAY_MESSAGE, cc.getSessionData(pref + CK.S_DELAY_MESSAGE));
cc.setSessionData(newPref + CK.S_DENIZEN, cc.getSessionData(pref + CK.S_DENIZEN));
cc.setSessionData(newPref + CK.S_COMPLETE_MESSAGE, cc.getSessionData(pref + CK.S_COMPLETE_MESSAGE));
cc.setSessionData(newPref + CK.S_START_MESSAGE, cc.getSessionData(pref + CK.S_START_MESSAGE));
context.setSessionData(newPref + CK.S_BREAK_NAMES, context.getSessionData(pref + CK.S_BREAK_NAMES));
context.setSessionData(newPref + CK.S_BREAK_AMOUNTS, context.getSessionData(pref + CK.S_BREAK_AMOUNTS));
context.setSessionData(newPref + CK.S_BREAK_DURABILITY, context.getSessionData(pref + CK.S_BREAK_DURABILITY));
context.setSessionData(newPref + CK.S_DAMAGE_NAMES, context.getSessionData(pref + CK.S_DAMAGE_NAMES));
context.setSessionData(newPref + CK.S_DAMAGE_AMOUNTS, context.getSessionData(pref + CK.S_DAMAGE_AMOUNTS));
context.setSessionData(newPref + CK.S_DAMAGE_DURABILITY, context.getSessionData(pref + CK.S_DAMAGE_DURABILITY));
context.setSessionData(newPref + CK.S_PLACE_NAMES, context.getSessionData(pref + CK.S_PLACE_NAMES));
context.setSessionData(newPref + CK.S_PLACE_NAMES, context.getSessionData(pref + CK.S_PLACE_AMOUNTS));
context.setSessionData(newPref + CK.S_PLACE_DURABILITY, context.getSessionData(pref + CK.S_PLACE_DURABILITY));
context.setSessionData(newPref + CK.S_USE_NAMES, context.getSessionData(pref + CK.S_USE_NAMES));
context.setSessionData(newPref + CK.S_USE_AMOUNTS, context.getSessionData(pref + CK.S_USE_AMOUNTS));
context.setSessionData(newPref + CK.S_USE_DURABILITY, context.getSessionData(pref + CK.S_USE_DURABILITY));
context.setSessionData(newPref + CK.S_CUT_NAMES, context.getSessionData(pref + CK.S_CUT_NAMES));
context.setSessionData(newPref + CK.S_CUT_AMOUNTS, context.getSessionData(pref + CK.S_CUT_AMOUNTS));
context.setSessionData(newPref + CK.S_CUT_DURABILITY, context.getSessionData(pref + CK.S_CUT_DURABILITY));
context.setSessionData(newPref + CK.S_CRAFT_ITEMS, context.getSessionData(pref + CK.S_CRAFT_ITEMS));
context.setSessionData(newPref + CK.S_SMELT_ITEMS, context.getSessionData(pref + CK.S_SMELT_ITEMS));
context.setSessionData(newPref + CK.S_ENCHANT_TYPES, context.getSessionData(pref + CK.S_ENCHANT_TYPES));
context.setSessionData(newPref + CK.S_ENCHANT_NAMES, context.getSessionData(pref + CK.S_ENCHANT_NAMES));
context.setSessionData(newPref + CK.S_ENCHANT_AMOUNTS, context.getSessionData(pref + CK.S_ENCHANT_AMOUNTS));
context.setSessionData(newPref + CK.S_BREW_ITEMS, context.getSessionData(pref + CK.S_BREW_ITEMS));
context.setSessionData(newPref + CK.S_FISH, context.getSessionData(pref + CK.S_FISH));
context.setSessionData(newPref + CK.S_PLAYER_KILL, context.getSessionData(pref + CK.S_PLAYER_KILL));
context.setSessionData(newPref + CK.S_DELIVERY_ITEMS, context.getSessionData(pref + CK.S_DELIVERY_ITEMS));
context.setSessionData(newPref + CK.S_DELIVERY_NPCS, context.getSessionData(pref + CK.S_DELIVERY_NPCS));
context.setSessionData(newPref + CK.S_DELIVERY_MESSAGES, context.getSessionData(pref + CK.S_DELIVERY_MESSAGES));
context.setSessionData(newPref + CK.S_NPCS_TO_TALK_TO, context.getSessionData(pref + CK.S_NPCS_TO_TALK_TO));
context.setSessionData(newPref + CK.S_NPCS_TO_KILL, context.getSessionData(pref + CK.S_NPCS_TO_KILL));
context.setSessionData(newPref + CK.S_NPCS_TO_KILL_AMOUNTS, context.getSessionData(pref + CK.S_NPCS_TO_KILL_AMOUNTS));
context.setSessionData(newPref + CK.S_MOB_TYPES, context.getSessionData(pref + CK.S_MOB_TYPES));
context.setSessionData(newPref + CK.S_MOB_AMOUNTS, context.getSessionData(pref + CK.S_MOB_AMOUNTS));
context.setSessionData(newPref + CK.S_MOB_KILL_LOCATIONS, context.getSessionData(pref + CK.S_MOB_KILL_LOCATIONS));
context.setSessionData(newPref + CK.S_MOB_KILL_LOCATIONS_RADIUS, context.getSessionData(pref + CK.S_MOB_KILL_LOCATIONS_RADIUS));
context.setSessionData(newPref + CK.S_MOB_KILL_LOCATIONS_NAMES, context.getSessionData(pref + CK.S_MOB_KILL_LOCATIONS_NAMES));
context.setSessionData(newPref + CK.S_REACH_LOCATIONS, context.getSessionData(pref + CK.S_REACH_LOCATIONS));
context.setSessionData(newPref + CK.S_REACH_LOCATIONS_RADIUS, context.getSessionData(pref + CK.S_REACH_LOCATIONS_RADIUS));
context.setSessionData(newPref + CK.S_REACH_LOCATIONS_NAMES, context.getSessionData(pref + CK.S_REACH_LOCATIONS_NAMES));
context.setSessionData(newPref + CK.S_TAME_TYPES, context.getSessionData(pref + CK.S_TAME_TYPES));
context.setSessionData(newPref + CK.S_TAME_AMOUNTS, context.getSessionData(pref + CK.S_TAME_AMOUNTS));
context.setSessionData(newPref + CK.S_SHEAR_COLORS, context.getSessionData(pref + CK.S_SHEAR_COLORS));
context.setSessionData(newPref + CK.S_SHEAR_AMOUNTS, context.getSessionData(pref + CK.S_SHEAR_AMOUNTS));
context.setSessionData(newPref + CK.S_START_EVENT, context.getSessionData(pref + CK.S_START_EVENT));
context.setSessionData(newPref + CK.S_DISCONNECT_EVENT, context.getSessionData(pref + CK.S_DISCONNECT_EVENT));
context.setSessionData(newPref + CK.S_DEATH_EVENT, context.getSessionData(pref + CK.S_DEATH_EVENT));
context.setSessionData(newPref + CK.S_CHAT_EVENTS, context.getSessionData(pref + CK.S_CHAT_EVENTS));
context.setSessionData(newPref + CK.S_CHAT_EVENT_TRIGGERS, context.getSessionData(pref + CK.S_CHAT_EVENT_TRIGGERS));
context.setSessionData(newPref + CK.S_FINISH_EVENT, context.getSessionData(pref + CK.S_FINISH_EVENT));
context.setSessionData(newPref + CK.S_CUSTOM_OBJECTIVES, context.getSessionData(pref + CK.S_CUSTOM_OBJECTIVES));
context.setSessionData(newPref + CK.S_CUSTOM_OBJECTIVES_DATA, context.getSessionData(pref + CK.S_CUSTOM_OBJECTIVES_DATA));
context.setSessionData(newPref + CK.S_CUSTOM_OBJECTIVES_COUNT, context.getSessionData(pref + CK.S_CUSTOM_OBJECTIVES_COUNT));
context.setSessionData(newPref + CK.S_CUSTOM_OBJECTIVES_DATA_DESCRIPTIONS, context.getSessionData(pref + CK.S_CUSTOM_OBJECTIVES_DATA_DESCRIPTIONS));
context.setSessionData(newPref + CK.S_CUSTOM_OBJECTIVES_DATA_TEMP, context.getSessionData(pref + CK.S_CUSTOM_OBJECTIVES_DATA_TEMP));
context.setSessionData(newPref + CK.S_PASSWORD_DISPLAYS, context.getSessionData(pref + CK.S_PASSWORD_DISPLAYS));
context.setSessionData(newPref + CK.S_PASSWORD_PHRASES, context.getSessionData(pref + CK.S_PASSWORD_PHRASES));
context.setSessionData(newPref + CK.S_OVERRIDE_DISPLAY, context.getSessionData(pref + CK.S_OVERRIDE_DISPLAY));
context.setSessionData(newPref + CK.S_DELAY, context.getSessionData(pref + CK.S_DELAY));
context.setSessionData(newPref + CK.S_DELAY_MESSAGE, context.getSessionData(pref + CK.S_DELAY_MESSAGE));
context.setSessionData(newPref + CK.S_DENIZEN, context.getSessionData(pref + CK.S_DENIZEN));
context.setSessionData(newPref + CK.S_COMPLETE_MESSAGE, context.getSessionData(pref + CK.S_COMPLETE_MESSAGE));
context.setSessionData(newPref + CK.S_START_MESSAGE, context.getSessionData(pref + CK.S_START_MESSAGE));
}
cc.setSessionData(pref + CK.S_BREAK_NAMES, null);
cc.setSessionData(pref + CK.S_BREAK_AMOUNTS, null);
cc.setSessionData(pref + CK.S_BREAK_DURABILITY, null);
cc.setSessionData(pref + CK.S_DAMAGE_NAMES, null);
cc.setSessionData(pref + CK.S_DAMAGE_AMOUNTS, null);
cc.setSessionData(pref + CK.S_DAMAGE_DURABILITY, null);
cc.setSessionData(pref + CK.S_PLACE_NAMES, null);
cc.setSessionData(pref + CK.S_PLACE_AMOUNTS, null);
cc.setSessionData(pref + CK.S_PLACE_DURABILITY, null);
cc.setSessionData(pref + CK.S_USE_NAMES, null);
cc.setSessionData(pref + CK.S_USE_AMOUNTS, null);
cc.setSessionData(pref + CK.S_USE_DURABILITY, null);
cc.setSessionData(pref + CK.S_CUT_NAMES, null);
cc.setSessionData(pref + CK.S_CUT_AMOUNTS, null);
cc.setSessionData(pref + CK.S_CUT_DURABILITY, null);
cc.setSessionData(pref + CK.S_CRAFT_ITEMS, null);
cc.setSessionData(pref + CK.S_SMELT_ITEMS, null);
cc.setSessionData(pref + CK.S_ENCHANT_TYPES, null);
cc.setSessionData(pref + CK.S_ENCHANT_NAMES, null);
cc.setSessionData(pref + CK.S_BREW_ITEMS, null);
cc.setSessionData(pref + CK.S_FISH, null);
cc.setSessionData(pref + CK.S_PLAYER_KILL, null);
cc.setSessionData(pref + CK.S_ENCHANT_AMOUNTS, null);
cc.setSessionData(pref + CK.S_DELIVERY_ITEMS, null);
cc.setSessionData(pref + CK.S_DELIVERY_NPCS, null);
cc.setSessionData(pref + CK.S_DELIVERY_MESSAGES, null);
cc.setSessionData(pref + CK.S_NPCS_TO_TALK_TO, null);
cc.setSessionData(pref + CK.S_NPCS_TO_KILL, null);
cc.setSessionData(pref + CK.S_NPCS_TO_KILL_AMOUNTS, null);
cc.setSessionData(pref + CK.S_MOB_TYPES, null);
cc.setSessionData(pref + CK.S_MOB_AMOUNTS, null);
cc.setSessionData(pref + CK.S_MOB_KILL_LOCATIONS, null);
cc.setSessionData(pref + CK.S_MOB_KILL_LOCATIONS_RADIUS, null);
cc.setSessionData(pref + CK.S_MOB_KILL_LOCATIONS_NAMES, null);
cc.setSessionData(pref + CK.S_REACH_LOCATIONS, null);
cc.setSessionData(pref + CK.S_REACH_LOCATIONS_RADIUS, null);
cc.setSessionData(pref + CK.S_REACH_LOCATIONS_NAMES, null);
cc.setSessionData(pref + CK.S_TAME_TYPES, null);
cc.setSessionData(pref + CK.S_TAME_AMOUNTS, null);
cc.setSessionData(pref + CK.S_SHEAR_COLORS, null);
cc.setSessionData(pref + CK.S_SHEAR_AMOUNTS, null);
cc.setSessionData(pref + CK.S_FINISH_EVENT, null);
cc.setSessionData(pref + CK.S_START_EVENT, null);
cc.setSessionData(pref + CK.S_DEATH_EVENT, null);
cc.setSessionData(pref + CK.S_CHAT_EVENTS, null);
cc.setSessionData(pref + CK.S_CHAT_EVENT_TRIGGERS, null);
cc.setSessionData(pref + CK.S_DISCONNECT_EVENT, null);
cc.setSessionData(pref + CK.S_CUSTOM_OBJECTIVES, null);
cc.setSessionData(pref + CK.S_CUSTOM_OBJECTIVES_DATA, null);
cc.setSessionData(pref + CK.S_CUSTOM_OBJECTIVES_COUNT, null);
cc.setSessionData(pref + CK.S_CUSTOM_OBJECTIVES_DATA_DESCRIPTIONS, null);
cc.setSessionData(pref + CK.S_CUSTOM_OBJECTIVES_DATA_TEMP, null);
cc.setSessionData(pref + CK.S_PASSWORD_DISPLAYS, null);
cc.setSessionData(pref + CK.S_PASSWORD_PHRASES, null);
cc.setSessionData(pref + CK.S_OVERRIDE_DISPLAY, null);
cc.setSessionData(pref + CK.S_DELAY, null);
cc.setSessionData(pref + CK.S_DELAY_MESSAGE, null);
cc.setSessionData(pref + CK.S_DENIZEN, null);
cc.setSessionData(pref + CK.S_COMPLETE_MESSAGE, null);
cc.setSessionData(pref + CK.S_START_MESSAGE, null);
context.setSessionData(pref + CK.S_BREAK_NAMES, null);
context.setSessionData(pref + CK.S_BREAK_AMOUNTS, null);
context.setSessionData(pref + CK.S_BREAK_DURABILITY, null);
context.setSessionData(pref + CK.S_DAMAGE_NAMES, null);
context.setSessionData(pref + CK.S_DAMAGE_AMOUNTS, null);
context.setSessionData(pref + CK.S_DAMAGE_DURABILITY, null);
context.setSessionData(pref + CK.S_PLACE_NAMES, null);
context.setSessionData(pref + CK.S_PLACE_AMOUNTS, null);
context.setSessionData(pref + CK.S_PLACE_DURABILITY, null);
context.setSessionData(pref + CK.S_USE_NAMES, null);
context.setSessionData(pref + CK.S_USE_AMOUNTS, null);
context.setSessionData(pref + CK.S_USE_DURABILITY, null);
context.setSessionData(pref + CK.S_CUT_NAMES, null);
context.setSessionData(pref + CK.S_CUT_AMOUNTS, null);
context.setSessionData(pref + CK.S_CUT_DURABILITY, null);
context.setSessionData(pref + CK.S_CRAFT_ITEMS, null);
context.setSessionData(pref + CK.S_SMELT_ITEMS, null);
context.setSessionData(pref + CK.S_ENCHANT_TYPES, null);
context.setSessionData(pref + CK.S_ENCHANT_NAMES, null);
context.setSessionData(pref + CK.S_BREW_ITEMS, null);
context.setSessionData(pref + CK.S_FISH, null);
context.setSessionData(pref + CK.S_PLAYER_KILL, null);
context.setSessionData(pref + CK.S_ENCHANT_AMOUNTS, null);
context.setSessionData(pref + CK.S_DELIVERY_ITEMS, null);
context.setSessionData(pref + CK.S_DELIVERY_NPCS, null);
context.setSessionData(pref + CK.S_DELIVERY_MESSAGES, null);
context.setSessionData(pref + CK.S_NPCS_TO_TALK_TO, null);
context.setSessionData(pref + CK.S_NPCS_TO_KILL, null);
context.setSessionData(pref + CK.S_NPCS_TO_KILL_AMOUNTS, null);
context.setSessionData(pref + CK.S_MOB_TYPES, null);
context.setSessionData(pref + CK.S_MOB_AMOUNTS, null);
context.setSessionData(pref + CK.S_MOB_KILL_LOCATIONS, null);
context.setSessionData(pref + CK.S_MOB_KILL_LOCATIONS_RADIUS, null);
context.setSessionData(pref + CK.S_MOB_KILL_LOCATIONS_NAMES, null);
context.setSessionData(pref + CK.S_REACH_LOCATIONS, null);
context.setSessionData(pref + CK.S_REACH_LOCATIONS_RADIUS, null);
context.setSessionData(pref + CK.S_REACH_LOCATIONS_NAMES, null);
context.setSessionData(pref + CK.S_TAME_TYPES, null);
context.setSessionData(pref + CK.S_TAME_AMOUNTS, null);
context.setSessionData(pref + CK.S_SHEAR_COLORS, null);
context.setSessionData(pref + CK.S_SHEAR_AMOUNTS, null);
context.setSessionData(pref + CK.S_FINISH_EVENT, null);
context.setSessionData(pref + CK.S_START_EVENT, null);
context.setSessionData(pref + CK.S_DEATH_EVENT, null);
context.setSessionData(pref + CK.S_CHAT_EVENTS, null);
context.setSessionData(pref + CK.S_CHAT_EVENT_TRIGGERS, null);
context.setSessionData(pref + CK.S_DISCONNECT_EVENT, null);
context.setSessionData(pref + CK.S_CUSTOM_OBJECTIVES, null);
context.setSessionData(pref + CK.S_CUSTOM_OBJECTIVES_DATA, null);
context.setSessionData(pref + CK.S_CUSTOM_OBJECTIVES_COUNT, null);
context.setSessionData(pref + CK.S_CUSTOM_OBJECTIVES_DATA_DESCRIPTIONS, null);
context.setSessionData(pref + CK.S_CUSTOM_OBJECTIVES_DATA_TEMP, null);
context.setSessionData(pref + CK.S_PASSWORD_DISPLAYS, null);
context.setSessionData(pref + CK.S_PASSWORD_PHRASES, null);
context.setSessionData(pref + CK.S_OVERRIDE_DISPLAY, null);
context.setSessionData(pref + CK.S_DELAY, null);
context.setSessionData(pref + CK.S_DELAY_MESSAGE, null);
context.setSessionData(pref + CK.S_DENIZEN, null);
context.setSessionData(pref + CK.S_COMPLETE_MESSAGE, null);
context.setSessionData(pref + CK.S_START_MESSAGE, null);
if (last) {
break;
}
}
if (!last) {
cc.setSessionData("stage" + (current - 1), null);
context.setSessionData("stage" + (current - 1), null);
} else {
cc.setSessionData("stage" + (current), null);
context.setSessionData("stage" + (current), null);
}
}
}