Revise a few Quest Editor prompt names and events

This commit is contained in:
PikaMug 2019-11-15 00:04:38 -05:00
parent 524f48d3fb
commit a5578e3e59
4 changed files with 95 additions and 95 deletions

View File

@ -47,9 +47,9 @@ import org.bukkit.inventory.ItemStack;
import com.sk89q.worldguard.protection.managers.RegionManager; import com.sk89q.worldguard.protection.managers.RegionManager;
import me.blackvein.quests.actions.Action; import me.blackvein.quests.actions.Action;
import me.blackvein.quests.events.editor.quests.QuestsEditorPostOpenCreatePromptEvent;
import me.blackvein.quests.events.editor.quests.QuestsEditorPostOpenExitPromptEvent;
import me.blackvein.quests.events.editor.quests.QuestsEditorPostOpenMainPromptEvent; import me.blackvein.quests.events.editor.quests.QuestsEditorPostOpenMainPromptEvent;
import me.blackvein.quests.events.editor.quests.QuestsEditorPostOpenExitPromptEvent;
import me.blackvein.quests.events.editor.quests.QuestsEditorPostOpenMenuPromptEvent;
import me.blackvein.quests.events.editor.quests.QuestsEditorPostOpenSavePromptEvent; import me.blackvein.quests.events.editor.quests.QuestsEditorPostOpenSavePromptEvent;
import me.blackvein.quests.events.editor.quests.QuestsEditorPostOpenSelectCreatePromptEvent; import me.blackvein.quests.events.editor.quests.QuestsEditorPostOpenSelectCreatePromptEvent;
import me.blackvein.quests.prompts.GUIDisplayPrompt; import me.blackvein.quests.prompts.GUIDisplayPrompt;
@ -82,7 +82,7 @@ public class QuestFactory implements ConversationAbandonedListener {
questsFile = new File(plugin.getDataFolder(), "quests.yml"); questsFile = new File(plugin.getDataFolder(), "quests.yml");
// Ensure to initialize convoCreator last so that 'this' is fully initialized before it is passed // Ensure to initialize convoCreator last so that 'this' is fully initialized before it is passed
this.convoCreator = new ConversationFactory(plugin).withModality(false).withLocalEcho(false) this.convoCreator = new ConversationFactory(plugin).withModality(false).withLocalEcho(false)
.withFirstPrompt(new MainMenuPrompt()).withTimeout(3600) .withFirstPrompt(new QuestMenuPrompt()).withTimeout(3600)
.thatExcludesNonPlayersWithMessage("Console may not perform this operation!") .thatExcludesNonPlayersWithMessage("Console may not perform this operation!")
.addConversationAbandonedListener(this); .addConversationAbandonedListener(this);
} }
@ -142,7 +142,7 @@ public class QuestFactory implements ConversationAbandonedListener {
selectedReachLocations.remove(player.getUniqueId()); selectedReachLocations.remove(player.getUniqueId());
} }
public class MainMenuPrompt extends NumericPrompt { public class QuestMenuPrompt extends NumericPrompt {
private final int size = 4; private final int size = 4;
public int getSize() { public int getSize() {
@ -183,7 +183,7 @@ public class QuestFactory implements ConversationAbandonedListener {
@Override @Override
public String getPromptText(ConversationContext context) { public String getPromptText(ConversationContext context) {
QuestsEditorPostOpenMainPromptEvent event = new QuestsEditorPostOpenMainPromptEvent(context); QuestsEditorPostOpenMenuPromptEvent event = new QuestsEditorPostOpenMenuPromptEvent(context);
plugin.getServer().getPluginManager().callEvent(event); plugin.getServer().getPluginManager().callEvent(event);
String text = ChatColor.GOLD + getTitle() + "\n"; String text = ChatColor.GOLD + getTitle() + "\n";
for (int i = 1; i <= size; i++) { for (int i = 1; i <= size; i++) {
@ -202,21 +202,21 @@ public class QuestFactory implements ConversationAbandonedListener {
return new QuestSelectCreatePrompt(); return new QuestSelectCreatePrompt();
} else { } else {
player.sendMessage(ChatColor.RED + Lang.get("noPermission")); player.sendMessage(ChatColor.RED + Lang.get("noPermission"));
return new MainMenuPrompt(); return new QuestMenuPrompt();
} }
case 2: case 2:
if (player.hasPermission("quests.editor.*") || player.hasPermission("quests.editor.edit")) { if (player.hasPermission("quests.editor.*") || player.hasPermission("quests.editor.edit")) {
return new QuestSelectEditPrompt(); return new QuestSelectEditPrompt();
} else { } else {
player.sendMessage(ChatColor.RED + Lang.get("noPermission")); player.sendMessage(ChatColor.RED + Lang.get("noPermission"));
return new MainMenuPrompt(); return new QuestMenuPrompt();
} }
case 3: case 3:
if (player.hasPermission("quests.editor.*") || player.hasPermission("quests.editor.delete")) { if (player.hasPermission("quests.editor.*") || player.hasPermission("quests.editor.delete")) {
return new QuestSelectDeletePrompt(); return new QuestSelectDeletePrompt();
} else { } else {
player.sendMessage(ChatColor.RED + Lang.get("noPermission")); player.sendMessage(ChatColor.RED + Lang.get("noPermission"));
return new MainMenuPrompt(); return new QuestMenuPrompt();
} }
case 4: case 4:
context.getForWhom().sendRawMessage(ChatColor.YELLOW + Lang.get("exited")); context.getForWhom().sendRawMessage(ChatColor.YELLOW + Lang.get("exited"));
@ -228,10 +228,10 @@ public class QuestFactory implements ConversationAbandonedListener {
} }
public Prompt returnToMenu() { public Prompt returnToMenu() {
return new CreateMenuPrompt(); return new QuestMainPrompt();
} }
public class CreateMenuPrompt extends NumericPrompt { public class QuestMainPrompt extends NumericPrompt {
private final int size = 15; private final int size = 15;
public int getSize() { public int getSize() {
@ -426,7 +426,7 @@ public class QuestFactory implements ConversationAbandonedListener {
@Override @Override
public String getPromptText(ConversationContext context) { public String getPromptText(ConversationContext context) {
QuestsEditorPostOpenCreatePromptEvent event = new QuestsEditorPostOpenCreatePromptEvent(context); QuestsEditorPostOpenMainPromptEvent event = new QuestsEditorPostOpenMainPromptEvent(context);
plugin.getServer().getPluginManager().callEvent(event); plugin.getServer().getPluginManager().callEvent(event);
String text = ChatColor.GOLD + "- " + getTitle(context).replaceFirst(": ", ": " + ChatColor.AQUA) String text = ChatColor.GOLD + "- " + getTitle(context).replaceFirst(": ", ": " + ChatColor.AQUA)
@ -451,7 +451,7 @@ public class QuestFactory implements ConversationAbandonedListener {
if (plugin.getDependencies().getCitizens() != null) { if (plugin.getDependencies().getCitizens() != null) {
return new NPCStartPrompt(); return new NPCStartPrompt();
} else { } else {
return new CreateMenuPrompt(); return new QuestMainPrompt();
} }
case 5: case 5:
selectedBlockStarts.put(((Player) context.getForWhom()).getUniqueId(), null); selectedBlockStarts.put(((Player) context.getForWhom()).getUniqueId(), null);
@ -460,7 +460,7 @@ public class QuestFactory implements ConversationAbandonedListener {
if (plugin.getDependencies().getWorldGuardApi() != null) { if (plugin.getDependencies().getWorldGuardApi() != null) {
return new RegionPrompt(); return new RegionPrompt();
} else { } else {
return new CreateMenuPrompt(); return new QuestMainPrompt();
} }
case 7: case 7:
return new InitialActionPrompt(); return new InitialActionPrompt();
@ -468,7 +468,7 @@ public class QuestFactory implements ConversationAbandonedListener {
if (plugin.getDependencies().getCitizens() != null) { if (plugin.getDependencies().getCitizens() != null) {
return new GUIDisplayPrompt(plugin, QuestFactory.this); return new GUIDisplayPrompt(plugin, QuestFactory.this);
} else { } else {
return new CreateMenuPrompt(); return new QuestMainPrompt();
} }
case 9: case 9:
return new RequirementsPrompt(plugin, QuestFactory.this); return new RequirementsPrompt(plugin, QuestFactory.this);
@ -529,9 +529,9 @@ public class QuestFactory implements ConversationAbandonedListener {
} }
context.setSessionData(CK.Q_NAME, input); context.setSessionData(CK.Q_NAME, input);
names.add(input); names.add(input);
return new CreateMenuPrompt(); return new QuestMainPrompt();
} else { } else {
return new MainMenuPrompt(); return new QuestMenuPrompt();
} }
} }
} }
@ -553,11 +553,11 @@ public class QuestFactory implements ConversationAbandonedListener {
Quest q = plugin.getQuest(input); Quest q = plugin.getQuest(input);
if (q != null) { if (q != null) {
loadQuest(context, q); loadQuest(context, q);
return new CreateMenuPrompt(); return new QuestMainPrompt();
} }
return new QuestSelectEditPrompt(); return new QuestSelectEditPrompt();
} else { } else {
return new MainMenuPrompt(); return new QuestMenuPrompt();
} }
} }
} }
@ -982,7 +982,7 @@ public class QuestFactory implements ConversationAbandonedListener {
((Player) context.getForWhom()).sendMessage(ChatColor.RED + Lang.get("questEditorQuestNotFound")); ((Player) context.getForWhom()).sendMessage(ChatColor.RED + Lang.get("questEditorQuestNotFound"));
return new QuestSelectDeletePrompt(); return new QuestSelectDeletePrompt();
} else { } else {
return new MainMenuPrompt(); return new QuestMenuPrompt();
} }
} }
} }
@ -1005,7 +1005,7 @@ public class QuestFactory implements ConversationAbandonedListener {
deleteQuest(context); deleteQuest(context);
return Prompt.END_OF_CONVERSATION; return Prompt.END_OF_CONVERSATION;
} else if (input.equalsIgnoreCase("2") || input.equalsIgnoreCase(Lang.get("noWord"))) { } else if (input.equalsIgnoreCase("2") || input.equalsIgnoreCase(Lang.get("noWord"))) {
return new MainMenuPrompt(); return new QuestMenuPrompt();
} else { } else {
return new QuestConfirmDeletePrompt(); return new QuestConfirmDeletePrompt();
} }
@ -1077,7 +1077,7 @@ public class QuestFactory implements ConversationAbandonedListener {
context.setSessionData(CK.Q_NAME, input); context.setSessionData(CK.Q_NAME, input);
names.add(input); names.add(input);
} }
return new CreateMenuPrompt(); return new QuestMainPrompt();
} }
} }
@ -1095,12 +1095,12 @@ public class QuestFactory implements ConversationAbandonedListener {
if (context.getSessionData(CK.Q_ASK_MESSAGE) != null) { if (context.getSessionData(CK.Q_ASK_MESSAGE) != null) {
context.setSessionData(CK.Q_ASK_MESSAGE, context.getSessionData(CK.Q_ASK_MESSAGE) + " " context.setSessionData(CK.Q_ASK_MESSAGE, context.getSessionData(CK.Q_ASK_MESSAGE) + " "
+ input.substring(2)); + input.substring(2));
return new CreateMenuPrompt(); return new QuestMainPrompt();
} }
} }
context.setSessionData(CK.Q_ASK_MESSAGE, input); context.setSessionData(CK.Q_ASK_MESSAGE, input);
} }
return new CreateMenuPrompt(); return new QuestMainPrompt();
} }
} }
@ -1118,12 +1118,12 @@ public class QuestFactory implements ConversationAbandonedListener {
if (context.getSessionData(CK.Q_FINISH_MESSAGE) != null) { if (context.getSessionData(CK.Q_FINISH_MESSAGE) != null) {
context.setSessionData(CK.Q_FINISH_MESSAGE, context.getSessionData(CK.Q_FINISH_MESSAGE) + " " context.setSessionData(CK.Q_FINISH_MESSAGE, context.getSessionData(CK.Q_FINISH_MESSAGE) + " "
+ input.substring(2)); + input.substring(2));
return new CreateMenuPrompt(); return new QuestMainPrompt();
} }
} }
context.setSessionData(CK.Q_FINISH_MESSAGE, input); context.setSessionData(CK.Q_FINISH_MESSAGE, input);
} }
return new CreateMenuPrompt(); return new QuestMainPrompt();
} }
} }
@ -1149,7 +1149,7 @@ public class QuestFactory implements ConversationAbandonedListener {
} }
context.setSessionData(CK.Q_START_NPC, i); context.setSessionData(CK.Q_START_NPC, i);
selectingNpcs.remove((Player) context.getForWhom()); selectingNpcs.remove((Player) context.getForWhom());
return new CreateMenuPrompt(); return new QuestMainPrompt();
} }
} catch (NumberFormatException e) { } catch (NumberFormatException e) {
context.getForWhom().sendRawMessage(ChatColor.RED context.getForWhom().sendRawMessage(ChatColor.RED
@ -1160,7 +1160,7 @@ public class QuestFactory implements ConversationAbandonedListener {
context.setSessionData(CK.Q_START_NPC, null); context.setSessionData(CK.Q_START_NPC, null);
} }
selectingNpcs.remove((Player) context.getForWhom()); selectingNpcs.remove((Player) context.getForWhom());
return new CreateMenuPrompt(); return new QuestMainPrompt();
} }
} }
@ -1188,11 +1188,11 @@ public class QuestFactory implements ConversationAbandonedListener {
} else { } else {
selectedBlockStarts.remove(player.getUniqueId()); selectedBlockStarts.remove(player.getUniqueId());
} }
return new CreateMenuPrompt(); return new QuestMainPrompt();
} else if (input.equalsIgnoreCase(Lang.get("cmdClear"))) { } else if (input.equalsIgnoreCase(Lang.get("cmdClear"))) {
selectedBlockStarts.remove(player.getUniqueId()); selectedBlockStarts.remove(player.getUniqueId());
context.setSessionData(CK.Q_START_BLOCK, null); context.setSessionData(CK.Q_START_BLOCK, null);
return new CreateMenuPrompt(); return new QuestMainPrompt();
} }
return new BlockStartPrompt(); return new BlockStartPrompt();
} }
@ -1249,14 +1249,14 @@ public class QuestFactory implements ConversationAbandonedListener {
return new RegionPrompt(); return new RegionPrompt();
} else { } else {
context.setSessionData(CK.Q_REGION, found); context.setSessionData(CK.Q_REGION, found);
return new CreateMenuPrompt(); return new QuestMainPrompt();
} }
} else if (input.equalsIgnoreCase(Lang.get("cmdClear"))) { } else if (input.equalsIgnoreCase(Lang.get("cmdClear"))) {
context.setSessionData(CK.Q_REGION, null); context.setSessionData(CK.Q_REGION, null);
player.sendMessage(ChatColor.YELLOW + Lang.get("questWGRegionCleared")); player.sendMessage(ChatColor.YELLOW + Lang.get("questWGRegionCleared"));
return new CreateMenuPrompt(); return new QuestMainPrompt();
} else { } else {
return new CreateMenuPrompt(); return new QuestMainPrompt();
} }
} }
} }
@ -1284,7 +1284,7 @@ public class QuestFactory implements ConversationAbandonedListener {
Action a = plugin.getAction(input); Action a = plugin.getAction(input);
if (a != null) { if (a != null) {
context.setSessionData(CK.Q_INITIAL_EVENT, a.getName()); context.setSessionData(CK.Q_INITIAL_EVENT, a.getName());
return new CreateMenuPrompt(); return new QuestMainPrompt();
} }
player.sendMessage(ChatColor.RED + input + ChatColor.YELLOW + " " player.sendMessage(ChatColor.RED + input + ChatColor.YELLOW + " "
+ Lang.get("questEditorInvalidEventName")); + Lang.get("questEditorInvalidEventName"));
@ -1292,9 +1292,9 @@ public class QuestFactory implements ConversationAbandonedListener {
} else if (input.equalsIgnoreCase(Lang.get("cmdClear"))) { } else if (input.equalsIgnoreCase(Lang.get("cmdClear"))) {
context.setSessionData(CK.Q_INITIAL_EVENT, null); context.setSessionData(CK.Q_INITIAL_EVENT, null);
player.sendMessage(ChatColor.YELLOW + Lang.get("questEditorEventCleared")); player.sendMessage(ChatColor.YELLOW + Lang.get("questEditorEventCleared"));
return new CreateMenuPrompt(); return new QuestMainPrompt();
} else { } else {
return new CreateMenuPrompt(); return new QuestMainPrompt();
} }
} }
} }
@ -1352,13 +1352,13 @@ public class QuestFactory implements ConversationAbandonedListener {
if (input.equalsIgnoreCase("1") || input.equalsIgnoreCase(Lang.get("yesWord"))) { if (input.equalsIgnoreCase("1") || input.equalsIgnoreCase(Lang.get("yesWord"))) {
if (context.getSessionData(CK.Q_ASK_MESSAGE) == null) { if (context.getSessionData(CK.Q_ASK_MESSAGE) == null) {
context.getForWhom().sendRawMessage(ChatColor.RED + Lang.get("questEditorNeedAskMessage")); context.getForWhom().sendRawMessage(ChatColor.RED + Lang.get("questEditorNeedAskMessage"));
return new CreateMenuPrompt(); return new QuestMainPrompt();
} else if (context.getSessionData(CK.Q_FINISH_MESSAGE) == null) { } else if (context.getSessionData(CK.Q_FINISH_MESSAGE) == null) {
context.getForWhom().sendRawMessage(ChatColor.RED + Lang.get("questEditorNeedFinishMessage")); context.getForWhom().sendRawMessage(ChatColor.RED + Lang.get("questEditorNeedFinishMessage"));
return new CreateMenuPrompt(); return new QuestMainPrompt();
} else if (new StagesPrompt(plugin, QuestFactory.this).getStages(context) == 0) { } else if (new StagesPrompt(plugin, QuestFactory.this).getStages(context) == 0) {
context.getForWhom().sendRawMessage(ChatColor.RED + Lang.get("questEditorNeedStages")); context.getForWhom().sendRawMessage(ChatColor.RED + Lang.get("questEditorNeedStages"));
return new CreateMenuPrompt(); return new QuestMainPrompt();
} }
FileConfiguration data = new YamlConfiguration(); FileConfiguration data = new YamlConfiguration();
try { try {
@ -1388,7 +1388,7 @@ public class QuestFactory implements ConversationAbandonedListener {
} }
return Prompt.END_OF_CONVERSATION; return Prompt.END_OF_CONVERSATION;
} else if (input.equalsIgnoreCase("2") || input.equalsIgnoreCase(Lang.get("noWord"))) { } else if (input.equalsIgnoreCase("2") || input.equalsIgnoreCase(Lang.get("noWord"))) {
return new CreateMenuPrompt(); return new QuestMainPrompt();
} else { } else {
return new SavePrompt(); return new SavePrompt();
} }
@ -1448,7 +1448,7 @@ public class QuestFactory implements ConversationAbandonedListener {
context.getForWhom().sendRawMessage(ChatColor.BOLD + "" + ChatColor.YELLOW + Lang.get("exited")); context.getForWhom().sendRawMessage(ChatColor.BOLD + "" + ChatColor.YELLOW + Lang.get("exited"));
return Prompt.END_OF_CONVERSATION; return Prompt.END_OF_CONVERSATION;
} else if (input.equalsIgnoreCase("2") || input.equalsIgnoreCase(Lang.get("noWord"))) { } else if (input.equalsIgnoreCase("2") || input.equalsIgnoreCase(Lang.get("noWord"))) {
return new CreateMenuPrompt(); return new QuestMainPrompt();
} else { } else {
return new ExitPrompt(); return new ExitPrompt();
} }

View File

@ -51,7 +51,7 @@ import me.blackvein.quests.QuestMob;
import me.blackvein.quests.Quester; import me.blackvein.quests.Quester;
import me.blackvein.quests.Quests; import me.blackvein.quests.Quests;
import me.blackvein.quests.Stage; import me.blackvein.quests.Stage;
import me.blackvein.quests.events.editor.actions.ActionsEditorPostOpenCreatePromptEvent; import me.blackvein.quests.events.editor.actions.ActionsEditorPostOpenMainPromptEvent;
import me.blackvein.quests.events.editor.actions.ActionsEditorPostOpenMenuPromptEvent; import me.blackvein.quests.events.editor.actions.ActionsEditorPostOpenMenuPromptEvent;
import me.blackvein.quests.prompts.ItemStackPrompt; import me.blackvein.quests.prompts.ItemStackPrompt;
import me.blackvein.quests.util.CK; import me.blackvein.quests.util.CK;
@ -78,7 +78,7 @@ public class ActionFactory implements ConversationAbandonedListener {
actionsFile = new File(plugin.getDataFolder(), "actions.yml"); actionsFile = new File(plugin.getDataFolder(), "actions.yml");
// Ensure to initialize convoCreator last so that 'this' is fully initialized before it is passed // Ensure to initialize convoCreator last so that 'this' is fully initialized before it is passed
this.convoCreator = new ConversationFactory(plugin).withModality(false).withLocalEcho(false) this.convoCreator = new ConversationFactory(plugin).withModality(false).withLocalEcho(false)
.withPrefix(new QuestCreatorPrefix()).withFirstPrompt(new MenuPrompt()).withTimeout(3600) .withPrefix(new QuestCreatorPrefix()).withFirstPrompt(new ActionMenuPrompt()).withTimeout(3600)
.thatExcludesNonPlayersWithMessage("Console may not perform this operation!") .thatExcludesNonPlayersWithMessage("Console may not perform this operation!")
.addConversationAbandonedListener(this); .addConversationAbandonedListener(this);
} }
@ -148,7 +148,7 @@ public class ActionFactory implements ConversationAbandonedListener {
} }
} }
public class MenuPrompt extends NumericPrompt { public class ActionMenuPrompt extends NumericPrompt {
private final int size = 4; private final int size = 4;
public int getSize() { public int getSize() {
@ -210,7 +210,7 @@ public class ActionFactory implements ConversationAbandonedListener {
return new ActionSelectCreatePrompt(); return new ActionSelectCreatePrompt();
} else { } else {
player.sendMessage(ChatColor.RED + Lang.get("noPermission")); player.sendMessage(ChatColor.RED + Lang.get("noPermission"));
return new MenuPrompt(); return new ActionMenuPrompt();
} }
case 2: case 2:
if (player.hasPermission("quests.editor.actions.edit") if (player.hasPermission("quests.editor.actions.edit")
@ -218,13 +218,13 @@ public class ActionFactory implements ConversationAbandonedListener {
if (plugin.getActions().isEmpty()) { if (plugin.getActions().isEmpty()) {
((Player) context.getForWhom()).sendMessage(ChatColor.YELLOW ((Player) context.getForWhom()).sendMessage(ChatColor.YELLOW
+ Lang.get("eventEditorNoneToEdit")); + Lang.get("eventEditorNoneToEdit"));
return new MenuPrompt(); return new ActionMenuPrompt();
} else { } else {
return new ActionSelectEditPrompt(); return new ActionSelectEditPrompt();
} }
} else { } else {
player.sendMessage(ChatColor.RED + Lang.get("noPermission")); player.sendMessage(ChatColor.RED + Lang.get("noPermission"));
return new MenuPrompt(); return new ActionMenuPrompt();
} }
case 3: case 3:
if (player.hasPermission("quests.editor.actions.delete") if (player.hasPermission("quests.editor.actions.delete")
@ -232,13 +232,13 @@ public class ActionFactory implements ConversationAbandonedListener {
if (plugin.getActions().isEmpty()) { if (plugin.getActions().isEmpty()) {
((Player) context.getForWhom()).sendMessage(ChatColor.YELLOW ((Player) context.getForWhom()).sendMessage(ChatColor.YELLOW
+ Lang.get("eventEditorNoneToDelete")); + Lang.get("eventEditorNoneToDelete"));
return new MenuPrompt(); return new ActionMenuPrompt();
} else { } else {
return new ActionSelectDeletePrompt(); return new ActionSelectDeletePrompt();
} }
} else { } else {
player.sendMessage(ChatColor.RED + Lang.get("noPermission")); player.sendMessage(ChatColor.RED + Lang.get("noPermission"));
return new MenuPrompt(); return new ActionMenuPrompt();
} }
case 4: case 4:
((Player) context.getForWhom()).sendMessage(ChatColor.YELLOW + Lang.get("exited")); ((Player) context.getForWhom()).sendMessage(ChatColor.YELLOW + Lang.get("exited"));
@ -250,10 +250,10 @@ public class ActionFactory implements ConversationAbandonedListener {
} }
public Prompt returnToMenu() { public Prompt returnToMenu() {
return new CreateMenuPrompt(); return new ActionMainPrompt();
} }
public class CreateMenuPrompt extends NumericPrompt { public class ActionMainPrompt extends NumericPrompt {
private final int size = 9; private final int size = 9;
public int getSize() { public int getSize() {
@ -347,7 +347,7 @@ public class ActionFactory implements ConversationAbandonedListener {
@Override @Override
public String getPromptText(ConversationContext context) { public String getPromptText(ConversationContext context) {
ActionsEditorPostOpenCreatePromptEvent event = new ActionsEditorPostOpenCreatePromptEvent(context); ActionsEditorPostOpenMainPromptEvent event = new ActionsEditorPostOpenMainPromptEvent(context);
plugin.getServer().getPluginManager().callEvent(event); plugin.getServer().getPluginManager().callEvent(event);
String text = ChatColor.GOLD + "- " + getTitle(context).replaceFirst(": ", ": " + ChatColor.AQUA) String text = ChatColor.GOLD + "- " + getTitle(context).replaceFirst(": ", ": " + ChatColor.AQUA)
@ -381,7 +381,7 @@ public class ActionFactory implements ConversationAbandonedListener {
} else { } else {
context.setSessionData(CK.E_FAIL_QUEST, Lang.get("yesWord")); context.setSessionData(CK.E_FAIL_QUEST, Lang.get("yesWord"));
} }
return new CreateMenuPrompt(); return new ActionMainPrompt();
case 8: case 8:
if (context.getSessionData(CK.E_OLD_EVENT) != null) { if (context.getSessionData(CK.E_OLD_EVENT) != null) {
return new SavePrompt((String) context.getSessionData(CK.E_OLD_EVENT)); return new SavePrompt((String) context.getSessionData(CK.E_OLD_EVENT));
@ -424,9 +424,9 @@ public class ActionFactory implements ConversationAbandonedListener {
} }
context.setSessionData(CK.E_NAME, input); context.setSessionData(CK.E_NAME, input);
names.add(input); names.add(input);
return new CreateMenuPrompt(); return new ActionMainPrompt();
} else { } else {
return new MenuPrompt(); return new ActionMenuPrompt();
} }
} }
} }
@ -452,12 +452,12 @@ public class ActionFactory implements ConversationAbandonedListener {
context.setSessionData(CK.E_OLD_EVENT, a.getName()); context.setSessionData(CK.E_OLD_EVENT, a.getName());
context.setSessionData(CK.E_NAME, a.getName()); context.setSessionData(CK.E_NAME, a.getName());
loadData(a, context); loadData(a, context);
return new CreateMenuPrompt(); return new ActionMainPrompt();
} }
((Player) context.getForWhom()).sendMessage(ChatColor.RED + Lang.get("eventEditorNotFound")); ((Player) context.getForWhom()).sendMessage(ChatColor.RED + Lang.get("eventEditorNotFound"));
return new ActionSelectEditPrompt(); return new ActionSelectEditPrompt();
} else { } else {
return new MenuPrompt(); return new ActionMenuPrompt();
} }
} }
} }
@ -601,7 +601,7 @@ public class ActionFactory implements ConversationAbandonedListener {
((Player) context.getForWhom()).sendMessage(ChatColor.RED + Lang.get("eventEditorNotFound")); ((Player) context.getForWhom()).sendMessage(ChatColor.RED + Lang.get("eventEditorNotFound"));
return new ActionSelectDeletePrompt(); return new ActionSelectDeletePrompt();
} else { } else {
return new MenuPrompt(); return new ActionMenuPrompt();
} }
} }
} }
@ -622,9 +622,9 @@ public class ActionFactory implements ConversationAbandonedListener {
public Prompt acceptInput(ConversationContext context, String input) { public Prompt acceptInput(ConversationContext context, String input) {
if (input.equalsIgnoreCase("1") || input.equalsIgnoreCase(Lang.get("yesWord"))) { if (input.equalsIgnoreCase("1") || input.equalsIgnoreCase(Lang.get("yesWord"))) {
deleteAction(context); deleteAction(context);
return new MenuPrompt(); return new ActionMenuPrompt();
} else if (input.equalsIgnoreCase("2") || input.equalsIgnoreCase(Lang.get("noWord"))) { } else if (input.equalsIgnoreCase("2") || input.equalsIgnoreCase(Lang.get("noWord"))) {
return new MenuPrompt(); return new ActionMenuPrompt();
} else { } else {
return new ActionConfirmDeletePrompt(); return new ActionConfirmDeletePrompt();
} }
@ -743,7 +743,7 @@ public class ActionFactory implements ConversationAbandonedListener {
} else { } else {
context.setSessionData(CK.E_CLEAR_INVENTORY, Lang.get("yesWord")); context.setSessionData(CK.E_CLEAR_INVENTORY, Lang.get("yesWord"));
} }
return new CreateMenuPrompt(); return new ActionMainPrompt();
} else if (input.equalsIgnoreCase("3")) { } else if (input.equalsIgnoreCase("3")) {
return new ItemListPrompt(); return new ItemListPrompt();
} else if (input.equalsIgnoreCase("4")) { } else if (input.equalsIgnoreCase("4")) {
@ -760,7 +760,7 @@ public class ActionFactory implements ConversationAbandonedListener {
} else if (input.equalsIgnoreCase("9")) { } else if (input.equalsIgnoreCase("9")) {
return new CommandsPrompt(); return new CommandsPrompt();
} }
return new CreateMenuPrompt(); return new ActionMainPrompt();
} }
} }
@ -803,9 +803,9 @@ public class ActionFactory implements ConversationAbandonedListener {
} else { } else {
context.setSessionData(CK.E_CANCEL_TIMER, Lang.get("yesWord")); context.setSessionData(CK.E_CANCEL_TIMER, Lang.get("yesWord"));
} }
return new CreateMenuPrompt(); return new ActionMainPrompt();
} }
return new CreateMenuPrompt(); return new ActionMainPrompt();
} }
} }
@ -856,7 +856,7 @@ public class ActionFactory implements ConversationAbandonedListener {
selectedExplosionLocations.put(((Player) context.getForWhom()).getUniqueId(), null); selectedExplosionLocations.put(((Player) context.getForWhom()).getUniqueId(), null);
return new ExplosionPrompt(); return new ExplosionPrompt();
} }
return new CreateMenuPrompt(); return new ActionMainPrompt();
} }
} }
@ -917,7 +917,7 @@ public class ActionFactory implements ConversationAbandonedListener {
selectedLightningLocations.put(((Player) context.getForWhom()).getUniqueId(), null); selectedLightningLocations.put(((Player) context.getForWhom()).getUniqueId(), null);
return new LightningPrompt(); return new LightningPrompt();
} }
return new CreateMenuPrompt(); return new ActionMainPrompt();
} }
} }
@ -926,7 +926,7 @@ public class ActionFactory implements ConversationAbandonedListener {
@Override @Override
protected Prompt acceptValidatedInput(final ConversationContext context, final Number number) { protected Prompt acceptValidatedInput(final ConversationContext context, final Number number) {
context.setSessionData(CK.E_TIMER, number); context.setSessionData(CK.E_TIMER, number);
return new CreateMenuPrompt(); return new ActionMainPrompt();
} }
@Override @Override
@ -974,9 +974,9 @@ public class ActionFactory implements ConversationAbandonedListener {
public Prompt acceptInput(ConversationContext context, String input) { public Prompt acceptInput(ConversationContext context, String input) {
if (input.equalsIgnoreCase("1") || input.equalsIgnoreCase(Lang.get("yesWord"))) { if (input.equalsIgnoreCase("1") || input.equalsIgnoreCase(Lang.get("yesWord"))) {
saveAction(context); saveAction(context);
return new MenuPrompt(); return new ActionMenuPrompt();
} else if (input.equalsIgnoreCase("2") || input.equalsIgnoreCase(Lang.get("noWord"))) { } else if (input.equalsIgnoreCase("2") || input.equalsIgnoreCase(Lang.get("noWord"))) {
return new CreateMenuPrompt(); return new ActionMainPrompt();
} else { } else {
return new SavePrompt(modName); return new SavePrompt(modName);
} }
@ -1000,7 +1000,7 @@ public class ActionFactory implements ConversationAbandonedListener {
clearData(context); clearData(context);
return Prompt.END_OF_CONVERSATION; return Prompt.END_OF_CONVERSATION;
} else if (input.equalsIgnoreCase("2") || input.equalsIgnoreCase(Lang.get("noWord"))) { } else if (input.equalsIgnoreCase("2") || input.equalsIgnoreCase(Lang.get("noWord"))) {
return new CreateMenuPrompt(); return new ActionMainPrompt();
} else { } else {
return new ExitPrompt(); return new ExitPrompt();
} }
@ -1297,14 +1297,14 @@ public class ActionFactory implements ConversationAbandonedListener {
player.sendMessage(ChatColor.RED + Lang.get("eventEditorSelectBlockFirst")); player.sendMessage(ChatColor.RED + Lang.get("eventEditorSelectBlockFirst"));
return new ExplosionPrompt(); return new ExplosionPrompt();
} }
return new CreateMenuPrompt(); return new ActionMainPrompt();
} else if (input.equalsIgnoreCase(Lang.get("cmdClear"))) { } else if (input.equalsIgnoreCase(Lang.get("cmdClear"))) {
context.setSessionData(CK.E_EXPLOSIONS, null); context.setSessionData(CK.E_EXPLOSIONS, null);
selectedExplosionLocations.remove(player.getUniqueId()); selectedExplosionLocations.remove(player.getUniqueId());
return new CreateMenuPrompt(); return new ActionMainPrompt();
} else if (input.equalsIgnoreCase(Lang.get("cmdCancel"))) { } else if (input.equalsIgnoreCase(Lang.get("cmdCancel"))) {
selectedExplosionLocations.remove(player.getUniqueId()); selectedExplosionLocations.remove(player.getUniqueId());
return new CreateMenuPrompt(); return new ActionMainPrompt();
} else { } else {
return new ExplosionPrompt(); return new ExplosionPrompt();
} }
@ -1339,7 +1339,7 @@ public class ActionFactory implements ConversationAbandonedListener {
context.setSessionData(CK.E_NAME, input); context.setSessionData(CK.E_NAME, input);
names.add(input); names.add(input);
} }
return new CreateMenuPrompt(); return new ActionMainPrompt();
} }
} }
@ -1358,7 +1358,7 @@ public class ActionFactory implements ConversationAbandonedListener {
} else if (input.equalsIgnoreCase(Lang.get("cmdClear"))) { } else if (input.equalsIgnoreCase(Lang.get("cmdClear"))) {
context.setSessionData(CK.E_MESSAGE, null); context.setSessionData(CK.E_MESSAGE, null);
} }
return new CreateMenuPrompt(); return new ActionMainPrompt();
} }
} }
@ -1415,7 +1415,7 @@ public class ActionFactory implements ConversationAbandonedListener {
context.setSessionData(CK.E_ITEMS, null); context.setSessionData(CK.E_ITEMS, null);
return new ItemListPrompt(); return new ItemListPrompt();
} else if (input.equalsIgnoreCase("3")) { } else if (input.equalsIgnoreCase("3")) {
return new CreateMenuPrompt(); return new ActionMainPrompt();
} }
return null; return null;
} }
@ -1499,7 +1499,7 @@ public class ActionFactory implements ConversationAbandonedListener {
two = 0; two = 0;
} }
if (one == two) { if (one == two) {
return new CreateMenuPrompt(); return new ActionMainPrompt();
} else { } else {
context.getForWhom().sendRawMessage(ChatColor.RED + Lang.get("listsNotSameSize")); context.getForWhom().sendRawMessage(ChatColor.RED + Lang.get("listsNotSameSize"));
return new SoundEffectListPrompt(); return new SoundEffectListPrompt();
@ -1664,7 +1664,7 @@ public class ActionFactory implements ConversationAbandonedListener {
context.getForWhom().sendRawMessage(ChatColor.RED + Lang.get("eventEditorMustSetStormDuration")); context.getForWhom().sendRawMessage(ChatColor.RED + Lang.get("eventEditorMustSetStormDuration"));
return new StormPrompt(); return new StormPrompt();
} else { } else {
return new CreateMenuPrompt(); return new ActionMainPrompt();
} }
} }
return null; return null;
@ -1780,7 +1780,7 @@ public class ActionFactory implements ConversationAbandonedListener {
context.getForWhom().sendRawMessage(ChatColor.RED + Lang.get("eventEditorMustSetThunderDuration")); context.getForWhom().sendRawMessage(ChatColor.RED + Lang.get("eventEditorMustSetThunderDuration"));
return new ThunderPrompt(); return new ThunderPrompt();
} else { } else {
return new CreateMenuPrompt(); return new ActionMainPrompt();
} }
} }
return null; return null;
@ -1878,7 +1878,7 @@ public class ActionFactory implements ConversationAbandonedListener {
context.setSessionData(CK.E_MOB_TYPES, null); context.setSessionData(CK.E_MOB_TYPES, null);
return new MobPrompt(); return new MobPrompt();
} else if (input.equalsIgnoreCase("3")) { } else if (input.equalsIgnoreCase("3")) {
return new CreateMenuPrompt(); return new ActionMainPrompt();
} }
} else { } else {
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
@ -1898,7 +1898,7 @@ public class ActionFactory implements ConversationAbandonedListener {
context.setSessionData(CK.E_MOB_TYPES, null); context.setSessionData(CK.E_MOB_TYPES, null);
return new MobPrompt(); return new MobPrompt();
} else if (inp == types.size() + 3) { } else if (inp == types.size() + 3) {
return new CreateMenuPrompt(); return new ActionMainPrompt();
} else if (inp > types.size()) { } else if (inp > types.size()) {
return new MobPrompt(); return new MobPrompt();
} else { } else {
@ -2289,14 +2289,14 @@ public class ActionFactory implements ConversationAbandonedListener {
player.sendMessage(ChatColor.RED + Lang.get("eventEditorSelectBlockFirst")); player.sendMessage(ChatColor.RED + Lang.get("eventEditorSelectBlockFirst"));
return new LightningPrompt(); return new LightningPrompt();
} }
return new CreateMenuPrompt(); return new ActionMainPrompt();
} else if (input.equalsIgnoreCase(Lang.get("cmdClear"))) { } else if (input.equalsIgnoreCase(Lang.get("cmdClear"))) {
context.setSessionData(CK.E_LIGHTNING, null); context.setSessionData(CK.E_LIGHTNING, null);
selectedLightningLocations.remove(player.getUniqueId()); selectedLightningLocations.remove(player.getUniqueId());
return new CreateMenuPrompt(); return new ActionMainPrompt();
} else if (input.equalsIgnoreCase(Lang.get("cmdCancel"))) { } else if (input.equalsIgnoreCase(Lang.get("cmdCancel"))) {
selectedLightningLocations.remove(player.getUniqueId()); selectedLightningLocations.remove(player.getUniqueId());
return new CreateMenuPrompt(); return new ActionMainPrompt();
} else { } else {
return new LightningPrompt(); return new LightningPrompt();
} }
@ -2410,7 +2410,7 @@ public class ActionFactory implements ConversationAbandonedListener {
three = 0; three = 0;
} }
if (one == two && two == three) { if (one == two && two == three) {
return new CreateMenuPrompt(); return new ActionMainPrompt();
} else { } else {
context.getForWhom().sendRawMessage(ChatColor.RED + Lang.get("eventEditorListSizeMismatch")); context.getForWhom().sendRawMessage(ChatColor.RED + Lang.get("eventEditorListSizeMismatch"));
return new PotionEffectPrompt(); return new PotionEffectPrompt();
@ -2541,7 +2541,7 @@ public class ActionFactory implements ConversationAbandonedListener {
} else { } else {
context.setSessionData(CK.E_HUNGER, null); context.setSessionData(CK.E_HUNGER, null);
} }
return new CreateMenuPrompt(); return new ActionMainPrompt();
} }
} }
@ -2572,7 +2572,7 @@ public class ActionFactory implements ConversationAbandonedListener {
} else { } else {
context.setSessionData(CK.E_SATURATION, null); context.setSessionData(CK.E_SATURATION, null);
} }
return new CreateMenuPrompt(); return new ActionMainPrompt();
} }
} }
@ -2603,7 +2603,7 @@ public class ActionFactory implements ConversationAbandonedListener {
} else { } else {
context.setSessionData(CK.E_HEALTH, null); context.setSessionData(CK.E_HEALTH, null);
} }
return new CreateMenuPrompt(); return new ActionMainPrompt();
} }
} }
@ -2627,14 +2627,14 @@ public class ActionFactory implements ConversationAbandonedListener {
player.sendMessage(ChatColor.RED + Lang.get("eventEditorSelectBlockFirst")); player.sendMessage(ChatColor.RED + Lang.get("eventEditorSelectBlockFirst"));
return new TeleportPrompt(); return new TeleportPrompt();
} }
return new CreateMenuPrompt(); return new ActionMainPrompt();
} else if (input.equalsIgnoreCase(Lang.get("cmdClear"))) { } else if (input.equalsIgnoreCase(Lang.get("cmdClear"))) {
context.setSessionData(CK.E_TELEPORT, null); context.setSessionData(CK.E_TELEPORT, null);
selectedTeleportLocations.remove(player.getUniqueId()); selectedTeleportLocations.remove(player.getUniqueId());
return new CreateMenuPrompt(); return new ActionMainPrompt();
} else if (input.equalsIgnoreCase(Lang.get("cmdCancel"))) { } else if (input.equalsIgnoreCase(Lang.get("cmdCancel"))) {
selectedTeleportLocations.remove(player.getUniqueId()); selectedTeleportLocations.remove(player.getUniqueId());
return new CreateMenuPrompt(); return new ActionMainPrompt();
} else { } else {
return new TeleportPrompt(); return new TeleportPrompt();
} }
@ -2660,7 +2660,7 @@ public class ActionFactory implements ConversationAbandonedListener {
} else if (input.equalsIgnoreCase(Lang.get("cmdClear"))) { } else if (input.equalsIgnoreCase(Lang.get("cmdClear"))) {
context.setSessionData(CK.E_COMMANDS, null); context.setSessionData(CK.E_COMMANDS, null);
} }
return new CreateMenuPrompt(); return new ActionMainPrompt();
} }
} }

