mirror of
https://github.com/PikaMug/Quests.git
synced 2024-12-26 19:17:50 +01:00
Remove passing of plugin object to prompts
This commit is contained in:
parent
f02d179399
commit
079b639af5
@ -67,18 +67,18 @@ import net.citizensnpcs.api.CitizensAPI;
|
||||
public class QuestFactory implements ConversationAbandonedListener {
|
||||
|
||||
private final Quests plugin;
|
||||
private final ConversationFactory convoCreator;
|
||||
private Map<UUID, Block> selectedBlockStarts = new HashMap<UUID, Block>();
|
||||
private Map<UUID, Block> selectedKillLocations = new HashMap<UUID, Block>();
|
||||
private Map<UUID, Block> selectedReachLocations = new HashMap<UUID, Block>();
|
||||
private HashSet<Player> selectingNpcs = new HashSet<Player>();
|
||||
private List<String> names = new LinkedList<String>();
|
||||
private ConversationFactory convoCreator;
|
||||
|
||||
public QuestFactory(Quests plugin) {
|
||||
this.plugin = plugin;
|
||||
// Ensure to initialize convoCreator last so that 'this' is fully initialized before it is passed
|
||||
this.convoCreator = new ConversationFactory(plugin).withModality(false).withLocalEcho(false)
|
||||
.withFirstPrompt(new QuestMenuPrompt(plugin, null)).withTimeout(3600)
|
||||
.withFirstPrompt(new QuestMenuPrompt(null)).withTimeout(3600)
|
||||
.thatExcludesNonPlayersWithMessage("Console may not perform this operation!")
|
||||
.addConversationAbandonedListener(this);
|
||||
}
|
||||
@ -139,7 +139,7 @@ public class QuestFactory implements ConversationAbandonedListener {
|
||||
}
|
||||
|
||||
public class QuestMenuPrompt extends QuestsEditorNumericPrompt {
|
||||
public QuestMenuPrompt(Quests plugin, ConversationContext context) {
|
||||
public QuestMenuPrompt(ConversationContext context) {
|
||||
super(context);
|
||||
}
|
||||
|
||||
@ -187,9 +187,8 @@ public class QuestFactory implements ConversationAbandonedListener {
|
||||
|
||||
@Override
|
||||
public String getPromptText(ConversationContext context) {
|
||||
/*QuestsEditorPostOpenNumericPromptEvent event
|
||||
= new QuestsEditorPostOpenNumericPromptEvent(context, QuestFactory.this, this);
|
||||
plugin.getServer().getPluginManager().callEvent(event);*/
|
||||
QuestsEditorPostOpenNumericPromptEvent event = new QuestsEditorPostOpenNumericPromptEvent(context, this);
|
||||
plugin.getServer().getPluginManager().callEvent(event);
|
||||
String text = ChatColor.GOLD + getTitle(context) + "\n";
|
||||
for (int i = 1; i <= size; i++) {
|
||||
text += getNumberColor(context, i) + "" + ChatColor.BOLD + i + ChatColor.RESET + " - "
|
||||
@ -207,21 +206,21 @@ public class QuestFactory implements ConversationAbandonedListener {
|
||||
return new QuestSelectCreatePrompt(plugin, context);
|
||||
} else {
|
||||
player.sendMessage(ChatColor.RED + Lang.get("noPermission"));
|
||||
return new QuestMenuPrompt(plugin, context);
|
||||
return new QuestMenuPrompt(context);
|
||||
}
|
||||
case 2:
|
||||
if (player.hasPermission("quests.editor.*") || player.hasPermission("quests.editor.edit")) {
|
||||
return new QuestSelectEditPrompt();
|
||||
} else {
|
||||
player.sendMessage(ChatColor.RED + Lang.get("noPermission"));
|
||||
return new QuestMenuPrompt(plugin, context);
|
||||
return new QuestMenuPrompt(context);
|
||||
}
|
||||
case 3:
|
||||
if (player.hasPermission("quests.editor.*") || player.hasPermission("quests.editor.delete")) {
|
||||
return new QuestSelectDeletePrompt();
|
||||
} else {
|
||||
player.sendMessage(ChatColor.RED + Lang.get("noPermission"));
|
||||
return new QuestMenuPrompt(plugin, context);
|
||||
return new QuestMenuPrompt(context);
|
||||
}
|
||||
case 4:
|
||||
context.getForWhom().sendRawMessage(ChatColor.YELLOW + Lang.get("exited"));
|
||||
@ -233,11 +232,11 @@ public class QuestFactory implements ConversationAbandonedListener {
|
||||
}
|
||||
|
||||
public Prompt returnToMenu(ConversationContext context) {
|
||||
return new QuestMainPrompt(plugin, context);
|
||||
return new QuestMainPrompt(context);
|
||||
}
|
||||
|
||||
public class QuestMainPrompt extends QuestsEditorNumericPrompt {
|
||||
public QuestMainPrompt(Quests plugin, ConversationContext context) {
|
||||
public QuestMainPrompt(ConversationContext context) {
|
||||
super(context);
|
||||
}
|
||||
|
||||
@ -462,7 +461,7 @@ public class QuestFactory implements ConversationAbandonedListener {
|
||||
if (plugin.getDependencies().getCitizens() != null) {
|
||||
return new NPCStartPrompt();
|
||||
} else {
|
||||
return new QuestMainPrompt(plugin, context);
|
||||
return new QuestMainPrompt(context);
|
||||
}
|
||||
case 5:
|
||||
selectedBlockStarts.put(((Player) context.getForWhom()).getUniqueId(), null);
|
||||
@ -471,30 +470,30 @@ public class QuestFactory implements ConversationAbandonedListener {
|
||||
if (plugin.getDependencies().getWorldGuardApi() != null) {
|
||||
return new RegionPrompt();
|
||||
} else {
|
||||
return new QuestMainPrompt(plugin, context);
|
||||
return new QuestMainPrompt(context);
|
||||
}
|
||||
case 7:
|
||||
return new InitialActionPrompt();
|
||||
case 8:
|
||||
if (plugin.getDependencies().getCitizens() != null) {
|
||||
return new GUIDisplayPrompt(plugin, context);
|
||||
return new GUIDisplayPrompt(context);
|
||||
} else {
|
||||
return new QuestMainPrompt(plugin, context);
|
||||
return new QuestMainPrompt(context);
|
||||
}
|
||||
case 9:
|
||||
return new RequirementsPrompt(plugin, context);
|
||||
return new RequirementsPrompt(context);
|
||||
case 10:
|
||||
return new PlannerPrompt(plugin, context);
|
||||
return new PlannerPrompt(context);
|
||||
case 11:
|
||||
return new StageMenuPrompt(plugin, context);
|
||||
return new StageMenuPrompt(context);
|
||||
case 12:
|
||||
return new RewardsPrompt(plugin, context);
|
||||
return new RewardsPrompt(context);
|
||||
case 13:
|
||||
return new OptionsPrompt(plugin, context);
|
||||
return new OptionsPrompt(context);
|
||||
case 14:
|
||||
return new SavePrompt(plugin, context);
|
||||
return new SavePrompt(context);
|
||||
case 15:
|
||||
return new ExitPrompt(plugin, context);
|
||||
return new ExitPrompt(context);
|
||||
default:
|
||||
return null;
|
||||
}
|
||||
@ -551,9 +550,9 @@ public class QuestFactory implements ConversationAbandonedListener {
|
||||
}
|
||||
context.setSessionData(CK.Q_NAME, input);
|
||||
names.add(input);
|
||||
return new QuestMainPrompt(plugin, context);
|
||||
return new QuestMainPrompt(context);
|
||||
} else {
|
||||
return new QuestMenuPrompt(plugin, context);
|
||||
return new QuestMenuPrompt(context);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -575,11 +574,11 @@ public class QuestFactory implements ConversationAbandonedListener {
|
||||
Quest q = plugin.getQuest(input);
|
||||
if (q != null) {
|
||||
loadQuest(context, q);
|
||||
return new QuestMainPrompt(plugin, context);
|
||||
return new QuestMainPrompt(context);
|
||||
}
|
||||
return new QuestSelectEditPrompt();
|
||||
} else {
|
||||
return new QuestMenuPrompt(plugin, context);
|
||||
return new QuestMenuPrompt(context);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -716,7 +715,7 @@ public class QuestFactory implements ConversationAbandonedListener {
|
||||
final String pref = "stage" + index;
|
||||
index++;
|
||||
context.setSessionData(pref, Boolean.TRUE);
|
||||
if (stage.blocksToBreak != null) {
|
||||
if (!stage.getBlocksToBreak().isEmpty()) {
|
||||
LinkedList<String> names = new LinkedList<String>();
|
||||
LinkedList<Integer> amnts = new LinkedList<Integer>();
|
||||
LinkedList<Short> durab = new LinkedList<Short>();
|
||||
@ -729,7 +728,7 @@ public class QuestFactory implements ConversationAbandonedListener {
|
||||
context.setSessionData(pref + CK.S_BREAK_AMOUNTS, amnts);
|
||||
context.setSessionData(pref + CK.S_BREAK_DURABILITY, durab);
|
||||
}
|
||||
if (stage.blocksToDamage != null) {
|
||||
if (!stage.getBlocksToDamage().isEmpty()) {
|
||||
LinkedList<String> names = new LinkedList<String>();
|
||||
LinkedList<Integer> amnts = new LinkedList<Integer>();
|
||||
LinkedList<Short> durab = new LinkedList<Short>();
|
||||
@ -742,7 +741,7 @@ public class QuestFactory implements ConversationAbandonedListener {
|
||||
context.setSessionData(pref + CK.S_DAMAGE_AMOUNTS, amnts);
|
||||
context.setSessionData(pref + CK.S_DAMAGE_DURABILITY, durab);
|
||||
}
|
||||
if (stage.blocksToPlace != null) {
|
||||
if (!stage.getBlocksToPlace().isEmpty()) {
|
||||
LinkedList<String> names = new LinkedList<String>();
|
||||
LinkedList<Integer> amnts = new LinkedList<Integer>();
|
||||
LinkedList<Short> durab = new LinkedList<Short>();
|
||||
@ -755,7 +754,7 @@ public class QuestFactory implements ConversationAbandonedListener {
|
||||
context.setSessionData(pref + CK.S_PLACE_AMOUNTS, amnts);
|
||||
context.setSessionData(pref + CK.S_PLACE_DURABILITY, durab);
|
||||
}
|
||||
if (stage.blocksToUse != null) {
|
||||
if (!stage.getBlocksToUse().isEmpty()) {
|
||||
LinkedList<String> names = new LinkedList<String>();
|
||||
LinkedList<Integer> amnts = new LinkedList<Integer>();
|
||||
LinkedList<Short> durab = new LinkedList<Short>();
|
||||
@ -768,7 +767,7 @@ public class QuestFactory implements ConversationAbandonedListener {
|
||||
context.setSessionData(pref + CK.S_USE_AMOUNTS, amnts);
|
||||
context.setSessionData(pref + CK.S_USE_DURABILITY, durab);
|
||||
}
|
||||
if (stage.blocksToCut != null) {
|
||||
if (!stage.getBlocksToCut().isEmpty()) {
|
||||
LinkedList<String> names = new LinkedList<String>();
|
||||
LinkedList<Integer> amnts = new LinkedList<Integer>();
|
||||
LinkedList<Short> durab = new LinkedList<Short>();
|
||||
@ -781,21 +780,21 @@ public class QuestFactory implements ConversationAbandonedListener {
|
||||
context.setSessionData(pref + CK.S_CUT_AMOUNTS, amnts);
|
||||
context.setSessionData(pref + CK.S_CUT_DURABILITY, durab);
|
||||
}
|
||||
if (stage.getItemsToCraft().isEmpty() == false) {
|
||||
if (!stage.getItemsToCraft().isEmpty()) {
|
||||
LinkedList<ItemStack> items = new LinkedList<ItemStack>();
|
||||
for (ItemStack is : stage.getItemsToCraft()) {
|
||||
items.add(is);
|
||||
}
|
||||
context.setSessionData(pref + CK.S_CRAFT_ITEMS, items);
|
||||
}
|
||||
if (stage.getItemsToSmelt().isEmpty() == false) {
|
||||
if (!stage.getItemsToSmelt().isEmpty()) {
|
||||
LinkedList<ItemStack> items = new LinkedList<ItemStack>();
|
||||
for (ItemStack is : stage.getItemsToSmelt()) {
|
||||
items.add(is);
|
||||
}
|
||||
context.setSessionData(pref + CK.S_SMELT_ITEMS, items);
|
||||
}
|
||||
if (stage.itemsToEnchant.isEmpty() == false) {
|
||||
if (!stage.getItemsToEnchant().isEmpty()) {
|
||||
LinkedList<String> enchants = new LinkedList<String>();
|
||||
LinkedList<String> names = new LinkedList<String>();
|
||||
LinkedList<Integer> amounts = new LinkedList<Integer>();
|
||||
@ -810,7 +809,7 @@ public class QuestFactory implements ConversationAbandonedListener {
|
||||
context.setSessionData(pref + CK.S_ENCHANT_NAMES, names);
|
||||
context.setSessionData(pref + CK.S_ENCHANT_AMOUNTS, amounts);
|
||||
}
|
||||
if (stage.getItemsToBrew().isEmpty() == false) {
|
||||
if (!stage.getItemsToBrew().isEmpty()) {
|
||||
LinkedList<ItemStack> items = new LinkedList<ItemStack>();
|
||||
for (ItemStack is : stage.getItemsToBrew()) {
|
||||
items.add(is);
|
||||
@ -929,7 +928,7 @@ public class QuestFactory implements ConversationAbandonedListener {
|
||||
if (stage.disconnectAction != null) {
|
||||
context.setSessionData(pref + CK.S_DISCONNECT_EVENT, stage.disconnectAction.getName());
|
||||
}
|
||||
if (stage.chatActions != null) {
|
||||
if (!stage.getChatActions().isEmpty()) {
|
||||
LinkedList<String> chatEvents = new LinkedList<String>();
|
||||
LinkedList<String> chatEventTriggers = new LinkedList<String>();
|
||||
for (String s : stage.chatActions.keySet()) {
|
||||
@ -939,7 +938,7 @@ public class QuestFactory implements ConversationAbandonedListener {
|
||||
context.setSessionData(pref + CK.S_CHAT_EVENTS, chatEvents);
|
||||
context.setSessionData(pref + CK.S_CHAT_EVENT_TRIGGERS, chatEventTriggers);
|
||||
}
|
||||
if (stage.commandActions != null) {
|
||||
if (!stage.getCommandActions().isEmpty()) {
|
||||
LinkedList<String> commandEvents = new LinkedList<String>();
|
||||
LinkedList<String> commandEventTriggers = new LinkedList<String>();
|
||||
for (String s : stage.commandActions.keySet()) {
|
||||
@ -1014,7 +1013,7 @@ public class QuestFactory implements ConversationAbandonedListener {
|
||||
((Player) context.getForWhom()).sendMessage(ChatColor.RED + Lang.get("questEditorQuestNotFound"));
|
||||
return new QuestSelectDeletePrompt();
|
||||
} else {
|
||||
return new QuestMenuPrompt(plugin, context);
|
||||
return new QuestMenuPrompt(context);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1037,7 +1036,7 @@ public class QuestFactory implements ConversationAbandonedListener {
|
||||
deleteQuest(context);
|
||||
return Prompt.END_OF_CONVERSATION;
|
||||
} else if (input.equalsIgnoreCase("2") || input.equalsIgnoreCase(Lang.get("noWord"))) {
|
||||
return new QuestMenuPrompt(plugin, context);
|
||||
return new QuestMenuPrompt(context);
|
||||
} else {
|
||||
return new QuestConfirmDeletePrompt();
|
||||
}
|
||||
@ -1110,7 +1109,7 @@ public class QuestFactory implements ConversationAbandonedListener {
|
||||
context.setSessionData(CK.Q_NAME, input);
|
||||
names.add(input);
|
||||
}
|
||||
return new QuestMainPrompt(plugin, context);
|
||||
return new QuestMainPrompt(context);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1128,12 +1127,12 @@ public class QuestFactory implements ConversationAbandonedListener {
|
||||
if (context.getSessionData(CK.Q_ASK_MESSAGE) != null) {
|
||||
context.setSessionData(CK.Q_ASK_MESSAGE, context.getSessionData(CK.Q_ASK_MESSAGE) + " "
|
||||
+ input.substring(2));
|
||||
return new QuestMainPrompt(plugin, context);
|
||||
return new QuestMainPrompt(context);
|
||||
}
|
||||
}
|
||||
context.setSessionData(CK.Q_ASK_MESSAGE, input);
|
||||
}
|
||||
return new QuestMainPrompt(plugin, context);
|
||||
return new QuestMainPrompt(context);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1151,12 +1150,12 @@ public class QuestFactory implements ConversationAbandonedListener {
|
||||
if (context.getSessionData(CK.Q_FINISH_MESSAGE) != null) {
|
||||
context.setSessionData(CK.Q_FINISH_MESSAGE, context.getSessionData(CK.Q_FINISH_MESSAGE) + " "
|
||||
+ input.substring(2));
|
||||
return new QuestMainPrompt(plugin, context);
|
||||
return new QuestMainPrompt(context);
|
||||
}
|
||||
}
|
||||
context.setSessionData(CK.Q_FINISH_MESSAGE, input);
|
||||
}
|
||||
return new QuestMainPrompt(plugin, context);
|
||||
return new QuestMainPrompt(context);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1182,7 +1181,7 @@ public class QuestFactory implements ConversationAbandonedListener {
|
||||
}
|
||||
context.setSessionData(CK.Q_START_NPC, i);
|
||||
selectingNpcs.remove((Player) context.getForWhom());
|
||||
return new QuestMainPrompt(plugin, context);
|
||||
return new QuestMainPrompt(context);
|
||||
}
|
||||
} catch (NumberFormatException e) {
|
||||
context.getForWhom().sendRawMessage(ChatColor.RED
|
||||
@ -1193,7 +1192,7 @@ public class QuestFactory implements ConversationAbandonedListener {
|
||||
context.setSessionData(CK.Q_START_NPC, null);
|
||||
}
|
||||
selectingNpcs.remove((Player) context.getForWhom());
|
||||
return new QuestMainPrompt(plugin, context);
|
||||
return new QuestMainPrompt(context);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1221,11 +1220,11 @@ public class QuestFactory implements ConversationAbandonedListener {
|
||||
} else {
|
||||
selectedBlockStarts.remove(player.getUniqueId());
|
||||
}
|
||||
return new QuestMainPrompt(plugin, context);
|
||||
return new QuestMainPrompt(context);
|
||||
} else if (input.equalsIgnoreCase(Lang.get("cmdClear"))) {
|
||||
selectedBlockStarts.remove(player.getUniqueId());
|
||||
context.setSessionData(CK.Q_START_BLOCK, null);
|
||||
return new QuestMainPrompt(plugin, context);
|
||||
return new QuestMainPrompt(context);
|
||||
}
|
||||
return new BlockStartPrompt();
|
||||
}
|
||||
@ -1282,14 +1281,14 @@ public class QuestFactory implements ConversationAbandonedListener {
|
||||
return new RegionPrompt();
|
||||
} else {
|
||||
context.setSessionData(CK.Q_REGION, found);
|
||||
return new QuestMainPrompt(plugin, context);
|
||||
return new QuestMainPrompt(context);
|
||||
}
|
||||
} else if (input.equalsIgnoreCase(Lang.get("cmdClear"))) {
|
||||
context.setSessionData(CK.Q_REGION, null);
|
||||
player.sendMessage(ChatColor.YELLOW + Lang.get("questWGRegionCleared"));
|
||||
return new QuestMainPrompt(plugin, context);
|
||||
return new QuestMainPrompt(context);
|
||||
} else {
|
||||
return new QuestMainPrompt(plugin, context);
|
||||
return new QuestMainPrompt(context);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1317,7 +1316,7 @@ public class QuestFactory implements ConversationAbandonedListener {
|
||||
Action a = plugin.getAction(input);
|
||||
if (a != null) {
|
||||
context.setSessionData(CK.Q_INITIAL_EVENT, a.getName());
|
||||
return new QuestMainPrompt(plugin, context);
|
||||
return new QuestMainPrompt(context);
|
||||
}
|
||||
player.sendMessage(ChatColor.RED + input + ChatColor.YELLOW + " "
|
||||
+ Lang.get("questEditorInvalidEventName"));
|
||||
@ -1325,15 +1324,15 @@ public class QuestFactory implements ConversationAbandonedListener {
|
||||
} else if (input.equalsIgnoreCase(Lang.get("cmdClear"))) {
|
||||
context.setSessionData(CK.Q_INITIAL_EVENT, null);
|
||||
player.sendMessage(ChatColor.YELLOW + Lang.get("questEditorEventCleared"));
|
||||
return new QuestMainPrompt(plugin, context);
|
||||
return new QuestMainPrompt(context);
|
||||
} else {
|
||||
return new QuestMainPrompt(plugin, context);
|
||||
return new QuestMainPrompt(context);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public class SavePrompt extends QuestsEditorStringPrompt {
|
||||
public SavePrompt(Quests plugin, ConversationContext context) {
|
||||
public SavePrompt(ConversationContext context) {
|
||||
super(context);
|
||||
}
|
||||
|
||||
@ -1392,13 +1391,13 @@ public class QuestFactory implements ConversationAbandonedListener {
|
||||
if (input.equalsIgnoreCase("1") || input.equalsIgnoreCase(Lang.get("yesWord"))) {
|
||||
if (context.getSessionData(CK.Q_ASK_MESSAGE) == null) {
|
||||
context.getForWhom().sendRawMessage(ChatColor.RED + Lang.get("questEditorNeedAskMessage"));
|
||||
return new QuestMainPrompt(plugin, context);
|
||||
return new QuestMainPrompt(context);
|
||||
} else if (context.getSessionData(CK.Q_FINISH_MESSAGE) == null) {
|
||||
context.getForWhom().sendRawMessage(ChatColor.RED + Lang.get("questEditorNeedFinishMessage"));
|
||||
return new QuestMainPrompt(plugin, context);
|
||||
} else if (new StageMenuPrompt(plugin, context).getStages(context) == 0) {
|
||||
return new QuestMainPrompt(context);
|
||||
} else if (new StageMenuPrompt(context).getStages(context) == 0) {
|
||||
context.getForWhom().sendRawMessage(ChatColor.RED + Lang.get("questEditorNeedStages"));
|
||||
return new QuestMainPrompt(plugin, context);
|
||||
return new QuestMainPrompt(context);
|
||||
}
|
||||
FileConfiguration data = new YamlConfiguration();
|
||||
try {
|
||||
@ -1435,15 +1434,15 @@ public class QuestFactory implements ConversationAbandonedListener {
|
||||
}
|
||||
return Prompt.END_OF_CONVERSATION;
|
||||
} else if (input.equalsIgnoreCase("2") || input.equalsIgnoreCase(Lang.get("noWord"))) {
|
||||
return new QuestMainPrompt(plugin, context);
|
||||
return new QuestMainPrompt(context);
|
||||
} else {
|
||||
return new SavePrompt(plugin, context);
|
||||
return new SavePrompt(context);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public class ExitPrompt extends QuestsEditorStringPrompt {
|
||||
public ExitPrompt(Quests plugin, ConversationContext context) {
|
||||
public ExitPrompt(ConversationContext context) {
|
||||
super(context);
|
||||
}
|
||||
|
||||
@ -1502,9 +1501,9 @@ public class QuestFactory implements ConversationAbandonedListener {
|
||||
context.getForWhom().sendRawMessage(ChatColor.BOLD + "" + ChatColor.YELLOW + Lang.get("exited"));
|
||||
return Prompt.END_OF_CONVERSATION;
|
||||
} else if (input.equalsIgnoreCase("2") || input.equalsIgnoreCase(Lang.get("noWord"))) {
|
||||
return new QuestMainPrompt(plugin, context);
|
||||
return new QuestMainPrompt(context);
|
||||
} else {
|
||||
return new ExitPrompt(plugin, context);
|
||||
return new ExitPrompt(context);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1598,7 +1597,7 @@ public class QuestFactory implements ConversationAbandonedListener {
|
||||
ConfigurationSection stages = section.createSection("stages");
|
||||
ConfigurationSection ordered = stages.createSection("ordered");
|
||||
String pref;
|
||||
for (int i = 1; i <= new StageMenuPrompt(plugin, context).getStages(context); i++) {
|
||||
for (int i = 1; i <= new StageMenuPrompt(context).getStages(context); i++) {
|
||||
pref = "stage" + i;
|
||||
ConfigurationSection stage = ordered.createSection("" + i);
|
||||
stage.set("break-block-names", context.getSessionData(pref + CK.S_BREAK_NAMES) != null
|
||||
|
@ -65,20 +65,20 @@ import me.blackvein.quests.util.RomanNumeral;
|
||||
|
||||
public class ActionFactory implements ConversationAbandonedListener {
|
||||
|
||||
private Quests plugin;
|
||||
private final Quests plugin;
|
||||
private final ConversationFactory convoCreator;
|
||||
private Map<UUID, Block> selectedExplosionLocations = new HashMap<UUID, Block>();
|
||||
private Map<UUID, Block> selectedEffectLocations = new HashMap<UUID, Block>();
|
||||
private Map<UUID, Block> selectedMobLocations = new HashMap<UUID, Block>();
|
||||
private Map<UUID, Block> selectedLightningLocations = new HashMap<UUID, Block>();
|
||||
private Map<UUID, Block> selectedTeleportLocations = new HashMap<UUID, Block>();
|
||||
private List<String> names = new LinkedList<String>();
|
||||
private ConversationFactory convoCreator;
|
||||
|
||||
public ActionFactory(Quests plugin) {
|
||||
this.plugin = plugin;
|
||||
// Ensure to initialize convoCreator last so that 'this' is fully initialized before it is passed
|
||||
this.convoCreator = new ConversationFactory(plugin).withModality(false).withLocalEcho(false)
|
||||
.withPrefix(new QuestCreatorPrefix()).withFirstPrompt(new ActionMenuPrompt(plugin, null))
|
||||
.withPrefix(new QuestCreatorPrefix()).withFirstPrompt(new ActionMenuPrompt(null))
|
||||
.withTimeout(3600).thatExcludesNonPlayersWithMessage("Console may not perform this operation!")
|
||||
.addConversationAbandonedListener(this);
|
||||
}
|
||||
@ -149,7 +149,7 @@ public class ActionFactory implements ConversationAbandonedListener {
|
||||
}
|
||||
|
||||
public class ActionMenuPrompt extends ActionsEditorNumericPrompt {
|
||||
public ActionMenuPrompt(Quests plugin, ConversationContext context) {
|
||||
public ActionMenuPrompt(ConversationContext context) {
|
||||
super(context);
|
||||
}
|
||||
|
||||
@ -197,9 +197,8 @@ public class ActionFactory implements ConversationAbandonedListener {
|
||||
|
||||
@Override
|
||||
public String getPromptText(ConversationContext context) {
|
||||
/*ActionsEditorPostOpenNumericPromptEvent event
|
||||
= new ActionsEditorPostOpenNumericPromptEvent(context, ActionFactory.this, this);
|
||||
plugin.getServer().getPluginManager().callEvent(event);*/
|
||||
ActionsEditorPostOpenNumericPromptEvent event = new ActionsEditorPostOpenNumericPromptEvent(context, this);
|
||||
plugin.getServer().getPluginManager().callEvent(event);
|
||||
String text = ChatColor.GOLD + getTitle(context) + "\n";
|
||||
for (int i = 1; i <= size; i++) {
|
||||
text += getNumberColor(context, i) + "" + ChatColor.BOLD + i + ChatColor.RESET + " - "
|
||||
@ -219,7 +218,7 @@ public class ActionFactory implements ConversationAbandonedListener {
|
||||
return new ActionSelectCreatePrompt(context);
|
||||
} else {
|
||||
player.sendMessage(ChatColor.RED + Lang.get("noPermission"));
|
||||
return new ActionMenuPrompt(plugin, context);
|
||||
return new ActionMenuPrompt(context);
|
||||
}
|
||||
case 2:
|
||||
if (player.hasPermission("quests.editor.actions.edit")
|
||||
@ -227,13 +226,13 @@ public class ActionFactory implements ConversationAbandonedListener {
|
||||
if (plugin.getActions().isEmpty()) {
|
||||
((Player) context.getForWhom()).sendMessage(ChatColor.YELLOW
|
||||
+ Lang.get("eventEditorNoneToEdit"));
|
||||
return new ActionMenuPrompt(plugin, context);
|
||||
return new ActionMenuPrompt(context);
|
||||
} else {
|
||||
return new ActionSelectEditPrompt();
|
||||
}
|
||||
} else {
|
||||
player.sendMessage(ChatColor.RED + Lang.get("noPermission"));
|
||||
return new ActionMenuPrompt(plugin, context);
|
||||
return new ActionMenuPrompt(context);
|
||||
}
|
||||
case 3:
|
||||
if (player.hasPermission("quests.editor.actions.delete")
|
||||
@ -241,13 +240,13 @@ public class ActionFactory implements ConversationAbandonedListener {
|
||||
if (plugin.getActions().isEmpty()) {
|
||||
((Player) context.getForWhom()).sendMessage(ChatColor.YELLOW
|
||||
+ Lang.get("eventEditorNoneToDelete"));
|
||||
return new ActionMenuPrompt(plugin, context);
|
||||
return new ActionMenuPrompt(context);
|
||||
} else {
|
||||
return new ActionSelectDeletePrompt();
|
||||
}
|
||||
} else {
|
||||
player.sendMessage(ChatColor.RED + Lang.get("noPermission"));
|
||||
return new ActionMenuPrompt(plugin, context);
|
||||
return new ActionMenuPrompt(context);
|
||||
}
|
||||
case 4:
|
||||
((Player) context.getForWhom()).sendMessage(ChatColor.YELLOW + Lang.get("exited"));
|
||||
@ -486,7 +485,7 @@ public class ActionFactory implements ConversationAbandonedListener {
|
||||
names.add(input);
|
||||
return new ActionMainPrompt(context);
|
||||
} else {
|
||||
return new ActionMenuPrompt(plugin, context);
|
||||
return new ActionMenuPrompt(context);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -517,7 +516,7 @@ public class ActionFactory implements ConversationAbandonedListener {
|
||||
((Player) context.getForWhom()).sendMessage(ChatColor.RED + Lang.get("eventEditorNotFound"));
|
||||
return new ActionSelectEditPrompt();
|
||||
} else {
|
||||
return new ActionMenuPrompt(plugin, context);
|
||||
return new ActionMenuPrompt(context);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -661,7 +660,7 @@ public class ActionFactory implements ConversationAbandonedListener {
|
||||
((Player) context.getForWhom()).sendMessage(ChatColor.RED + Lang.get("eventEditorNotFound"));
|
||||
return new ActionSelectDeletePrompt();
|
||||
} else {
|
||||
return new ActionMenuPrompt(plugin, context);
|
||||
return new ActionMenuPrompt(context);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -682,9 +681,9 @@ public class ActionFactory implements ConversationAbandonedListener {
|
||||
public Prompt acceptInput(ConversationContext context, String input) {
|
||||
if (input.equalsIgnoreCase("1") || input.equalsIgnoreCase(Lang.get("yesWord"))) {
|
||||
deleteAction(context);
|
||||
return new ActionMenuPrompt(plugin, context);
|
||||
return new ActionMenuPrompt(context);
|
||||
} else if (input.equalsIgnoreCase("2") || input.equalsIgnoreCase(Lang.get("noWord"))) {
|
||||
return new ActionMenuPrompt(plugin, context);
|
||||
return new ActionMenuPrompt(context);
|
||||
} else {
|
||||
return new ActionConfirmDeletePrompt();
|
||||
}
|
||||
@ -1034,7 +1033,7 @@ public class ActionFactory implements ConversationAbandonedListener {
|
||||
public Prompt acceptInput(ConversationContext context, String input) {
|
||||
if (input.equalsIgnoreCase("1") || input.equalsIgnoreCase(Lang.get("yesWord"))) {
|
||||
saveAction(context);
|
||||
return new ActionMenuPrompt(plugin, context);
|
||||
return new ActionMenuPrompt(context);
|
||||
} else if (input.equalsIgnoreCase("2") || input.equalsIgnoreCase(Lang.get("noWord"))) {
|
||||
return new ActionMainPrompt(context);
|
||||
} else {
|
||||
|
@ -25,7 +25,9 @@ public abstract class ActionsEditorNumericPrompt extends QuestsNumericPrompt {
|
||||
|
||||
public ActionsEditorNumericPrompt(final ConversationContext context) {
|
||||
this.context = context;
|
||||
this.factory = ((Quests)context.getPlugin()).getActionFactory();
|
||||
if (context != null) {
|
||||
this.factory = ((Quests)context.getPlugin()).getActionFactory();
|
||||
}
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
|
@ -24,7 +24,9 @@ public abstract class ActionsEditorStringPrompt extends QuestsStringPrompt {
|
||||
|
||||
public ActionsEditorStringPrompt(final ConversationContext context) {
|
||||
this.context = context;
|
||||
this.factory = ((Quests)context.getPlugin()).getActionFactory();
|
||||
if (context != null) {
|
||||
this.factory = ((Quests)context.getPlugin()).getActionFactory();
|
||||
}
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
|
@ -25,7 +25,9 @@ public abstract class QuestsEditorNumericPrompt extends QuestsNumericPrompt {
|
||||
|
||||
public QuestsEditorNumericPrompt(final ConversationContext context) {
|
||||
this.context = context;
|
||||
factory = ((Quests)context.getPlugin()).getQuestFactory();
|
||||
if (context != null) {
|
||||
factory = ((Quests)context.getPlugin()).getQuestFactory();
|
||||
}
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
|
@ -24,7 +24,9 @@ public abstract class QuestsEditorStringPrompt extends QuestsStringPrompt {
|
||||
|
||||
public QuestsEditorStringPrompt(final ConversationContext context) {
|
||||
this.context = context;
|
||||
factory = ((Quests)context.getPlugin()).getQuestFactory();
|
||||
if (context != null) {
|
||||
factory = ((Quests)context.getPlugin()).getQuestFactory();
|
||||
}
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
|
@ -15,7 +15,6 @@ package me.blackvein.quests.convo.quests.prompts;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
|
||||
import me.blackvein.quests.Quests;
|
||||
import me.blackvein.quests.convo.quests.QuestsEditorNumericPrompt;
|
||||
import me.blackvein.quests.events.editor.quests.QuestsEditorPostOpenNumericPromptEvent;
|
||||
import me.blackvein.quests.util.CK;
|
||||
@ -30,13 +29,11 @@ import org.bukkit.conversations.Prompt;
|
||||
import org.bukkit.conversations.StringPrompt;
|
||||
|
||||
public class BlocksPrompt extends QuestsEditorNumericPrompt {
|
||||
private final Quests plugin;
|
||||
private final int stageNum;
|
||||
private final String pref;
|
||||
|
||||
public BlocksPrompt(Quests plugin, int stageNum, ConversationContext context) {
|
||||
public BlocksPrompt(int stageNum, ConversationContext context) {
|
||||
super(context);
|
||||
this.plugin = plugin;
|
||||
this.stageNum = stageNum;
|
||||
this.pref = "stage" + stageNum;
|
||||
}
|
||||
@ -191,7 +188,7 @@ public class BlocksPrompt extends QuestsEditorNumericPrompt {
|
||||
return new CutBlockListPrompt();
|
||||
case 6:
|
||||
try {
|
||||
return new StageMainPrompt(plugin, stageNum, context);
|
||||
return new StageMainPrompt(stageNum, context);
|
||||
} catch (Exception e) {
|
||||
context.getForWhom().sendRawMessage(ChatColor.RED + Lang.get("itemCreateCriticalError"));
|
||||
return Prompt.END_OF_CONVERSATION;
|
||||
@ -307,7 +304,7 @@ public class BlocksPrompt extends QuestsEditorNumericPrompt {
|
||||
elements.add((short) 0);
|
||||
}
|
||||
context.setSessionData(pref + CK.S_BREAK_DURABILITY, elements);
|
||||
return new BlocksPrompt(plugin, stageNum, context);
|
||||
return new BlocksPrompt(stageNum, context);
|
||||
} else {
|
||||
context.getForWhom().sendRawMessage(ChatColor.RED + Lang.get("listsNotSameSize"));
|
||||
return new BreakBlockListPrompt();
|
||||
@ -544,7 +541,7 @@ public class BlocksPrompt extends QuestsEditorNumericPrompt {
|
||||
elements.add((short) 0);
|
||||
}
|
||||
context.setSessionData(pref + CK.S_DAMAGE_DURABILITY, elements);
|
||||
return new BlocksPrompt(plugin, stageNum, context);
|
||||
return new BlocksPrompt(stageNum, context);
|
||||
} else {
|
||||
context.getForWhom().sendRawMessage(ChatColor.RED + Lang.get("listsNotSameSize"));
|
||||
return new DamageBlockListPrompt();
|
||||
@ -781,7 +778,7 @@ public class BlocksPrompt extends QuestsEditorNumericPrompt {
|
||||
elements.add((short) 0);
|
||||
}
|
||||
context.setSessionData(pref + CK.S_PLACE_DURABILITY, elements);
|
||||
return new BlocksPrompt(plugin, stageNum, context);
|
||||
return new BlocksPrompt(stageNum, context);
|
||||
} else {
|
||||
context.getForWhom().sendRawMessage(ChatColor.RED + Lang.get("listsNotSameSize"));
|
||||
return new PlaceBlockListPrompt();
|
||||
@ -1018,7 +1015,7 @@ public class BlocksPrompt extends QuestsEditorNumericPrompt {
|
||||
elements.add((short) 0);
|
||||
}
|
||||
context.setSessionData(pref + CK.S_USE_DURABILITY, elements);
|
||||
return new BlocksPrompt(plugin, stageNum, context);
|
||||
return new BlocksPrompt(stageNum, context);
|
||||
} else {
|
||||
context.getForWhom().sendRawMessage(ChatColor.RED + Lang.get("listsNotSameSize"));
|
||||
return new UseBlockListPrompt();
|
||||
@ -1255,7 +1252,7 @@ public class BlocksPrompt extends QuestsEditorNumericPrompt {
|
||||
elements.add((short) 0);
|
||||
}
|
||||
context.setSessionData(pref + CK.S_CUT_DURABILITY, elements);
|
||||
return new BlocksPrompt(plugin, stageNum, context);
|
||||
return new BlocksPrompt(stageNum, context);
|
||||
} else {
|
||||
context.getForWhom().sendRawMessage(ChatColor.RED + Lang.get("listsNotSameSize"));
|
||||
return new CutBlockListPrompt();
|
||||
|
@ -16,9 +16,9 @@ import me.blackvein.quests.util.Lang;
|
||||
public class GUIDisplayPrompt extends QuestsEditorNumericPrompt {
|
||||
private final Quests plugin;
|
||||
|
||||
public GUIDisplayPrompt(Quests plugin, ConversationContext context) {
|
||||
public GUIDisplayPrompt(ConversationContext context) {
|
||||
super(context);
|
||||
this.plugin = plugin;
|
||||
this.plugin = (Quests)context.getPlugin();
|
||||
}
|
||||
|
||||
private final int size = 3;
|
||||
@ -63,9 +63,8 @@ public class GUIDisplayPrompt extends QuestsEditorNumericPrompt {
|
||||
|
||||
@Override
|
||||
public String getPromptText(ConversationContext context) {
|
||||
QuestsEditorPostOpenNumericPromptEvent event
|
||||
= new QuestsEditorPostOpenNumericPromptEvent(context, this);
|
||||
plugin.getServer().getPluginManager().callEvent(event);
|
||||
QuestsEditorPostOpenNumericPromptEvent event = new QuestsEditorPostOpenNumericPromptEvent(context, this);
|
||||
context.getPlugin().getServer().getPluginManager().callEvent(event);
|
||||
|
||||
if (context.getSessionData("tempStack") != null) {
|
||||
ItemStack stack = (ItemStack) context.getSessionData("tempStack");
|
||||
@ -108,7 +107,7 @@ public class GUIDisplayPrompt extends QuestsEditorNumericPrompt {
|
||||
case 2:
|
||||
context.setSessionData(CK.Q_GUIDISPLAY, null);
|
||||
context.getForWhom().sendRawMessage(ChatColor.YELLOW + Lang.get("questGUICleared"));
|
||||
return new GUIDisplayPrompt(plugin, context);
|
||||
return new GUIDisplayPrompt(context);
|
||||
case 3:
|
||||
return plugin.getQuestFactory().returnToMenu(context);
|
||||
default:
|
||||
|
@ -15,7 +15,6 @@ package me.blackvein.quests.convo.quests.prompts;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
|
||||
import me.blackvein.quests.Quests;
|
||||
import me.blackvein.quests.util.CK;
|
||||
import me.blackvein.quests.util.ItemUtil;
|
||||
import me.blackvein.quests.util.Lang;
|
||||
@ -31,13 +30,11 @@ import org.bukkit.enchantments.Enchantment;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
public class ItemsPrompt extends FixedSetPrompt {
|
||||
private final Quests plugin;
|
||||
private final int stageNum;
|
||||
private final String pref;
|
||||
|
||||
public ItemsPrompt(Quests plugin, int stageNum) {
|
||||
public ItemsPrompt(int stageNum) {
|
||||
super("1", "2", "3", "4", "5");
|
||||
this.plugin = plugin;
|
||||
this.stageNum = stageNum;
|
||||
this.pref = "stage" + stageNum;
|
||||
}
|
||||
@ -130,7 +127,7 @@ public class ItemsPrompt extends FixedSetPrompt {
|
||||
return new BrewListPrompt();
|
||||
}
|
||||
try {
|
||||
return new StageMainPrompt(plugin, stageNum, context);
|
||||
return new StageMainPrompt(stageNum, context);
|
||||
} catch (Exception e) {
|
||||
context.getForWhom().sendRawMessage(ChatColor.RED + Lang.get("itemCreateCriticalError"));
|
||||
return Prompt.END_OF_CONVERSATION;
|
||||
@ -187,7 +184,7 @@ public class ItemsPrompt extends FixedSetPrompt {
|
||||
context.setSessionData(pref + CK.S_CRAFT_ITEMS, null);
|
||||
return new CraftListPrompt();
|
||||
} else if (input.equalsIgnoreCase("3")) {
|
||||
return new ItemsPrompt(plugin, stageNum);
|
||||
return new ItemsPrompt(stageNum);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
@ -248,7 +245,7 @@ public class ItemsPrompt extends FixedSetPrompt {
|
||||
context.setSessionData(pref + CK.S_SMELT_ITEMS, null);
|
||||
return new SmeltListPrompt();
|
||||
} else if (input.equalsIgnoreCase("3")) {
|
||||
return new ItemsPrompt(plugin, stageNum);
|
||||
return new ItemsPrompt(stageNum);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
@ -358,7 +355,7 @@ public class ItemsPrompt extends FixedSetPrompt {
|
||||
three = 0;
|
||||
}
|
||||
if (one == two && two == three) {
|
||||
return new ItemsPrompt(plugin, stageNum);
|
||||
return new ItemsPrompt(stageNum);
|
||||
} else {
|
||||
context.getForWhom().sendRawMessage(ChatColor.RED + Lang.get("listsNotSameSize"));
|
||||
return new EnchantmentListPrompt();
|
||||
@ -546,7 +543,7 @@ public class ItemsPrompt extends FixedSetPrompt {
|
||||
context.setSessionData(pref + CK.S_BREW_ITEMS, null);
|
||||
return new BrewListPrompt();
|
||||
} else if (input.equalsIgnoreCase("3")) {
|
||||
return new ItemsPrompt(plugin, stageNum);
|
||||
return new ItemsPrompt(stageNum);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
@ -41,9 +41,9 @@ public class MobsPrompt extends FixedSetPrompt {
|
||||
private final int stageNum;
|
||||
private final String pref;
|
||||
|
||||
public MobsPrompt(Quests plugin, int stageNum) {
|
||||
public MobsPrompt(int stageNum, ConversationContext context) {
|
||||
super("1", "2", "3", "4", "5", "6");
|
||||
this.plugin = plugin;
|
||||
this.plugin = (Quests)context.getPlugin();
|
||||
this.stageNum = stageNum;
|
||||
this.pref = "stage" + stageNum;
|
||||
}
|
||||
@ -146,7 +146,7 @@ public class MobsPrompt extends FixedSetPrompt {
|
||||
return new ShearListPrompt();
|
||||
}
|
||||
try {
|
||||
return new StageMainPrompt(plugin, stageNum, context);
|
||||
return new StageMainPrompt(stageNum, context);
|
||||
} catch (Exception e) {
|
||||
context.getForWhom().sendRawMessage(ChatColor.RED + Lang.get("itemCreateCriticalError"));
|
||||
return Prompt.END_OF_CONVERSATION;
|
||||
@ -310,13 +310,13 @@ public class MobsPrompt extends FixedSetPrompt {
|
||||
if (one == two) {
|
||||
if (three != 0 || four != 0 || five != 0) {
|
||||
if (two == three && three == four && four == five) {
|
||||
return new StageMainPrompt(plugin, stageNum, context);
|
||||
return new StageMainPrompt(stageNum, context);
|
||||
} else {
|
||||
context.getForWhom().sendRawMessage(ChatColor.RED + Lang.get("listsNotSameSize"));
|
||||
return new MobListPrompt();
|
||||
}
|
||||
} else {
|
||||
return new StageMainPrompt(plugin, stageNum, context);
|
||||
return new StageMainPrompt(stageNum, context);
|
||||
}
|
||||
} else {
|
||||
context.getForWhom().sendRawMessage(ChatColor.RED + Lang.get("listsNotSameSize"));
|
||||
@ -548,7 +548,7 @@ public class MobsPrompt extends FixedSetPrompt {
|
||||
} else if (input.equalsIgnoreCase(Lang.get("cmdClear"))) {
|
||||
context.setSessionData(pref + CK.S_FISH, null);
|
||||
}
|
||||
return new StageMainPrompt(plugin, stageNum, context);
|
||||
return new StageMainPrompt(stageNum, context);
|
||||
}
|
||||
}
|
||||
|
||||
@ -579,7 +579,7 @@ public class MobsPrompt extends FixedSetPrompt {
|
||||
} else if (input.equalsIgnoreCase(Lang.get("cmdClear"))) {
|
||||
context.setSessionData(pref + CK.S_COW_MILK, null);
|
||||
}
|
||||
return new StageMainPrompt(plugin, stageNum, context);
|
||||
return new StageMainPrompt(stageNum, context);
|
||||
}
|
||||
}
|
||||
|
||||
@ -656,7 +656,7 @@ public class MobsPrompt extends FixedSetPrompt {
|
||||
two = 0;
|
||||
}
|
||||
if (one == two) {
|
||||
return new StageMainPrompt(plugin, stageNum, context);
|
||||
return new StageMainPrompt(stageNum, context);
|
||||
} else {
|
||||
context.getForWhom().sendRawMessage(ChatColor.RED + Lang.get("listsNotSameSize"));
|
||||
return new TameListPrompt();
|
||||
@ -826,7 +826,7 @@ public class MobsPrompt extends FixedSetPrompt {
|
||||
two = 0;
|
||||
}
|
||||
if (one == two) {
|
||||
return new StageMainPrompt(plugin, stageNum, context);
|
||||
return new StageMainPrompt(stageNum, context);
|
||||
} else {
|
||||
context.getForWhom().sendRawMessage(ChatColor.RED + Lang.get("listsNotSameSize"));
|
||||
return new ShearListPrompt();
|
||||
|
@ -35,9 +35,9 @@ public class NPCsPrompt extends FixedSetPrompt {
|
||||
private final int stageNum;
|
||||
private final String pref;
|
||||
|
||||
public NPCsPrompt(Quests plugin, int stageNum) {
|
||||
public NPCsPrompt(int stageNum, ConversationContext context) {
|
||||
super("1", "2", "3", "4");
|
||||
this.plugin = plugin;
|
||||
this.plugin = (Quests)context.getPlugin();
|
||||
this.stageNum = stageNum;
|
||||
this.pref = "stage" + stageNum;
|
||||
}
|
||||
@ -124,25 +124,25 @@ public class NPCsPrompt extends FixedSetPrompt {
|
||||
return new DeliveryListPrompt();
|
||||
} else {
|
||||
context.getForWhom().sendRawMessage(ChatColor.RED + Lang.get("stageEditorNoCitizens"));
|
||||
return new StageMainPrompt(plugin, stageNum, context);
|
||||
return new StageMainPrompt(stageNum, context);
|
||||
}
|
||||
} else if (input.equalsIgnoreCase("2")) {
|
||||
if (plugin.getDependencies().getCitizens() != null) {
|
||||
return new NPCIDsToTalkToPrompt();
|
||||
} else {
|
||||
context.getForWhom().sendRawMessage(ChatColor.RED + Lang.get("stageEditorNoCitizens"));
|
||||
return new StageMainPrompt(plugin, stageNum, context);
|
||||
return new StageMainPrompt(stageNum, context);
|
||||
}
|
||||
} else if (input.equalsIgnoreCase("3")) {
|
||||
if (plugin.getDependencies().getCitizens() != null) {
|
||||
return new NPCKillListPrompt();
|
||||
} else {
|
||||
context.getForWhom().sendRawMessage(ChatColor.RED + Lang.get("stageEditorNoCitizens"));
|
||||
return new StageMainPrompt(plugin, stageNum, context);
|
||||
return new StageMainPrompt(stageNum, context);
|
||||
}
|
||||
}
|
||||
try {
|
||||
return new StageMainPrompt(plugin, stageNum, context);
|
||||
return new StageMainPrompt(stageNum, context);
|
||||
} catch (Exception e) {
|
||||
context.getForWhom().sendRawMessage(ChatColor.RED + Lang.get("itemCreateCriticalError"));
|
||||
return Prompt.END_OF_CONVERSATION;
|
||||
@ -261,7 +261,7 @@ public class NPCsPrompt extends FixedSetPrompt {
|
||||
context.getForWhom().sendRawMessage(ChatColor.RED + Lang.get("stageEditorNoDeliveryMessage"));
|
||||
return new DeliveryListPrompt();
|
||||
} else {
|
||||
return new NPCsPrompt(plugin, stageNum);
|
||||
return new NPCsPrompt(stageNum, context);
|
||||
}
|
||||
} else {
|
||||
context.getForWhom().sendRawMessage(ChatColor.RED + Lang.get("listsNotSameSize"));
|
||||
@ -387,7 +387,7 @@ public class NPCsPrompt extends FixedSetPrompt {
|
||||
} else if (input.equalsIgnoreCase(Lang.get("cmdClear"))) {
|
||||
context.setSessionData(pref + CK.S_NPCS_TO_TALK_TO, null);
|
||||
}
|
||||
return new StageMainPrompt(plugin, stageNum, context);
|
||||
return new StageMainPrompt(stageNum, context);
|
||||
}
|
||||
}
|
||||
|
||||
@ -466,7 +466,7 @@ public class NPCsPrompt extends FixedSetPrompt {
|
||||
two = 0;
|
||||
}
|
||||
if (one == two) {
|
||||
return new StageMainPrompt(plugin, stageNum, context);
|
||||
return new StageMainPrompt(stageNum, context);
|
||||
} else {
|
||||
context.getForWhom().sendRawMessage(ChatColor.RED + Lang.get("listsNotSameSize"));
|
||||
return new NPCKillListPrompt();
|
||||
|
@ -31,9 +31,9 @@ public class OptionsPrompt extends QuestsEditorNumericPrompt {
|
||||
private String tempKey;
|
||||
private Prompt tempPrompt;
|
||||
|
||||
public OptionsPrompt(Quests plugin, ConversationContext context) {
|
||||
public OptionsPrompt(ConversationContext context) {
|
||||
super(context);
|
||||
this.plugin = plugin;
|
||||
this.plugin = (Quests)context.getPlugin();
|
||||
}
|
||||
|
||||
private final int size = 3;
|
||||
@ -83,9 +83,8 @@ public class OptionsPrompt extends QuestsEditorNumericPrompt {
|
||||
|
||||
@Override
|
||||
public String getPromptText(ConversationContext context) {
|
||||
QuestsEditorPostOpenNumericPromptEvent event
|
||||
= new QuestsEditorPostOpenNumericPromptEvent(context, this);
|
||||
plugin.getServer().getPluginManager().callEvent(event);
|
||||
QuestsEditorPostOpenNumericPromptEvent event = new QuestsEditorPostOpenNumericPromptEvent(context, this);
|
||||
context.getPlugin().getServer().getPluginManager().callEvent(event);
|
||||
|
||||
String text = ChatColor.DARK_GREEN + getTitle(context)
|
||||
.replace((String) context.getSessionData(CK.Q_NAME), ChatColor.AQUA
|
||||
@ -101,9 +100,9 @@ public class OptionsPrompt extends QuestsEditorNumericPrompt {
|
||||
protected Prompt acceptValidatedInput(ConversationContext context, Number input) {
|
||||
switch (input.intValue()) {
|
||||
case 1:
|
||||
return new GeneralPrompt(plugin, context);
|
||||
return new GeneralPrompt(context);
|
||||
case 2:
|
||||
return new MultiplayerPrompt(plugin, context);
|
||||
return new MultiplayerPrompt(context);
|
||||
case 3:
|
||||
return plugin.getQuestFactory().returnToMenu(context);
|
||||
default:
|
||||
@ -112,7 +111,7 @@ public class OptionsPrompt extends QuestsEditorNumericPrompt {
|
||||
}
|
||||
|
||||
public class TrueFalsePrompt extends QuestsEditorStringPrompt {
|
||||
public TrueFalsePrompt(Quests plugin, ConversationContext context) {
|
||||
public TrueFalsePrompt(ConversationContext context) {
|
||||
super(context);
|
||||
}
|
||||
|
||||
@ -152,9 +151,8 @@ public class OptionsPrompt extends QuestsEditorNumericPrompt {
|
||||
|
||||
@Override
|
||||
public String getPromptText(ConversationContext context) {
|
||||
QuestsEditorPostOpenStringPromptEvent event
|
||||
= new QuestsEditorPostOpenStringPromptEvent(context, this);
|
||||
plugin.getServer().getPluginManager().callEvent(event);
|
||||
QuestsEditorPostOpenStringPromptEvent event = new QuestsEditorPostOpenStringPromptEvent(context, this);
|
||||
context.getPlugin().getServer().getPluginManager().callEvent(event);
|
||||
|
||||
String text = Lang.get("optBooleanPrompt");
|
||||
text = text.replace("<true>", Lang.get("true"));
|
||||
@ -174,7 +172,7 @@ public class OptionsPrompt extends QuestsEditorNumericPrompt {
|
||||
context.setSessionData(tempKey, false);
|
||||
} else {
|
||||
context.getForWhom().sendRawMessage(ChatColor.RED + Lang.get("itemCreateInvalidInput"));
|
||||
return new TrueFalsePrompt(plugin, context);
|
||||
return new TrueFalsePrompt(context);
|
||||
}
|
||||
} else if (input.equalsIgnoreCase(Lang.get("cmdClear"))) {
|
||||
context.setSessionData(tempKey, null);
|
||||
@ -185,7 +183,7 @@ public class OptionsPrompt extends QuestsEditorNumericPrompt {
|
||||
}
|
||||
|
||||
public class LevelPrompt extends QuestsEditorStringPrompt {
|
||||
public LevelPrompt(Quests plugin, ConversationContext context) {
|
||||
public LevelPrompt(ConversationContext context) {
|
||||
super(context);
|
||||
}
|
||||
|
||||
@ -245,9 +243,8 @@ public class OptionsPrompt extends QuestsEditorNumericPrompt {
|
||||
|
||||
@Override
|
||||
public String getPromptText(ConversationContext context) {
|
||||
QuestsEditorPostOpenStringPromptEvent event
|
||||
= new QuestsEditorPostOpenStringPromptEvent(context, this);
|
||||
plugin.getServer().getPluginManager().callEvent(event);
|
||||
QuestsEditorPostOpenStringPromptEvent event = new QuestsEditorPostOpenStringPromptEvent(context, this);
|
||||
context.getPlugin().getServer().getPluginManager().callEvent(event);
|
||||
|
||||
String text = Lang.get("optNumberPrompt");
|
||||
text += "\n" + ChatColor.GRAY + "\u2515 " + ChatColor.GOLD + "1" + ChatColor.RESET + " = " + ChatColor.GRAY
|
||||
@ -281,7 +278,7 @@ public class OptionsPrompt extends QuestsEditorNumericPrompt {
|
||||
}
|
||||
|
||||
public class GeneralPrompt extends QuestsEditorNumericPrompt {
|
||||
public GeneralPrompt(Quests plugin, ConversationContext context) {
|
||||
public GeneralPrompt(ConversationContext context) {
|
||||
super(context);
|
||||
}
|
||||
|
||||
@ -361,9 +358,8 @@ public class OptionsPrompt extends QuestsEditorNumericPrompt {
|
||||
|
||||
@Override
|
||||
public String getPromptText(ConversationContext context) {
|
||||
QuestsEditorPostOpenNumericPromptEvent event
|
||||
= new QuestsEditorPostOpenNumericPromptEvent(context, this);
|
||||
plugin.getServer().getPluginManager().callEvent(event);
|
||||
QuestsEditorPostOpenNumericPromptEvent event = new QuestsEditorPostOpenNumericPromptEvent(context, this);
|
||||
context.getPlugin().getServer().getPluginManager().callEvent(event);
|
||||
|
||||
String text = ChatColor.DARK_GREEN + "- " + getTitle(context) + " -\n";
|
||||
for (int i = 1; i <= size; i++) {
|
||||
@ -378,17 +374,17 @@ public class OptionsPrompt extends QuestsEditorNumericPrompt {
|
||||
switch (input.intValue()) {
|
||||
case 1:
|
||||
tempKey = CK.OPT_ALLOW_COMMANDS;
|
||||
tempPrompt = new GeneralPrompt(plugin, context);
|
||||
return new TrueFalsePrompt(plugin, context);
|
||||
tempPrompt = new GeneralPrompt(context);
|
||||
return new TrueFalsePrompt(context);
|
||||
case 2:
|
||||
tempKey = CK.OPT_ALLOW_QUITTING;
|
||||
tempPrompt = new GeneralPrompt(plugin, context);
|
||||
return new TrueFalsePrompt(plugin, context);
|
||||
tempPrompt = new GeneralPrompt(context);
|
||||
return new TrueFalsePrompt(context);
|
||||
case 3:
|
||||
tempKey = null;
|
||||
tempPrompt = null;
|
||||
try {
|
||||
return new OptionsPrompt(plugin, context);
|
||||
return new OptionsPrompt(context);
|
||||
} catch (Exception e) {
|
||||
context.getForWhom().sendRawMessage(ChatColor.RED + Lang.get("itemCreateCriticalError"));
|
||||
return Prompt.END_OF_CONVERSATION;
|
||||
@ -400,7 +396,7 @@ public class OptionsPrompt extends QuestsEditorNumericPrompt {
|
||||
}
|
||||
|
||||
public class MultiplayerPrompt extends QuestsEditorNumericPrompt {
|
||||
public MultiplayerPrompt(Quests plugin, ConversationContext context) {
|
||||
public MultiplayerPrompt(ConversationContext context) {
|
||||
super(context);
|
||||
}
|
||||
|
||||
@ -508,9 +504,8 @@ public class OptionsPrompt extends QuestsEditorNumericPrompt {
|
||||
|
||||
@Override
|
||||
public String getPromptText(ConversationContext context) {
|
||||
QuestsEditorPostOpenNumericPromptEvent event
|
||||
= new QuestsEditorPostOpenNumericPromptEvent(context, this);
|
||||
plugin.getServer().getPluginManager().callEvent(event);
|
||||
QuestsEditorPostOpenNumericPromptEvent event = new QuestsEditorPostOpenNumericPromptEvent(context, this);
|
||||
context.getPlugin().getServer().getPluginManager().callEvent(event);
|
||||
|
||||
String text = ChatColor.DARK_GREEN + "- " + getTitle(context) + " -\n";
|
||||
for (int i = 1; i <= size; i++) {
|
||||
@ -525,25 +520,25 @@ public class OptionsPrompt extends QuestsEditorNumericPrompt {
|
||||
switch (input.intValue()) {
|
||||
case 1:
|
||||
tempKey = CK.OPT_USE_DUNGEONSXL_PLUGIN;
|
||||
tempPrompt = new MultiplayerPrompt(plugin, context);
|
||||
return new TrueFalsePrompt(plugin, context);
|
||||
tempPrompt = new MultiplayerPrompt(context);
|
||||
return new TrueFalsePrompt(context);
|
||||
case 2:
|
||||
tempKey = CK.OPT_USE_PARTIES_PLUGIN;
|
||||
tempPrompt = new MultiplayerPrompt(plugin, context);
|
||||
return new TrueFalsePrompt(plugin, context);
|
||||
tempPrompt = new MultiplayerPrompt(context);
|
||||
return new TrueFalsePrompt(context);
|
||||
case 3:
|
||||
tempKey = CK.OPT_SHARE_PROGRESS_LEVEL;
|
||||
tempPrompt = new MultiplayerPrompt(plugin, context);
|
||||
return new LevelPrompt(plugin, context);
|
||||
tempPrompt = new MultiplayerPrompt(context);
|
||||
return new LevelPrompt(context);
|
||||
case 4:
|
||||
tempKey = CK.OPT_REQUIRE_SAME_QUEST;
|
||||
tempPrompt = new MultiplayerPrompt(plugin, context);
|
||||
return new TrueFalsePrompt(plugin, context);
|
||||
tempPrompt = new MultiplayerPrompt(context);
|
||||
return new TrueFalsePrompt(context);
|
||||
case 5:
|
||||
tempKey = null;
|
||||
tempPrompt = null;
|
||||
try {
|
||||
return new OptionsPrompt(plugin, context);
|
||||
return new OptionsPrompt(context);
|
||||
} catch (Exception e) {
|
||||
context.getForWhom().sendRawMessage(ChatColor.RED + Lang.get("itemCreateCriticalError"));
|
||||
return Prompt.END_OF_CONVERSATION;
|
||||
|
@ -34,9 +34,9 @@ public class PlannerPrompt extends QuestsEditorNumericPrompt {
|
||||
|
||||
private final Quests plugin;
|
||||
|
||||
public PlannerPrompt(Quests plugin, ConversationContext context) {
|
||||
public PlannerPrompt(ConversationContext context) {
|
||||
super(context);
|
||||
this.plugin = plugin;
|
||||
this.plugin = (Quests)context.getPlugin();
|
||||
}
|
||||
|
||||
private final int size = 5;
|
||||
@ -134,9 +134,8 @@ public class PlannerPrompt extends QuestsEditorNumericPrompt {
|
||||
|
||||
@Override
|
||||
public String getPromptText(ConversationContext context) {
|
||||
QuestsEditorPostOpenNumericPromptEvent event
|
||||
= new QuestsEditorPostOpenNumericPromptEvent(context, this);
|
||||
plugin.getServer().getPluginManager().callEvent(event);
|
||||
QuestsEditorPostOpenNumericPromptEvent event = new QuestsEditorPostOpenNumericPromptEvent(context, this);
|
||||
context.getPlugin().getServer().getPluginManager().callEvent(event);
|
||||
|
||||
String text = ChatColor.DARK_AQUA + getTitle(context).replace((String) context
|
||||
.getSessionData(CK.Q_NAME), ChatColor.AQUA + (String) context.getSessionData(CK.Q_NAME)
|
||||
@ -160,7 +159,7 @@ public class PlannerPrompt extends QuestsEditorNumericPrompt {
|
||||
return new RepeatPrompt();
|
||||
} else {
|
||||
context.getForWhom().sendRawMessage(ChatColor.RED + Lang.get("invalidOption"));
|
||||
return new PlannerPrompt(plugin, context);
|
||||
return new PlannerPrompt(context);
|
||||
}
|
||||
case 4:
|
||||
return new CooldownPrompt();
|
||||
@ -181,11 +180,11 @@ public class PlannerPrompt extends QuestsEditorNumericPrompt {
|
||||
@Override
|
||||
public Prompt acceptInput(ConversationContext context, String input) {
|
||||
if (input.equalsIgnoreCase(Lang.get("cmdCancel"))) {
|
||||
return new PlannerPrompt(plugin, context);
|
||||
return new PlannerPrompt(context);
|
||||
}
|
||||
if (input.equalsIgnoreCase(Lang.get("cmdClear"))) {
|
||||
context.setSessionData(CK.PLN_REPEAT_CYCLE, null);
|
||||
return new PlannerPrompt(plugin, context);
|
||||
return new PlannerPrompt(context);
|
||||
}
|
||||
long delay;
|
||||
try {
|
||||
@ -201,7 +200,7 @@ public class PlannerPrompt extends QuestsEditorNumericPrompt {
|
||||
.replace("<input>", input));
|
||||
return new RepeatPrompt();
|
||||
}
|
||||
return new PlannerPrompt(plugin, context);
|
||||
return new PlannerPrompt(context);
|
||||
}
|
||||
}
|
||||
|
||||
@ -215,11 +214,11 @@ public class PlannerPrompt extends QuestsEditorNumericPrompt {
|
||||
@Override
|
||||
public Prompt acceptInput(ConversationContext context, String input) {
|
||||
if (input.equalsIgnoreCase(Lang.get("cmdCancel"))) {
|
||||
return new PlannerPrompt(plugin, context);
|
||||
return new PlannerPrompt(context);
|
||||
}
|
||||
if (input.equalsIgnoreCase(Lang.get("cmdClear"))) {
|
||||
context.setSessionData(CK.PLN_COOLDOWN, null);
|
||||
return new PlannerPrompt(plugin, context);
|
||||
return new PlannerPrompt(context);
|
||||
}
|
||||
long delay;
|
||||
try {
|
||||
@ -235,7 +234,7 @@ public class PlannerPrompt extends QuestsEditorNumericPrompt {
|
||||
.replace("<input>", input));
|
||||
return new CooldownPrompt();
|
||||
}
|
||||
return new PlannerPrompt(plugin, context);
|
||||
return new PlannerPrompt(context);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -46,9 +46,9 @@ public class RequirementsPrompt extends QuestsEditorNumericPrompt {
|
||||
private boolean hasRequirement = false;
|
||||
private final int size = 11;
|
||||
|
||||
public RequirementsPrompt(Quests plugin, ConversationContext context) {
|
||||
public RequirementsPrompt(ConversationContext context) {
|
||||
super(context);
|
||||
this.plugin = plugin;
|
||||
this.plugin = (Quests)context.getPlugin();
|
||||
this.classPrefix = getClass().getSimpleName();
|
||||
}
|
||||
|
||||
@ -290,9 +290,8 @@ public class RequirementsPrompt extends QuestsEditorNumericPrompt {
|
||||
}
|
||||
checkRequirement(context);
|
||||
|
||||
QuestsEditorPostOpenNumericPromptEvent event
|
||||
= new QuestsEditorPostOpenNumericPromptEvent(context, this);
|
||||
plugin.getServer().getPluginManager().callEvent(event);
|
||||
QuestsEditorPostOpenNumericPromptEvent event = new QuestsEditorPostOpenNumericPromptEvent(context, this);
|
||||
context.getPlugin().getServer().getPluginManager().callEvent(event);
|
||||
|
||||
String text = ChatColor.DARK_AQUA + getTitle(context).replace((String) context
|
||||
.getSessionData(CK.Q_NAME), ChatColor.AQUA + (String) context.getSessionData(CK.Q_NAME)
|
||||
@ -312,7 +311,7 @@ public class RequirementsPrompt extends QuestsEditorNumericPrompt {
|
||||
case 2:
|
||||
return new QuestPointsPrompt();
|
||||
case 3:
|
||||
return new ItemListPrompt(plugin, context);
|
||||
return new ItemListPrompt(context);
|
||||
case 4:
|
||||
return new PermissionsPrompt();
|
||||
case 5:
|
||||
@ -323,13 +322,13 @@ public class RequirementsPrompt extends QuestsEditorNumericPrompt {
|
||||
if (plugin.getDependencies().getMcmmoClassic() != null) {
|
||||
return new mcMMOPrompt();
|
||||
} else {
|
||||
return new RequirementsPrompt(plugin, context);
|
||||
return new RequirementsPrompt(context);
|
||||
}
|
||||
case 8:
|
||||
if (plugin.getDependencies().getHeroes() != null) {
|
||||
return new HeroesPrompt();
|
||||
} else {
|
||||
return new RequirementsPrompt(plugin, context);
|
||||
return new RequirementsPrompt(context);
|
||||
}
|
||||
case 9:
|
||||
return new CustomRequirementsPrompt();
|
||||
@ -342,7 +341,7 @@ public class RequirementsPrompt extends QuestsEditorNumericPrompt {
|
||||
.build();
|
||||
} else {
|
||||
context.getForWhom().sendRawMessage(ChatColor.RED + Lang.get("invalidOption"));
|
||||
return new RequirementsPrompt(plugin, context);
|
||||
return new RequirementsPrompt(context);
|
||||
}
|
||||
case 11:
|
||||
return plugin.getQuestFactory().returnToMenu(context);
|
||||
@ -402,9 +401,9 @@ public class RequirementsPrompt extends QuestsEditorNumericPrompt {
|
||||
}
|
||||
} else if (input.equalsIgnoreCase(Lang.get("cmdClear"))) {
|
||||
context.setSessionData(CK.REQ_MONEY, null);
|
||||
return new RequirementsPrompt(plugin, context);
|
||||
return new RequirementsPrompt(context);
|
||||
}
|
||||
return new RequirementsPrompt(plugin, context);
|
||||
return new RequirementsPrompt(context);
|
||||
}
|
||||
}
|
||||
|
||||
@ -434,9 +433,9 @@ public class RequirementsPrompt extends QuestsEditorNumericPrompt {
|
||||
}
|
||||
} else if (input.equalsIgnoreCase(Lang.get("cmdClear"))) {
|
||||
context.setSessionData(CK.REQ_QUEST_POINTS, null);
|
||||
return new RequirementsPrompt(plugin, context);
|
||||
return new RequirementsPrompt(context);
|
||||
}
|
||||
return new RequirementsPrompt(plugin, context);
|
||||
return new RequirementsPrompt(context);
|
||||
}
|
||||
}
|
||||
|
||||
@ -504,12 +503,12 @@ public class RequirementsPrompt extends QuestsEditorNumericPrompt {
|
||||
context.setSessionData(CK.REQ_QUEST_BLOCK, null);
|
||||
}
|
||||
}
|
||||
return new RequirementsPrompt(plugin, context);
|
||||
return new RequirementsPrompt(context);
|
||||
}
|
||||
}
|
||||
|
||||
public class ItemListPrompt extends QuestsEditorNumericPrompt {
|
||||
public ItemListPrompt(Quests plugin, ConversationContext context) {
|
||||
public ItemListPrompt(ConversationContext context) {
|
||||
super(context);
|
||||
}
|
||||
|
||||
@ -633,7 +632,7 @@ public class RequirementsPrompt extends QuestsEditorNumericPrompt {
|
||||
case 2:
|
||||
if (context.getSessionData(CK.REQ_ITEMS) == null) {
|
||||
context.getForWhom().sendRawMessage(ChatColor.RED + Lang.get("reqMustAddItem"));
|
||||
return new ItemListPrompt(plugin, context);
|
||||
return new ItemListPrompt(context);
|
||||
} else {
|
||||
return new RemoveItemsPrompt();
|
||||
}
|
||||
@ -641,7 +640,7 @@ public class RequirementsPrompt extends QuestsEditorNumericPrompt {
|
||||
context.getForWhom().sendRawMessage(ChatColor.YELLOW + Lang.get("reqItemCleared"));
|
||||
context.setSessionData(CK.REQ_ITEMS, null);
|
||||
context.setSessionData(CK.REQ_ITEMS_REMOVE, null);
|
||||
return new ItemListPrompt(plugin, context);
|
||||
return new ItemListPrompt(context);
|
||||
case 4:
|
||||
int one;
|
||||
int two;
|
||||
@ -656,10 +655,10 @@ public class RequirementsPrompt extends QuestsEditorNumericPrompt {
|
||||
two = 0;
|
||||
}
|
||||
if (one == two) {
|
||||
return new RequirementsPrompt(plugin, context);
|
||||
return new RequirementsPrompt(context);
|
||||
} else {
|
||||
context.getForWhom().sendRawMessage(ChatColor.RED + Lang.get("listsNotSameSize"));
|
||||
return new ItemListPrompt(plugin, context);
|
||||
return new ItemListPrompt(context);
|
||||
}
|
||||
default:
|
||||
return null;
|
||||
@ -703,7 +702,7 @@ public class RequirementsPrompt extends QuestsEditorNumericPrompt {
|
||||
}
|
||||
context.setSessionData(CK.REQ_ITEMS_REMOVE, booleans);
|
||||
}
|
||||
return new ItemListPrompt(plugin, context);
|
||||
return new ItemListPrompt(context);
|
||||
}
|
||||
}
|
||||
|
||||
@ -725,7 +724,7 @@ public class RequirementsPrompt extends QuestsEditorNumericPrompt {
|
||||
} else if (input.equalsIgnoreCase(Lang.get("cmdClear"))) {
|
||||
context.setSessionData(CK.REQ_PERMISSION, null);
|
||||
}
|
||||
return new RequirementsPrompt(plugin, context);
|
||||
return new RequirementsPrompt(context);
|
||||
}
|
||||
}
|
||||
|
||||
@ -807,7 +806,7 @@ public class RequirementsPrompt extends QuestsEditorNumericPrompt {
|
||||
context.setSessionData(CK.REQ_CUSTOM_DATA_TEMP, null);
|
||||
context.getForWhom().sendRawMessage(ChatColor.YELLOW + Lang.get("reqCustomCleared"));
|
||||
}
|
||||
return new RequirementsPrompt(plugin, context);
|
||||
return new RequirementsPrompt(context);
|
||||
}
|
||||
}
|
||||
|
||||
@ -872,7 +871,7 @@ public class RequirementsPrompt extends QuestsEditorNumericPrompt {
|
||||
return new RequirementCustomDataListPrompt();
|
||||
} else {
|
||||
context.setSessionData(CK.REQ_CUSTOM_DATA_DESCRIPTIONS, null);
|
||||
return new RequirementsPrompt(plugin, context);
|
||||
return new RequirementsPrompt(context);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -953,7 +952,7 @@ public class RequirementsPrompt extends QuestsEditorNumericPrompt {
|
||||
} else if (input.equalsIgnoreCase("2")) {
|
||||
return new mcMMOAmountsPrompt();
|
||||
} else if (input.equalsIgnoreCase("3")) {
|
||||
return new RequirementsPrompt(plugin, context);
|
||||
return new RequirementsPrompt(context);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
@ -1080,7 +1079,7 @@ public class RequirementsPrompt extends QuestsEditorNumericPrompt {
|
||||
} else if (input.equalsIgnoreCase("2")) {
|
||||
return new HeroesSecondaryPrompt();
|
||||
} else if (input.equalsIgnoreCase("3")) {
|
||||
return new RequirementsPrompt(plugin, context);
|
||||
return new RequirementsPrompt(context);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
@ -46,9 +46,9 @@ public class RewardsPrompt extends QuestsEditorNumericPrompt {
|
||||
private boolean hasReward = false;
|
||||
private final int size = 12;
|
||||
|
||||
public RewardsPrompt(Quests plugin, ConversationContext context) {
|
||||
public RewardsPrompt(ConversationContext context) {
|
||||
super(context);
|
||||
this.plugin = plugin;
|
||||
this.plugin = (Quests)context.getPlugin();
|
||||
this.classPrefix = getClass().getSimpleName();
|
||||
}
|
||||
|
||||
@ -331,9 +331,8 @@ public class RewardsPrompt extends QuestsEditorNumericPrompt {
|
||||
}
|
||||
checkReward(context);
|
||||
|
||||
QuestsEditorPostOpenNumericPromptEvent event
|
||||
= new QuestsEditorPostOpenNumericPromptEvent(context, this);
|
||||
plugin.getServer().getPluginManager().callEvent(event);
|
||||
QuestsEditorPostOpenNumericPromptEvent event = new QuestsEditorPostOpenNumericPromptEvent(context, this);
|
||||
context.getPlugin().getServer().getPluginManager().callEvent(event);
|
||||
|
||||
String text = ChatColor.LIGHT_PURPLE + getTitle(context).replace((String) context
|
||||
.getSessionData(CK.Q_NAME), ChatColor.AQUA + (String) context.getSessionData(CK.Q_NAME)
|
||||
@ -352,7 +351,7 @@ public class RewardsPrompt extends QuestsEditorNumericPrompt {
|
||||
if (plugin.getDependencies().getVaultEconomy() != null) {
|
||||
return new MoneyPrompt();
|
||||
} else {
|
||||
return new RewardsPrompt(plugin, context);
|
||||
return new RewardsPrompt(context);
|
||||
}
|
||||
case 2:
|
||||
return new QuestPointsPrompt();
|
||||
@ -368,19 +367,19 @@ public class RewardsPrompt extends QuestsEditorNumericPrompt {
|
||||
if (plugin.getDependencies().getMcmmoClassic() != null) {
|
||||
return new mcMMOListPrompt();
|
||||
} else {
|
||||
return new RewardsPrompt(plugin, context);
|
||||
return new RewardsPrompt(context);
|
||||
}
|
||||
case 8:
|
||||
if (plugin.getDependencies().getHeroes() != null) {
|
||||
return new HeroesListPrompt();
|
||||
} else {
|
||||
return new RewardsPrompt(plugin, context);
|
||||
return new RewardsPrompt(context);
|
||||
}
|
||||
case 9:
|
||||
if (plugin.getDependencies().getPhatLoots() != null) {
|
||||
return new PhatLootsPrompt();
|
||||
} else {
|
||||
return new RewardsPrompt(plugin, context);
|
||||
return new RewardsPrompt(context);
|
||||
}
|
||||
case 10:
|
||||
return new CustomRewardsPrompt();
|
||||
@ -392,7 +391,7 @@ public class RewardsPrompt extends QuestsEditorNumericPrompt {
|
||||
.build();
|
||||
} else {
|
||||
context.getForWhom().sendRawMessage(ChatColor.RED + Lang.get("invalidOption"));
|
||||
return new RewardsPrompt(plugin, context);
|
||||
return new RewardsPrompt(context);
|
||||
}
|
||||
case 12:
|
||||
return plugin.getQuestFactory().returnToMenu(context);
|
||||
@ -452,9 +451,9 @@ public class RewardsPrompt extends QuestsEditorNumericPrompt {
|
||||
}
|
||||
} else if (input.equalsIgnoreCase(Lang.get("cmdClear"))) {
|
||||
context.setSessionData(CK.REW_MONEY, null);
|
||||
return new RewardsPrompt(plugin, context);
|
||||
return new RewardsPrompt(context);
|
||||
}
|
||||
return new RewardsPrompt(plugin, context);
|
||||
return new RewardsPrompt(context);
|
||||
}
|
||||
}
|
||||
|
||||
@ -484,9 +483,9 @@ public class RewardsPrompt extends QuestsEditorNumericPrompt {
|
||||
}
|
||||
} else if (input.equalsIgnoreCase(Lang.get("cmdClear"))) {
|
||||
context.setSessionData(CK.REW_EXP, null);
|
||||
return new RewardsPrompt(plugin, context);
|
||||
return new RewardsPrompt(context);
|
||||
}
|
||||
return new RewardsPrompt(plugin, context);
|
||||
return new RewardsPrompt(context);
|
||||
}
|
||||
}
|
||||
|
||||
@ -516,9 +515,9 @@ public class RewardsPrompt extends QuestsEditorNumericPrompt {
|
||||
}
|
||||
} else if (input.equalsIgnoreCase(Lang.get("cmdClear"))) {
|
||||
context.setSessionData(CK.REW_QUEST_POINTS, null);
|
||||
return new RewardsPrompt(plugin, context);
|
||||
return new RewardsPrompt(context);
|
||||
}
|
||||
return new RewardsPrompt(plugin, context);
|
||||
return new RewardsPrompt(context);
|
||||
}
|
||||
}
|
||||
|
||||
@ -576,7 +575,7 @@ public class RewardsPrompt extends QuestsEditorNumericPrompt {
|
||||
context.setSessionData(CK.REW_ITEMS, null);
|
||||
return new ItemListPrompt();
|
||||
} else if (input.equalsIgnoreCase("3")) {
|
||||
return new RewardsPrompt(plugin, context);
|
||||
return new RewardsPrompt(context);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
@ -614,7 +613,7 @@ public class RewardsPrompt extends QuestsEditorNumericPrompt {
|
||||
} else if (input.equalsIgnoreCase(Lang.get("cmdClear"))) {
|
||||
context.setSessionData(CK.REW_COMMAND, null);
|
||||
}
|
||||
return new RewardsPrompt(plugin, context);
|
||||
return new RewardsPrompt(context);
|
||||
}
|
||||
}
|
||||
|
||||
@ -716,7 +715,7 @@ public class RewardsPrompt extends QuestsEditorNumericPrompt {
|
||||
public String getPromptText(ConversationContext context) {
|
||||
QuestsEditorPostOpenNumericPromptEvent event
|
||||
= new QuestsEditorPostOpenNumericPromptEvent(context, this);
|
||||
plugin.getServer().getPluginManager().callEvent(event);
|
||||
context.getPlugin().getServer().getPluginManager().callEvent(event);
|
||||
|
||||
String text = ChatColor.GOLD + getTitle(context) + "\n";
|
||||
for (int i = 1; i <= size; i++) {
|
||||
@ -739,7 +738,7 @@ public class RewardsPrompt extends QuestsEditorNumericPrompt {
|
||||
context.setSessionData(CK.REW_PERMISSION_WORLDS, null);
|
||||
return new PermissionsListPrompt(context);
|
||||
case 4:
|
||||
return new RewardsPrompt(plugin, context);
|
||||
return new RewardsPrompt(context);
|
||||
default:
|
||||
return null;
|
||||
}
|
||||
@ -784,7 +783,7 @@ public class RewardsPrompt extends QuestsEditorNumericPrompt {
|
||||
List<String> worlds = new LinkedList<String>();
|
||||
worlds.addAll(Arrays.asList(args));
|
||||
for (String w : worlds) {
|
||||
if (!w.equals("null") && w != null && plugin.getServer().getWorld(w) == null) {
|
||||
if (!w.equals("null") && w != null && context.getPlugin().getServer().getWorld(w) == null) {
|
||||
context.getForWhom().sendRawMessage(ChatColor.RED + w + " "
|
||||
+ Lang.get("eventEditorInvalidWorld"));
|
||||
return new PermissionsWorldsPrompt();
|
||||
@ -871,7 +870,7 @@ public class RewardsPrompt extends QuestsEditorNumericPrompt {
|
||||
two = 0;
|
||||
}
|
||||
if (one == two) {
|
||||
return new RewardsPrompt(plugin, context);
|
||||
return new RewardsPrompt(context);
|
||||
} else {
|
||||
context.getForWhom().sendRawMessage(ChatColor.RED + Lang.get("rewMcMMOListsNotSameSize"));
|
||||
return new mcMMOListPrompt();
|
||||
@ -1034,7 +1033,7 @@ public class RewardsPrompt extends QuestsEditorNumericPrompt {
|
||||
two = 0;
|
||||
}
|
||||
if (one == two) {
|
||||
return new RewardsPrompt(plugin, context);
|
||||
return new RewardsPrompt(context);
|
||||
} else {
|
||||
context.getForWhom().sendRawMessage(ChatColor.RED + Lang.get("rewHeroesListsNotSameSize"));
|
||||
return new HeroesListPrompt();
|
||||
@ -1161,13 +1160,13 @@ public class RewardsPrompt extends QuestsEditorNumericPrompt {
|
||||
}
|
||||
loots.addAll(Arrays.asList(arr));
|
||||
context.setSessionData(CK.REW_PHAT_LOOTS, loots);
|
||||
return new RewardsPrompt(plugin, context);
|
||||
return new RewardsPrompt(context);
|
||||
} else if (input.equalsIgnoreCase(Lang.get("cmdClear"))) {
|
||||
context.setSessionData(CK.REW_PHAT_LOOTS, null);
|
||||
context.getForWhom().sendRawMessage(ChatColor.YELLOW + Lang.get("rewPhatLootsCleared"));
|
||||
return new RewardsPrompt(plugin, context);
|
||||
return new RewardsPrompt(context);
|
||||
} else {
|
||||
return new RewardsPrompt(plugin, context);
|
||||
return new RewardsPrompt(context);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1250,7 +1249,7 @@ public class RewardsPrompt extends QuestsEditorNumericPrompt {
|
||||
context.setSessionData(CK.REW_CUSTOM_DATA_TEMP, null);
|
||||
context.getForWhom().sendRawMessage(ChatColor.YELLOW + Lang.get("rewCustomCleared"));
|
||||
}
|
||||
return new RewardsPrompt(plugin, context);
|
||||
return new RewardsPrompt(context);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1315,7 +1314,7 @@ public class RewardsPrompt extends QuestsEditorNumericPrompt {
|
||||
return new RewardCustomDataListPrompt();
|
||||
} else {
|
||||
context.setSessionData(CK.REW_CUSTOM_DATA_DESCRIPTIONS, null);
|
||||
return new RewardsPrompt(plugin, context);
|
||||
return new RewardsPrompt(context);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -47,9 +47,9 @@ public class StageMainPrompt extends QuestsEditorNumericPrompt {
|
||||
private boolean hasObjective = false;
|
||||
private final int size = 16;
|
||||
|
||||
public StageMainPrompt(Quests plugin, int stageNum, ConversationContext context) {
|
||||
public StageMainPrompt(int stageNum, ConversationContext context) {
|
||||
super(context);
|
||||
this.plugin = plugin;
|
||||
this.plugin = (Quests)context.getPlugin();
|
||||
this.stageNum = stageNum;
|
||||
this.stagePrefix = "stage" + stageNum;
|
||||
this.classPrefix = getClass().getSimpleName();
|
||||
@ -401,13 +401,13 @@ public class StageMainPrompt extends QuestsEditorNumericPrompt {
|
||||
protected Prompt acceptValidatedInput(ConversationContext context, Number input) {
|
||||
switch (input.intValue()) {
|
||||
case 1:
|
||||
return new BlocksPrompt(plugin, stageNum, context);
|
||||
return new BlocksPrompt(stageNum, context);
|
||||
case 2:
|
||||
return new ItemsPrompt(plugin, stageNum);
|
||||
return new ItemsPrompt(stageNum);
|
||||
case 3:
|
||||
return new NPCsPrompt(plugin, stageNum);
|
||||
return new NPCsPrompt(stageNum, context);
|
||||
case 4:
|
||||
return new MobsPrompt(plugin, stageNum);
|
||||
return new MobsPrompt(stageNum, context);
|
||||
case 5:
|
||||
return new KillPlayerPrompt();
|
||||
case 6:
|
||||
@ -421,19 +421,19 @@ public class StageMainPrompt extends QuestsEditorNumericPrompt {
|
||||
return new EventListPrompt();
|
||||
} else {
|
||||
context.getForWhom().sendRawMessage(ChatColor.RED + Lang.get("invalidOption"));
|
||||
return new StageMainPrompt(plugin, stageNum, context);
|
||||
return new StageMainPrompt(stageNum, context);
|
||||
}
|
||||
case 10:
|
||||
if (hasObjective) {
|
||||
return new DelayPrompt();
|
||||
} else {
|
||||
context.getForWhom().sendRawMessage(ChatColor.RED + Lang.get("invalidOption"));
|
||||
return new StageMainPrompt(plugin, stageNum, context);
|
||||
return new StageMainPrompt(stageNum, context);
|
||||
}
|
||||
case 11:
|
||||
if (context.getSessionData(stagePrefix + CK.S_DELAY) == null) {
|
||||
context.getForWhom().sendRawMessage(ChatColor.RED + Lang.get("stageEditorNoDelaySet"));
|
||||
return new StageMainPrompt(plugin, stageNum, context);
|
||||
return new StageMainPrompt(stageNum, context);
|
||||
} else {
|
||||
return new DelayMessagePrompt();
|
||||
}
|
||||
@ -442,14 +442,14 @@ public class StageMainPrompt extends QuestsEditorNumericPrompt {
|
||||
return new StartMessagePrompt();
|
||||
} else {
|
||||
context.getForWhom().sendRawMessage(ChatColor.RED + Lang.get("invalidOption"));
|
||||
return new StageMainPrompt(plugin, stageNum, context);
|
||||
return new StageMainPrompt(stageNum, context);
|
||||
}
|
||||
case 13:
|
||||
if (hasObjective) {
|
||||
return new CompleteMessagePrompt();
|
||||
} else {
|
||||
context.getForWhom().sendRawMessage(ChatColor.RED + Lang.get("invalidOption"));
|
||||
return new StageMainPrompt(plugin, stageNum, context);
|
||||
return new StageMainPrompt(stageNum, context);
|
||||
}
|
||||
case 14:
|
||||
if (hasObjective) {
|
||||
@ -459,14 +459,14 @@ public class StageMainPrompt extends QuestsEditorNumericPrompt {
|
||||
.build();
|
||||
} else {
|
||||
context.getForWhom().sendRawMessage(ChatColor.RED + Lang.get("invalidOption"));
|
||||
return new StageMainPrompt(plugin, stageNum, context);
|
||||
return new StageMainPrompt(stageNum, context);
|
||||
}
|
||||
case 15:
|
||||
return new DeletePrompt();
|
||||
case 16:
|
||||
return new StageMenuPrompt(plugin, context);
|
||||
return new StageMenuPrompt(context);
|
||||
default:
|
||||
return new StageMainPrompt(plugin, stageNum, context);
|
||||
return new StageMainPrompt(stageNum, context);
|
||||
}
|
||||
}
|
||||
|
||||
@ -578,7 +578,7 @@ public class StageMainPrompt extends QuestsEditorNumericPrompt {
|
||||
two = 0;
|
||||
}
|
||||
if (one == two) {
|
||||
return new StageMainPrompt(plugin, stageNum, context);
|
||||
return new StageMainPrompt(stageNum, context);
|
||||
} else {
|
||||
context.getForWhom().sendRawMessage(ChatColor.RED + Lang.get("listsNotSameSize"));
|
||||
return new PasswordListPrompt();
|
||||
@ -680,7 +680,7 @@ public class StageMainPrompt extends QuestsEditorNumericPrompt {
|
||||
} else if (input.equalsIgnoreCase(Lang.get("cmdClear"))) {
|
||||
context.setSessionData(stagePrefix + CK.S_PLAYER_KILL, null);
|
||||
}
|
||||
return new StageMainPrompt(plugin, stageNum, context);
|
||||
return new StageMainPrompt(stageNum, context);
|
||||
}
|
||||
}
|
||||
|
||||
@ -786,7 +786,7 @@ public class StageMainPrompt extends QuestsEditorNumericPrompt {
|
||||
three = 0;
|
||||
}
|
||||
if (one == two && two == three) {
|
||||
return new StageMainPrompt(plugin, stageNum, context);
|
||||
return new StageMainPrompt(stageNum, context);
|
||||
} else {
|
||||
context.getForWhom().sendRawMessage(ChatColor.RED + Lang.get("listsNotSameSize"));
|
||||
return new ReachListPrompt();
|
||||
@ -997,7 +997,7 @@ public class StageMainPrompt extends QuestsEditorNumericPrompt {
|
||||
} else if (input.equalsIgnoreCase("6")) {
|
||||
return new CommandEventPrompt();
|
||||
} else if (input.equalsIgnoreCase("7")) {
|
||||
return new StageMainPrompt(plugin, stageNum, context);
|
||||
return new StageMainPrompt(stageNum, context);
|
||||
} else {
|
||||
return new EventListPrompt();
|
||||
}
|
||||
@ -1389,12 +1389,12 @@ public class StageMainPrompt extends QuestsEditorNumericPrompt {
|
||||
public Prompt acceptInput(ConversationContext context, String input) {
|
||||
Player player = (Player) context.getForWhom();
|
||||
if (input.equalsIgnoreCase(Lang.get("cmdCancel"))) {
|
||||
return new StageMainPrompt(plugin, stageNum, context);
|
||||
return new StageMainPrompt(stageNum, context);
|
||||
}
|
||||
if (input.equalsIgnoreCase(Lang.get("cmdClear"))) {
|
||||
context.setSessionData(stagePrefix + CK.S_DELAY, null);
|
||||
player.sendMessage(ChatColor.GREEN + Lang.get("stageEditorDelayCleared"));
|
||||
return new StageMainPrompt(plugin, stageNum, context);
|
||||
return new StageMainPrompt(stageNum, context);
|
||||
}
|
||||
long stageDelay;
|
||||
try {
|
||||
@ -1409,7 +1409,7 @@ public class StageMainPrompt extends QuestsEditorNumericPrompt {
|
||||
return new DelayPrompt();
|
||||
} else {
|
||||
context.setSessionData(stagePrefix + CK.S_DELAY, stageDelay);
|
||||
return new StageMainPrompt(plugin, stageNum, context);
|
||||
return new StageMainPrompt(stageNum, context);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1427,11 +1427,11 @@ public class StageMainPrompt extends QuestsEditorNumericPrompt {
|
||||
if (input.equalsIgnoreCase(Lang.get("cmdCancel")) == false
|
||||
&& input.equalsIgnoreCase(Lang.get("cmdClear")) == false) {
|
||||
context.setSessionData(stagePrefix + CK.S_DELAY_MESSAGE, input);
|
||||
return new StageMainPrompt(plugin, stageNum, context);
|
||||
return new StageMainPrompt(stageNum, context);
|
||||
} else if (input.equalsIgnoreCase(Lang.get("cmdClear"))) {
|
||||
context.setSessionData(stagePrefix + CK.S_DELAY_MESSAGE, null);
|
||||
player.sendMessage(ChatColor.YELLOW + Lang.get("stageEditorMessageCleared"));
|
||||
return new StageMainPrompt(plugin, stageNum, context);
|
||||
return new StageMainPrompt(stageNum, context);
|
||||
} else {
|
||||
return new DelayMessagePrompt();
|
||||
}
|
||||
@ -1455,11 +1455,11 @@ public class StageMainPrompt extends QuestsEditorNumericPrompt {
|
||||
public Prompt acceptInput(ConversationContext context, String input) {
|
||||
Player player = (Player) context.getForWhom();
|
||||
if (input.equalsIgnoreCase("1") || input.equalsIgnoreCase("Yes")) {
|
||||
new StageMenuPrompt(plugin, context).deleteStage(context, stageNum);
|
||||
new StageMenuPrompt(context).deleteStage(context, stageNum);
|
||||
player.sendMessage(ChatColor.YELLOW + Lang.get("stageEditorDeleteSucces"));
|
||||
return new StageMenuPrompt(plugin, context);
|
||||
return new StageMenuPrompt(context);
|
||||
} else if (input.equalsIgnoreCase("2") || input.equalsIgnoreCase("No")) {
|
||||
return new StageMainPrompt(plugin, stageNum, context);
|
||||
return new StageMainPrompt(stageNum, context);
|
||||
} else {
|
||||
player.sendMessage(ChatColor.RED + Lang.get("invalidOption"));
|
||||
return new DeletePrompt();
|
||||
@ -1480,13 +1480,13 @@ public class StageMainPrompt extends QuestsEditorNumericPrompt {
|
||||
if (input.equalsIgnoreCase(Lang.get("cmdCancel")) == false
|
||||
&& input.equalsIgnoreCase(Lang.get("cmdClear")) == false) {
|
||||
context.setSessionData(stagePrefix + CK.S_START_MESSAGE, input);
|
||||
return new StageMainPrompt(plugin, stageNum, context);
|
||||
return new StageMainPrompt(stageNum, context);
|
||||
} else if (input.equalsIgnoreCase(Lang.get("cmdClear"))) {
|
||||
context.setSessionData(stagePrefix + CK.S_START_MESSAGE, null);
|
||||
player.sendMessage(ChatColor.YELLOW + Lang.get("stageEditorMessageCleared"));
|
||||
return new StageMainPrompt(plugin, stageNum, context);
|
||||
return new StageMainPrompt(stageNum, context);
|
||||
} else {
|
||||
return new StageMainPrompt(plugin, stageNum, context);
|
||||
return new StageMainPrompt(stageNum, context);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1504,13 +1504,13 @@ public class StageMainPrompt extends QuestsEditorNumericPrompt {
|
||||
if (input.equalsIgnoreCase(Lang.get("cmdCancel")) == false
|
||||
&& input.equalsIgnoreCase(Lang.get("cmdClear")) == false) {
|
||||
context.setSessionData(stagePrefix + CK.S_COMPLETE_MESSAGE, input);
|
||||
return new StageMainPrompt(plugin, stageNum, context);
|
||||
return new StageMainPrompt(stageNum, context);
|
||||
} else if (input.equalsIgnoreCase(Lang.get("cmdClear"))) {
|
||||
context.setSessionData(stagePrefix + CK.S_COMPLETE_MESSAGE, null);
|
||||
player.sendMessage(ChatColor.YELLOW + Lang.get("stageEditorMessageCleared"));
|
||||
return new StageMainPrompt(plugin, stageNum, context);
|
||||
return new StageMainPrompt(stageNum, context);
|
||||
} else {
|
||||
return new StageMainPrompt(plugin, stageNum, context);
|
||||
return new StageMainPrompt(stageNum, context);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1605,7 +1605,7 @@ public class StageMainPrompt extends QuestsEditorNumericPrompt {
|
||||
context.setSessionData(stagePrefix + CK.S_CUSTOM_OBJECTIVES_DATA_TEMP, null);
|
||||
context.getForWhom().sendRawMessage(ChatColor.YELLOW + Lang.get("stageEditorCustomCleared"));
|
||||
}
|
||||
return new StageMainPrompt(plugin, stageNum, context);
|
||||
return new StageMainPrompt(stageNum, context);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1652,7 +1652,7 @@ public class StageMainPrompt extends QuestsEditorNumericPrompt {
|
||||
context.setSessionData(stagePrefix + CK.S_CUSTOM_OBJECTIVES_DATA_DESCRIPTIONS, found.getDescriptions());
|
||||
return new ObjectiveCustomDataListPrompt();
|
||||
} else {
|
||||
return new StageMainPrompt(plugin, stageNum, context);
|
||||
return new StageMainPrompt(stageNum, context);
|
||||
}
|
||||
} catch (NumberFormatException e) {
|
||||
context.getForWhom().sendRawMessage(ChatColor.RED + Lang.get("reqNotANumber")
|
||||
@ -1680,7 +1680,7 @@ public class StageMainPrompt extends QuestsEditorNumericPrompt {
|
||||
}
|
||||
}
|
||||
if (found == null) {
|
||||
return "ERROR";
|
||||
return "Could not find custom objective";
|
||||
}
|
||||
text += objName + " -\n";
|
||||
int index = 1;
|
||||
@ -1715,7 +1715,7 @@ public class StageMainPrompt extends QuestsEditorNumericPrompt {
|
||||
}
|
||||
}
|
||||
if (found == null) {
|
||||
plugin.getLogger().severe("ERROR");
|
||||
plugin.getLogger().severe("Could not find custom objective following input: " + input);
|
||||
return new ObjectiveCustomDataListPrompt();
|
||||
}
|
||||
LinkedList<Entry<String, Object>> datamapList = found.getData();
|
||||
@ -1746,7 +1746,7 @@ public class StageMainPrompt extends QuestsEditorNumericPrompt {
|
||||
}
|
||||
}
|
||||
context.setSessionData(stagePrefix + CK.S_CUSTOM_OBJECTIVES_DATA_DESCRIPTIONS, null);
|
||||
return new StageMainPrompt(plugin, stageNum, context);
|
||||
return new StageMainPrompt(stageNum, context);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -27,9 +27,9 @@ public class StageMenuPrompt extends QuestsEditorNumericPrompt {
|
||||
private final Quests plugin;
|
||||
private int size = 2;
|
||||
|
||||
public StageMenuPrompt(Quests plugin, ConversationContext context) {
|
||||
public StageMenuPrompt(ConversationContext context) {
|
||||
super(context);
|
||||
this.plugin = plugin;
|
||||
this.plugin = (Quests)context.getPlugin();
|
||||
}
|
||||
|
||||
public int getSize() {
|
||||
@ -74,9 +74,8 @@ public class StageMenuPrompt extends QuestsEditorNumericPrompt {
|
||||
|
||||
@Override
|
||||
public String getPromptText(ConversationContext context) {
|
||||
QuestsEditorPostOpenNumericPromptEvent event
|
||||
= new QuestsEditorPostOpenNumericPromptEvent(context, this);
|
||||
plugin.getServer().getPluginManager().callEvent(event);
|
||||
QuestsEditorPostOpenNumericPromptEvent event = new QuestsEditorPostOpenNumericPromptEvent(context, this);
|
||||
context.getPlugin().getServer().getPluginManager().callEvent(event);
|
||||
|
||||
String text = ChatColor.LIGHT_PURPLE + "- " + getTitle(context) + " -\n";
|
||||
for (int i = 1; i <= (getStages(context) + size); i++) {
|
||||
@ -92,14 +91,14 @@ public class StageMenuPrompt extends QuestsEditorNumericPrompt {
|
||||
int stages = getStages(context);
|
||||
if (i > 0) {
|
||||
if (i < (stages + 1) && i > 0) {
|
||||
return new StageMainPrompt(plugin, (i), context);
|
||||
return new StageMainPrompt((i), context);
|
||||
} else if (i == (stages + 1)) {
|
||||
return new StageMainPrompt(plugin, (stages + 1), context);
|
||||
return new StageMainPrompt((stages + 1), context);
|
||||
} else if (i == (stages + 2)) {
|
||||
return plugin.getQuestFactory().returnToMenu(context);
|
||||
}
|
||||
}
|
||||
return new StageMenuPrompt(plugin, context);
|
||||
return new StageMenuPrompt(context);
|
||||
}
|
||||
|
||||
public int getStages(ConversationContext context) {
|
||||
|
Loading…
Reference in New Issue
Block a user