View File

@ -3,10 +3,10 @@ package me.blackvein.quests.events.editor.actions;
import org.bukkit.conversations.ConversationContext; import org.bukkit.conversations.ConversationContext;
import org.bukkit.event.HandlerList; import org.bukkit.event.HandlerList;
public class ActionsEditorPostOpenCreatePromptEvent extends ActionsEditorEvent { public class ActionsEditorPostOpenMainPromptEvent extends ActionsEditorEvent {
private static final HandlerList handlers = new HandlerList(); private static final HandlerList handlers = new HandlerList();
public ActionsEditorPostOpenCreatePromptEvent(ConversationContext context) { public ActionsEditorPostOpenMainPromptEvent(ConversationContext context) {
super(context); super(context);
this.context = context; this.context = context;
} }

View File

@ -3,10 +3,10 @@ package me.blackvein.quests.events.editor.quests;
import org.bukkit.conversations.ConversationContext; import org.bukkit.conversations.ConversationContext;
import org.bukkit.event.HandlerList; import org.bukkit.event.HandlerList;
public class QuestsEditorPostOpenCreatePromptEvent extends QuestsEditorEvent { public class QuestsEditorPostOpenMenuPromptEvent extends QuestsEditorEvent {
private static final HandlerList handlers = new HandlerList(); private static final HandlerList handlers = new HandlerList();
public QuestsEditorPostOpenCreatePromptEvent(ConversationContext context) { public QuestsEditorPostOpenMenuPromptEvent(ConversationContext context) {
super(context); super(context);
this.context = context; this.context = context;
} }