mirror of
https://github.com/PikaMug/Quests.git
synced 2024-11-28 05:35:33 +01:00
Deprecate passing of factory objects to prompts
This commit is contained in:
parent
1c20d05cbe
commit
1090b7dbea
@ -80,7 +80,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 QuestMenuPrompt(plugin, null, this)).withTimeout(3600)
|
.withFirstPrompt(new QuestMenuPrompt(plugin, null)).withTimeout(3600)
|
||||||
.thatExcludesNonPlayersWithMessage("Console may not perform this operation!")
|
.thatExcludesNonPlayersWithMessage("Console may not perform this operation!")
|
||||||
.addConversationAbandonedListener(this);
|
.addConversationAbandonedListener(this);
|
||||||
}
|
}
|
||||||
@ -141,8 +141,8 @@ public class QuestFactory implements ConversationAbandonedListener {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public class QuestMenuPrompt extends QuestsEditorNumericPrompt {
|
public class QuestMenuPrompt extends QuestsEditorNumericPrompt {
|
||||||
public QuestMenuPrompt(Quests plugin, ConversationContext context, QuestFactory factory) {
|
public QuestMenuPrompt(Quests plugin, ConversationContext context) {
|
||||||
super(context, factory);
|
super(context);
|
||||||
}
|
}
|
||||||
|
|
||||||
private final int size = 4;
|
private final int size = 4;
|
||||||
@ -189,9 +189,9 @@ public class QuestFactory implements ConversationAbandonedListener {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getPromptText(ConversationContext context) {
|
public String getPromptText(ConversationContext context) {
|
||||||
QuestsEditorPostOpenNumericPromptEvent event
|
/*QuestsEditorPostOpenNumericPromptEvent event
|
||||||
= new QuestsEditorPostOpenNumericPromptEvent(context, QuestFactory.this, this);
|
= new QuestsEditorPostOpenNumericPromptEvent(context, QuestFactory.this, this);
|
||||||
plugin.getServer().getPluginManager().callEvent(event);
|
plugin.getServer().getPluginManager().callEvent(event);*/
|
||||||
String text = ChatColor.GOLD + getTitle(context) + "\n";
|
String text = ChatColor.GOLD + getTitle(context) + "\n";
|
||||||
for (int i = 1; i <= size; i++) {
|
for (int i = 1; i <= size; i++) {
|
||||||
text += getNumberColor(context, i) + "" + ChatColor.BOLD + i + ChatColor.RESET + " - "
|
text += getNumberColor(context, i) + "" + ChatColor.BOLD + i + ChatColor.RESET + " - "
|
||||||
@ -206,24 +206,24 @@ public class QuestFactory implements ConversationAbandonedListener {
|
|||||||
switch (input.intValue()) {
|
switch (input.intValue()) {
|
||||||
case 1:
|
case 1:
|
||||||
if (player.hasPermission("quests.editor.*") || player.hasPermission("quests.editor.create")) {
|
if (player.hasPermission("quests.editor.*") || player.hasPermission("quests.editor.create")) {
|
||||||
return new QuestSelectCreatePrompt(plugin, context, QuestFactory.this);
|
return new QuestSelectCreatePrompt(plugin, context);
|
||||||
} else {
|
} else {
|
||||||
player.sendMessage(ChatColor.RED + Lang.get("noPermission"));
|
player.sendMessage(ChatColor.RED + Lang.get("noPermission"));
|
||||||
return new QuestMenuPrompt(plugin, context, QuestFactory.this);
|
return new QuestMenuPrompt(plugin, context);
|
||||||
}
|
}
|
||||||
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 QuestMenuPrompt(plugin, context, QuestFactory.this);
|
return new QuestMenuPrompt(plugin, context);
|
||||||
}
|
}
|
||||||
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 QuestMenuPrompt(plugin, context, QuestFactory.this);
|
return new QuestMenuPrompt(plugin, context);
|
||||||
}
|
}
|
||||||
case 4:
|
case 4:
|
||||||
context.getForWhom().sendRawMessage(ChatColor.YELLOW + Lang.get("exited"));
|
context.getForWhom().sendRawMessage(ChatColor.YELLOW + Lang.get("exited"));
|
||||||
@ -235,12 +235,12 @@ public class QuestFactory implements ConversationAbandonedListener {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public Prompt returnToMenu(ConversationContext context) {
|
public Prompt returnToMenu(ConversationContext context) {
|
||||||
return new QuestMainPrompt(plugin, context, this);
|
return new QuestMainPrompt(plugin, context);
|
||||||
}
|
}
|
||||||
|
|
||||||
public class QuestMainPrompt extends QuestsEditorNumericPrompt {
|
public class QuestMainPrompt extends QuestsEditorNumericPrompt {
|
||||||
public QuestMainPrompt(Quests plugin, ConversationContext context, QuestFactory factory) {
|
public QuestMainPrompt(Quests plugin, ConversationContext context) {
|
||||||
super(context, factory);
|
super(context);
|
||||||
}
|
}
|
||||||
|
|
||||||
private final int size = 15;
|
private final int size = 15;
|
||||||
@ -439,8 +439,7 @@ public class QuestFactory implements ConversationAbandonedListener {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getPromptText(ConversationContext context) {
|
public String getPromptText(ConversationContext context) {
|
||||||
QuestsEditorPostOpenNumericPromptEvent event
|
QuestsEditorPostOpenNumericPromptEvent event = new QuestsEditorPostOpenNumericPromptEvent(context, this);
|
||||||
= new QuestsEditorPostOpenNumericPromptEvent(context, QuestFactory.this, this);
|
|
||||||
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)
|
||||||
@ -465,7 +464,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 QuestMainPrompt(plugin, context, QuestFactory.this);
|
return new QuestMainPrompt(plugin, context);
|
||||||
}
|
}
|
||||||
case 5:
|
case 5:
|
||||||
selectedBlockStarts.put(((Player) context.getForWhom()).getUniqueId(), null);
|
selectedBlockStarts.put(((Player) context.getForWhom()).getUniqueId(), null);
|
||||||
@ -474,30 +473,30 @@ 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 QuestMainPrompt(plugin, context, QuestFactory.this);
|
return new QuestMainPrompt(plugin, context);
|
||||||
}
|
}
|
||||||
case 7:
|
case 7:
|
||||||
return new InitialActionPrompt();
|
return new InitialActionPrompt();
|
||||||
case 8:
|
case 8:
|
||||||
if (plugin.getDependencies().getCitizens() != null) {
|
if (plugin.getDependencies().getCitizens() != null) {
|
||||||
return new GUIDisplayPrompt(plugin, context, QuestFactory.this);
|
return new GUIDisplayPrompt(plugin, context);
|
||||||
} else {
|
} else {
|
||||||
return new QuestMainPrompt(plugin, context, QuestFactory.this);
|
return new QuestMainPrompt(plugin, context);
|
||||||
}
|
}
|
||||||
case 9:
|
case 9:
|
||||||
return new RequirementsPrompt(plugin, context, QuestFactory.this);
|
return new RequirementsPrompt(plugin, context);
|
||||||
case 10:
|
case 10:
|
||||||
return new PlannerPrompt(plugin, context, QuestFactory.this);
|
return new PlannerPrompt(plugin, context);
|
||||||
case 11:
|
case 11:
|
||||||
return new StageMenuPrompt(plugin, context, QuestFactory.this);
|
return new StageMenuPrompt(plugin, context);
|
||||||
case 12:
|
case 12:
|
||||||
return new RewardsPrompt(plugin, context, QuestFactory.this);
|
return new RewardsPrompt(plugin, context);
|
||||||
case 13:
|
case 13:
|
||||||
return new OptionsPrompt(plugin, context, QuestFactory.this);
|
return new OptionsPrompt(plugin, context);
|
||||||
case 14:
|
case 14:
|
||||||
return new SavePrompt(plugin, context, QuestFactory.this);
|
return new SavePrompt(plugin, context);
|
||||||
case 15:
|
case 15:
|
||||||
return new ExitPrompt(plugin, context, QuestFactory.this);
|
return new ExitPrompt(plugin, context);
|
||||||
default:
|
default:
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
@ -505,8 +504,8 @@ public class QuestFactory implements ConversationAbandonedListener {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public class QuestSelectCreatePrompt extends QuestsEditorStringPrompt {
|
public class QuestSelectCreatePrompt extends QuestsEditorStringPrompt {
|
||||||
public QuestSelectCreatePrompt(Quests plugin, ConversationContext context, QuestFactory factory) {
|
public QuestSelectCreatePrompt(Quests plugin, ConversationContext context) {
|
||||||
super(context, factory);
|
super(context);
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getTitle(ConversationContext context) {
|
public String getTitle(ConversationContext context) {
|
||||||
@ -519,8 +518,7 @@ public class QuestFactory implements ConversationAbandonedListener {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getPromptText(ConversationContext context) {
|
public String getPromptText(ConversationContext context) {
|
||||||
QuestsEditorPostOpenStringPromptEvent event
|
QuestsEditorPostOpenStringPromptEvent event = new QuestsEditorPostOpenStringPromptEvent(context, this);
|
||||||
= new QuestsEditorPostOpenStringPromptEvent(context, QuestFactory.this, this);
|
|
||||||
plugin.getServer().getPluginManager().callEvent(event);
|
plugin.getServer().getPluginManager().callEvent(event);
|
||||||
|
|
||||||
String text = ChatColor.GOLD + getTitle(context)+ "\n" + ChatColor.YELLOW + getQueryText(context);
|
String text = ChatColor.GOLD + getTitle(context)+ "\n" + ChatColor.YELLOW + getQueryText(context);
|
||||||
@ -531,33 +529,33 @@ public class QuestFactory implements ConversationAbandonedListener {
|
|||||||
public Prompt acceptInput(ConversationContext context, String input) {
|
public Prompt acceptInput(ConversationContext context, String input) {
|
||||||
if (input == null) {
|
if (input == null) {
|
||||||
context.getForWhom().sendRawMessage(ChatColor.RED + Lang.get("itemCreateInvalidInput"));
|
context.getForWhom().sendRawMessage(ChatColor.RED + Lang.get("itemCreateInvalidInput"));
|
||||||
return new QuestSelectCreatePrompt(plugin, context, QuestFactory.this);
|
return new QuestSelectCreatePrompt(plugin, context);
|
||||||
}
|
}
|
||||||
input = input.trim();
|
input = input.trim();
|
||||||
if (input.equalsIgnoreCase(Lang.get("cmdCancel")) == false) {
|
if (input.equalsIgnoreCase(Lang.get("cmdCancel")) == false) {
|
||||||
for (Quest q : plugin.getQuests()) {
|
for (Quest q : plugin.getQuests()) {
|
||||||
if (q.getName().equalsIgnoreCase(input)) {
|
if (q.getName().equalsIgnoreCase(input)) {
|
||||||
context.getForWhom().sendRawMessage(ChatColor.RED + Lang.get("questEditorNameExists"));
|
context.getForWhom().sendRawMessage(ChatColor.RED + Lang.get("questEditorNameExists"));
|
||||||
return new QuestSelectCreatePrompt(plugin, context, QuestFactory.this);
|
return new QuestSelectCreatePrompt(plugin, context);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (names.contains(input)) {
|
if (names.contains(input)) {
|
||||||
context.getForWhom().sendRawMessage(ChatColor.RED + Lang.get("questEditorBeingEdited"));
|
context.getForWhom().sendRawMessage(ChatColor.RED + Lang.get("questEditorBeingEdited"));
|
||||||
return new QuestSelectCreatePrompt(plugin, context, QuestFactory.this);
|
return new QuestSelectCreatePrompt(plugin, context);
|
||||||
}
|
}
|
||||||
if (input.contains(".") || input.contains(",")) {
|
if (input.contains(".") || input.contains(",")) {
|
||||||
context.getForWhom().sendRawMessage(ChatColor.RED + Lang.get("questEditorInvalidQuestName"));
|
context.getForWhom().sendRawMessage(ChatColor.RED + Lang.get("questEditorInvalidQuestName"));
|
||||||
return new QuestSelectCreatePrompt(plugin, context, QuestFactory.this);
|
return new QuestSelectCreatePrompt(plugin, context);
|
||||||
}
|
}
|
||||||
if (input.equals("")) {
|
if (input.equals("")) {
|
||||||
context.getForWhom().sendRawMessage(ChatColor.RED + Lang.get("itemCreateInvalidInput"));
|
context.getForWhom().sendRawMessage(ChatColor.RED + Lang.get("itemCreateInvalidInput"));
|
||||||
return new QuestSelectCreatePrompt(plugin, context, QuestFactory.this);
|
return new QuestSelectCreatePrompt(plugin, context);
|
||||||
}
|
}
|
||||||
context.setSessionData(CK.Q_NAME, input);
|
context.setSessionData(CK.Q_NAME, input);
|
||||||
names.add(input);
|
names.add(input);
|
||||||
return new QuestMainPrompt(plugin, context, QuestFactory.this);
|
return new QuestMainPrompt(plugin, context);
|
||||||
} else {
|
} else {
|
||||||
return new QuestMenuPrompt(plugin, context, QuestFactory.this);
|
return new QuestMenuPrompt(plugin, context);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -579,11 +577,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 QuestMainPrompt(plugin, context, QuestFactory.this);
|
return new QuestMainPrompt(plugin, context);
|
||||||
}
|
}
|
||||||
return new QuestSelectEditPrompt();
|
return new QuestSelectEditPrompt();
|
||||||
} else {
|
} else {
|
||||||
return new QuestMenuPrompt(plugin, context, QuestFactory.this);
|
return new QuestMenuPrompt(plugin, context);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1018,7 +1016,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 QuestMenuPrompt(plugin, context, QuestFactory.this);
|
return new QuestMenuPrompt(plugin, context);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1041,7 +1039,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 QuestMenuPrompt(plugin, context, QuestFactory.this);
|
return new QuestMenuPrompt(plugin, context);
|
||||||
} else {
|
} else {
|
||||||
return new QuestConfirmDeletePrompt();
|
return new QuestConfirmDeletePrompt();
|
||||||
}
|
}
|
||||||
@ -1107,13 +1105,13 @@ public class QuestFactory implements ConversationAbandonedListener {
|
|||||||
}
|
}
|
||||||
if (input.contains(",")) {
|
if (input.contains(",")) {
|
||||||
context.getForWhom().sendRawMessage(ChatColor.RED + Lang.get("questEditorInvalidQuestName"));
|
context.getForWhom().sendRawMessage(ChatColor.RED + Lang.get("questEditorInvalidQuestName"));
|
||||||
return new QuestSelectCreatePrompt(plugin, context, QuestFactory.this);
|
return new QuestSelectCreatePrompt(plugin, context);
|
||||||
}
|
}
|
||||||
names.remove((String) context.getSessionData(CK.Q_NAME));
|
names.remove((String) context.getSessionData(CK.Q_NAME));
|
||||||
context.setSessionData(CK.Q_NAME, input);
|
context.setSessionData(CK.Q_NAME, input);
|
||||||
names.add(input);
|
names.add(input);
|
||||||
}
|
}
|
||||||
return new QuestMainPrompt(plugin, context, QuestFactory.this);
|
return new QuestMainPrompt(plugin, context);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1131,12 +1129,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 QuestMainPrompt(plugin, context, QuestFactory.this);
|
return new QuestMainPrompt(plugin, context);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
context.setSessionData(CK.Q_ASK_MESSAGE, input);
|
context.setSessionData(CK.Q_ASK_MESSAGE, input);
|
||||||
}
|
}
|
||||||
return new QuestMainPrompt(plugin, context, QuestFactory.this);
|
return new QuestMainPrompt(plugin, context);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1154,12 +1152,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 QuestMainPrompt(plugin, context, QuestFactory.this);
|
return new QuestMainPrompt(plugin, context);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
context.setSessionData(CK.Q_FINISH_MESSAGE, input);
|
context.setSessionData(CK.Q_FINISH_MESSAGE, input);
|
||||||
}
|
}
|
||||||
return new QuestMainPrompt(plugin, context, QuestFactory.this);
|
return new QuestMainPrompt(plugin, context);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1185,7 +1183,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 QuestMainPrompt(plugin, context, QuestFactory.this);
|
return new QuestMainPrompt(plugin, context);
|
||||||
}
|
}
|
||||||
} catch (NumberFormatException e) {
|
} catch (NumberFormatException e) {
|
||||||
context.getForWhom().sendRawMessage(ChatColor.RED
|
context.getForWhom().sendRawMessage(ChatColor.RED
|
||||||
@ -1196,7 +1194,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 QuestMainPrompt(plugin, context, QuestFactory.this);
|
return new QuestMainPrompt(plugin, context);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1224,11 +1222,11 @@ public class QuestFactory implements ConversationAbandonedListener {
|
|||||||
} else {
|
} else {
|
||||||
selectedBlockStarts.remove(player.getUniqueId());
|
selectedBlockStarts.remove(player.getUniqueId());
|
||||||
}
|
}
|
||||||
return new QuestMainPrompt(plugin, context, QuestFactory.this);
|
return new QuestMainPrompt(plugin, context);
|
||||||
} 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 QuestMainPrompt(plugin, context, QuestFactory.this);
|
return new QuestMainPrompt(plugin, context);
|
||||||
}
|
}
|
||||||
return new BlockStartPrompt();
|
return new BlockStartPrompt();
|
||||||
}
|
}
|
||||||
@ -1285,14 +1283,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 QuestMainPrompt(plugin, context, QuestFactory.this);
|
return new QuestMainPrompt(plugin, context);
|
||||||
}
|
}
|
||||||
} 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 QuestMainPrompt(plugin, context, QuestFactory.this);
|
return new QuestMainPrompt(plugin, context);
|
||||||
} else {
|
} else {
|
||||||
return new QuestMainPrompt(plugin, context, QuestFactory.this);
|
return new QuestMainPrompt(plugin, context);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1320,7 +1318,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 QuestMainPrompt(plugin, context, QuestFactory.this);
|
return new QuestMainPrompt(plugin, context);
|
||||||
}
|
}
|
||||||
player.sendMessage(ChatColor.RED + input + ChatColor.YELLOW + " "
|
player.sendMessage(ChatColor.RED + input + ChatColor.YELLOW + " "
|
||||||
+ Lang.get("questEditorInvalidEventName"));
|
+ Lang.get("questEditorInvalidEventName"));
|
||||||
@ -1328,16 +1326,16 @@ 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 QuestMainPrompt(plugin, context, QuestFactory.this);
|
return new QuestMainPrompt(plugin, context);
|
||||||
} else {
|
} else {
|
||||||
return new QuestMainPrompt(plugin, context, QuestFactory.this);
|
return new QuestMainPrompt(plugin, context);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public class SavePrompt extends QuestsEditorStringPrompt {
|
public class SavePrompt extends QuestsEditorStringPrompt {
|
||||||
public SavePrompt(Quests plugin, ConversationContext context, QuestFactory factory) {
|
public SavePrompt(Quests plugin, ConversationContext context) {
|
||||||
super(context, factory);
|
super(context);
|
||||||
}
|
}
|
||||||
|
|
||||||
private final int size = 2;
|
private final int size = 2;
|
||||||
@ -1379,8 +1377,7 @@ public class QuestFactory implements ConversationAbandonedListener {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getPromptText(ConversationContext context) {
|
public String getPromptText(ConversationContext context) {
|
||||||
QuestsEditorPostOpenStringPromptEvent event
|
QuestsEditorPostOpenStringPromptEvent event = new QuestsEditorPostOpenStringPromptEvent(context, this);
|
||||||
= new QuestsEditorPostOpenStringPromptEvent(context, QuestFactory.this, this);
|
|
||||||
plugin.getServer().getPluginManager().callEvent(event);
|
plugin.getServer().getPluginManager().callEvent(event);
|
||||||
|
|
||||||
String text = getQueryText(context) + "\n";
|
String text = getQueryText(context) + "\n";
|
||||||
@ -1396,13 +1393,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 QuestMainPrompt(plugin, context, QuestFactory.this);
|
return new QuestMainPrompt(plugin, context);
|
||||||
} 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 QuestMainPrompt(plugin, context, QuestFactory.this);
|
return new QuestMainPrompt(plugin, context);
|
||||||
} else if (new StageMenuPrompt(plugin, context, QuestFactory.this).getStages(context) == 0) {
|
} else if (new StageMenuPrompt(plugin, context).getStages(context) == 0) {
|
||||||
context.getForWhom().sendRawMessage(ChatColor.RED + Lang.get("questEditorNeedStages"));
|
context.getForWhom().sendRawMessage(ChatColor.RED + Lang.get("questEditorNeedStages"));
|
||||||
return new QuestMainPrompt(plugin, context, QuestFactory.this);
|
return new QuestMainPrompt(plugin, context);
|
||||||
}
|
}
|
||||||
FileConfiguration data = new YamlConfiguration();
|
FileConfiguration data = new YamlConfiguration();
|
||||||
try {
|
try {
|
||||||
@ -1439,16 +1436,16 @@ 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 QuestMainPrompt(plugin, context, QuestFactory.this);
|
return new QuestMainPrompt(plugin, context);
|
||||||
} else {
|
} else {
|
||||||
return new SavePrompt(plugin, context, QuestFactory.this);
|
return new SavePrompt(plugin, context);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public class ExitPrompt extends QuestsEditorStringPrompt {
|
public class ExitPrompt extends QuestsEditorStringPrompt {
|
||||||
public ExitPrompt(Quests plugin, ConversationContext context, QuestFactory factory) {
|
public ExitPrompt(Quests plugin, ConversationContext context) {
|
||||||
super(context, factory);
|
super(context);
|
||||||
}
|
}
|
||||||
|
|
||||||
private final int size = 2;
|
private final int size = 2;
|
||||||
@ -1489,8 +1486,7 @@ public class QuestFactory implements ConversationAbandonedListener {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getPromptText(ConversationContext context) {
|
public String getPromptText(ConversationContext context) {
|
||||||
QuestsEditorPostOpenStringPromptEvent event
|
QuestsEditorPostOpenStringPromptEvent event = new QuestsEditorPostOpenStringPromptEvent(context, this);
|
||||||
= new QuestsEditorPostOpenStringPromptEvent(context, QuestFactory.this, this);
|
|
||||||
plugin.getServer().getPluginManager().callEvent(event);
|
plugin.getServer().getPluginManager().callEvent(event);
|
||||||
|
|
||||||
String text = getQueryText(context) + "\n";
|
String text = getQueryText(context) + "\n";
|
||||||
@ -1507,9 +1503,9 @@ 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 QuestMainPrompt(plugin, context, QuestFactory.this);
|
return new QuestMainPrompt(plugin, context);
|
||||||
} else {
|
} else {
|
||||||
return new ExitPrompt(plugin, context, QuestFactory.this);
|
return new ExitPrompt(plugin, context);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1603,7 +1599,7 @@ public class QuestFactory implements ConversationAbandonedListener {
|
|||||||
ConfigurationSection stages = section.createSection("stages");
|
ConfigurationSection stages = section.createSection("stages");
|
||||||
ConfigurationSection ordered = stages.createSection("ordered");
|
ConfigurationSection ordered = stages.createSection("ordered");
|
||||||
String pref;
|
String pref;
|
||||||
for (int i = 1; i <= new StageMenuPrompt(plugin, context, this).getStages(context); i++) {
|
for (int i = 1; i <= new StageMenuPrompt(plugin, context).getStages(context); i++) {
|
||||||
pref = "stage" + i;
|
pref = "stage" + i;
|
||||||
ConfigurationSection stage = ordered.createSection("" + i);
|
ConfigurationSection stage = ordered.createSection("" + i);
|
||||||
stage.set("break-block-names", context.getSessionData(pref + CK.S_BREAK_NAMES) != null
|
stage.set("break-block-names", context.getSessionData(pref + CK.S_BREAK_NAMES) != null
|
||||||
|
@ -120,7 +120,6 @@ public class Quests extends JavaPlugin implements ConversationAbandonedListener
|
|||||||
private DungeonsListener dungeonsListener;
|
private DungeonsListener dungeonsListener;
|
||||||
private PartiesListener partiesListener;
|
private PartiesListener partiesListener;
|
||||||
private DenizenTrigger trigger;
|
private DenizenTrigger trigger;
|
||||||
private Lang lang;
|
|
||||||
private LocaleQuery localeQuery;
|
private LocaleQuery localeQuery;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -141,7 +140,6 @@ public class Quests extends JavaPlugin implements ConversationAbandonedListener
|
|||||||
questFactory = new QuestFactory(this);
|
questFactory = new QuestFactory(this);
|
||||||
eventFactory = new ActionFactory(this);
|
eventFactory = new ActionFactory(this);
|
||||||
depends = new Dependencies(this);
|
depends = new Dependencies(this);
|
||||||
lang = new Lang(this);
|
|
||||||
trigger = new DenizenTrigger(this);
|
trigger = new DenizenTrigger(this);
|
||||||
|
|
||||||
// 2 - Load main config
|
// 2 - Load main config
|
||||||
@ -307,6 +305,11 @@ public class Quests extends JavaPlugin implements ConversationAbandonedListener
|
|||||||
return questFactory;
|
return questFactory;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public ActionFactory getActionFactory() {
|
||||||
|
return eventFactory;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Deprecated
|
||||||
public ActionFactory getEventFactory() {
|
public ActionFactory getEventFactory() {
|
||||||
return eventFactory;
|
return eventFactory;
|
||||||
}
|
}
|
||||||
@ -319,10 +322,6 @@ public class Quests extends JavaPlugin implements ConversationAbandonedListener
|
|||||||
return trigger;
|
return trigger;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Lang getLang() {
|
|
||||||
return lang;
|
|
||||||
}
|
|
||||||
|
|
||||||
public LocaleQuery getLocaleQuery() {
|
public LocaleQuery getLocaleQuery() {
|
||||||
return localeQuery;
|
return localeQuery;
|
||||||
}
|
}
|
||||||
@ -411,7 +410,7 @@ public class Quests extends JavaPlugin implements ConversationAbandonedListener
|
|||||||
jar.close();
|
jar.close();
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
lang.loadLang();
|
Lang.loadLang(this);
|
||||||
} catch (InvalidConfigurationException e) {
|
} catch (InvalidConfigurationException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
@ -1155,7 +1154,7 @@ public class Quests extends JavaPlugin implements ConversationAbandonedListener
|
|||||||
settings.init();
|
settings.init();
|
||||||
Lang.clear();
|
Lang.clear();
|
||||||
try {
|
try {
|
||||||
lang.loadLang();
|
Lang.loadLang(this);
|
||||||
} catch (InvalidConfigurationException e) {
|
} catch (InvalidConfigurationException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
|
@ -17,6 +17,8 @@ import java.io.IOException;
|
|||||||
|
|
||||||
import org.bukkit.configuration.file.FileConfiguration;
|
import org.bukkit.configuration.file.FileConfiguration;
|
||||||
|
|
||||||
|
import me.blackvein.quests.util.Lang;
|
||||||
|
|
||||||
public class Settings {
|
public class Settings {
|
||||||
|
|
||||||
private Quests plugin;
|
private Quests plugin;
|
||||||
@ -156,9 +158,9 @@ public class Settings {
|
|||||||
killDelay = config.getInt("kill-delay", 600);
|
killDelay = config.getInt("kill-delay", 600);
|
||||||
if (config.getString("language").equalsIgnoreCase("en")) {
|
if (config.getString("language").equalsIgnoreCase("en")) {
|
||||||
//Legacy
|
//Legacy
|
||||||
plugin.getLang().setISO("en-US");
|
Lang.setISO("en-US");
|
||||||
} else {
|
} else {
|
||||||
plugin.getLang().setISO(config.getString("language", "en-US"));
|
Lang.setISO(config.getString("language", "en-US"));
|
||||||
}
|
}
|
||||||
maxQuests = config.getInt("max-quests", maxQuests);
|
maxQuests = config.getInt("max-quests", maxQuests);
|
||||||
npcEffects = config.getBoolean("npc-effects.enabled", true);
|
npcEffects = config.getBoolean("npc-effects.enabled", true);
|
||||||
|
@ -80,7 +80,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 ActionMenuPrompt(null, this))
|
.withPrefix(new QuestCreatorPrefix()).withFirstPrompt(new ActionMenuPrompt(plugin, null))
|
||||||
.withTimeout(3600).thatExcludesNonPlayersWithMessage("Console may not perform this operation!")
|
.withTimeout(3600).thatExcludesNonPlayersWithMessage("Console may not perform this operation!")
|
||||||
.addConversationAbandonedListener(this);
|
.addConversationAbandonedListener(this);
|
||||||
}
|
}
|
||||||
@ -151,8 +151,8 @@ public class ActionFactory implements ConversationAbandonedListener {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public class ActionMenuPrompt extends ActionsEditorNumericPrompt {
|
public class ActionMenuPrompt extends ActionsEditorNumericPrompt {
|
||||||
public ActionMenuPrompt(ConversationContext context, ActionFactory factory) {
|
public ActionMenuPrompt(Quests plugin, ConversationContext context) {
|
||||||
super(context, factory);
|
super(context);
|
||||||
}
|
}
|
||||||
|
|
||||||
private final int size = 4;
|
private final int size = 4;
|
||||||
@ -199,9 +199,9 @@ public class ActionFactory implements ConversationAbandonedListener {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getPromptText(ConversationContext context) {
|
public String getPromptText(ConversationContext context) {
|
||||||
ActionsEditorPostOpenNumericPromptEvent event
|
/*ActionsEditorPostOpenNumericPromptEvent event
|
||||||
= new ActionsEditorPostOpenNumericPromptEvent(context, ActionFactory.this, this);
|
= new ActionsEditorPostOpenNumericPromptEvent(context, ActionFactory.this, this);
|
||||||
plugin.getServer().getPluginManager().callEvent(event);
|
plugin.getServer().getPluginManager().callEvent(event);*/
|
||||||
String text = ChatColor.GOLD + getTitle(context) + "\n";
|
String text = ChatColor.GOLD + getTitle(context) + "\n";
|
||||||
for (int i = 1; i <= size; i++) {
|
for (int i = 1; i <= size; i++) {
|
||||||
text += getNumberColor(context, i) + "" + ChatColor.BOLD + i + ChatColor.RESET + " - "
|
text += getNumberColor(context, i) + "" + ChatColor.BOLD + i + ChatColor.RESET + " - "
|
||||||
@ -218,10 +218,10 @@ public class ActionFactory implements ConversationAbandonedListener {
|
|||||||
if (player.hasPermission("quests.editor.actions.create")
|
if (player.hasPermission("quests.editor.actions.create")
|
||||||
|| player.hasPermission("quests.editor.events.create")) {
|
|| player.hasPermission("quests.editor.events.create")) {
|
||||||
context.setSessionData(CK.E_OLD_EVENT, "");
|
context.setSessionData(CK.E_OLD_EVENT, "");
|
||||||
return new ActionSelectCreatePrompt(context, ActionFactory.this);
|
return new ActionSelectCreatePrompt(context);
|
||||||
} else {
|
} else {
|
||||||
player.sendMessage(ChatColor.RED + Lang.get("noPermission"));
|
player.sendMessage(ChatColor.RED + Lang.get("noPermission"));
|
||||||
return new ActionMenuPrompt(context, ActionFactory.this);
|
return new ActionMenuPrompt(plugin, context);
|
||||||
}
|
}
|
||||||
case 2:
|
case 2:
|
||||||
if (player.hasPermission("quests.editor.actions.edit")
|
if (player.hasPermission("quests.editor.actions.edit")
|
||||||
@ -229,13 +229,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 ActionMenuPrompt(context, ActionFactory.this);
|
return new ActionMenuPrompt(plugin, context);
|
||||||
} 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 ActionMenuPrompt(context, ActionFactory.this);
|
return new ActionMenuPrompt(plugin, context);
|
||||||
}
|
}
|
||||||
case 3:
|
case 3:
|
||||||
if (player.hasPermission("quests.editor.actions.delete")
|
if (player.hasPermission("quests.editor.actions.delete")
|
||||||
@ -243,13 +243,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 ActionMenuPrompt(context, ActionFactory.this);
|
return new ActionMenuPrompt(plugin, context);
|
||||||
} 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 ActionMenuPrompt(context, ActionFactory.this);
|
return new ActionMenuPrompt(plugin, context);
|
||||||
}
|
}
|
||||||
case 4:
|
case 4:
|
||||||
((Player) context.getForWhom()).sendMessage(ChatColor.YELLOW + Lang.get("exited"));
|
((Player) context.getForWhom()).sendMessage(ChatColor.YELLOW + Lang.get("exited"));
|
||||||
@ -261,12 +261,12 @@ public class ActionFactory implements ConversationAbandonedListener {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public Prompt returnToMenu(ConversationContext context) {
|
public Prompt returnToMenu(ConversationContext context) {
|
||||||
return new ActionMainPrompt(context, ActionFactory.this);
|
return new ActionMainPrompt(context);
|
||||||
}
|
}
|
||||||
|
|
||||||
public class ActionMainPrompt extends ActionsEditorNumericPrompt {
|
public class ActionMainPrompt extends ActionsEditorNumericPrompt {
|
||||||
public ActionMainPrompt(ConversationContext context, ActionFactory factory) {
|
public ActionMainPrompt(ConversationContext context) {
|
||||||
super(context, factory);
|
super(context);
|
||||||
}
|
}
|
||||||
|
|
||||||
private final int size = 10;
|
private final int size = 10;
|
||||||
@ -385,8 +385,7 @@ public class ActionFactory implements ConversationAbandonedListener {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getPromptText(ConversationContext context) {
|
public String getPromptText(ConversationContext context) {
|
||||||
ActionsEditorPostOpenNumericPromptEvent event
|
ActionsEditorPostOpenNumericPromptEvent event = new ActionsEditorPostOpenNumericPromptEvent(context, this);
|
||||||
= new ActionsEditorPostOpenNumericPromptEvent(context, ActionFactory.this, this);
|
|
||||||
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)
|
||||||
@ -422,7 +421,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 ActionMainPrompt(context, ActionFactory.this);
|
return new ActionMainPrompt(context);
|
||||||
case 9:
|
case 9:
|
||||||
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));
|
||||||
@ -438,8 +437,8 @@ public class ActionFactory implements ConversationAbandonedListener {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public class ActionSelectCreatePrompt extends ActionsEditorStringPrompt {
|
public class ActionSelectCreatePrompt extends ActionsEditorStringPrompt {
|
||||||
public ActionSelectCreatePrompt(ConversationContext context, ActionFactory factory) {
|
public ActionSelectCreatePrompt(ConversationContext context) {
|
||||||
super(context, factory);
|
super(context);
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getTitle(ConversationContext context) {
|
public String getTitle(ConversationContext context) {
|
||||||
@ -452,8 +451,7 @@ public class ActionFactory implements ConversationAbandonedListener {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getPromptText(ConversationContext context) {
|
public String getPromptText(ConversationContext context) {
|
||||||
ActionsEditorPostOpenStringPromptEvent event
|
ActionsEditorPostOpenStringPromptEvent event = new ActionsEditorPostOpenStringPromptEvent(context, this);
|
||||||
= new ActionsEditorPostOpenStringPromptEvent(context, ActionFactory.this, this);
|
|
||||||
plugin.getServer().getPluginManager().callEvent(event);
|
plugin.getServer().getPluginManager().callEvent(event);
|
||||||
|
|
||||||
String text = ChatColor.GOLD + getTitle(context) + "\n" + ChatColor.YELLOW + getQueryText(context);
|
String text = ChatColor.GOLD + getTitle(context) + "\n" + ChatColor.YELLOW + getQueryText(context);
|
||||||
@ -464,33 +462,33 @@ public class ActionFactory implements ConversationAbandonedListener {
|
|||||||
public Prompt acceptInput(ConversationContext context, String input) {
|
public Prompt acceptInput(ConversationContext context, String input) {
|
||||||
if (input == null) {
|
if (input == null) {
|
||||||
context.getForWhom().sendRawMessage(ChatColor.RED + Lang.get("itemCreateInvalidInput"));
|
context.getForWhom().sendRawMessage(ChatColor.RED + Lang.get("itemCreateInvalidInput"));
|
||||||
return new ActionSelectCreatePrompt(context, ActionFactory.this);
|
return new ActionSelectCreatePrompt(context);
|
||||||
}
|
}
|
||||||
input = input.trim();
|
input = input.trim();
|
||||||
if (input.equalsIgnoreCase(Lang.get("cmdCancel")) == false) {
|
if (input.equalsIgnoreCase(Lang.get("cmdCancel")) == false) {
|
||||||
for (Action e : plugin.getActions()) {
|
for (Action e : plugin.getActions()) {
|
||||||
if (e.getName().equalsIgnoreCase(input)) {
|
if (e.getName().equalsIgnoreCase(input)) {
|
||||||
context.getForWhom().sendRawMessage(ChatColor.RED + Lang.get("eventEditorExists"));
|
context.getForWhom().sendRawMessage(ChatColor.RED + Lang.get("eventEditorExists"));
|
||||||
return new ActionSelectCreatePrompt(context, ActionFactory.this);
|
return new ActionSelectCreatePrompt(context);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (names.contains(input)) {
|
if (names.contains(input)) {
|
||||||
context.getForWhom().sendRawMessage(ChatColor.RED + Lang.get("eventEditorSomeone"));
|
context.getForWhom().sendRawMessage(ChatColor.RED + Lang.get("eventEditorSomeone"));
|
||||||
return new ActionSelectCreatePrompt(context, ActionFactory.this);
|
return new ActionSelectCreatePrompt(context);
|
||||||
}
|
}
|
||||||
if (StringUtils.isAlphanumeric(input) == false) {
|
if (StringUtils.isAlphanumeric(input) == false) {
|
||||||
context.getForWhom().sendRawMessage(ChatColor.RED + Lang.get("eventEditorAlpha"));
|
context.getForWhom().sendRawMessage(ChatColor.RED + Lang.get("eventEditorAlpha"));
|
||||||
return new ActionSelectCreatePrompt(context, ActionFactory.this);
|
return new ActionSelectCreatePrompt(context);
|
||||||
}
|
}
|
||||||
if (input.equals("")) {
|
if (input.equals("")) {
|
||||||
context.getForWhom().sendRawMessage(ChatColor.RED + Lang.get("itemCreateInvalidInput"));
|
context.getForWhom().sendRawMessage(ChatColor.RED + Lang.get("itemCreateInvalidInput"));
|
||||||
return new ActionSelectCreatePrompt(context, ActionFactory.this);
|
return new ActionSelectCreatePrompt(context);
|
||||||
}
|
}
|
||||||
context.setSessionData(CK.E_NAME, input);
|
context.setSessionData(CK.E_NAME, input);
|
||||||
names.add(input);
|
names.add(input);
|
||||||
return new ActionMainPrompt(context, ActionFactory.this);
|
return new ActionMainPrompt(context);
|
||||||
} else {
|
} else {
|
||||||
return new ActionMenuPrompt(context, ActionFactory.this);
|
return new ActionMenuPrompt(plugin, context);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -516,12 +514,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 ActionMainPrompt(context, ActionFactory.this);
|
return new ActionMainPrompt(context);
|
||||||
}
|
}
|
||||||
((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 ActionMenuPrompt(context, ActionFactory.this);
|
return new ActionMenuPrompt(plugin, context);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -665,7 +663,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 ActionMenuPrompt(context, ActionFactory.this);
|
return new ActionMenuPrompt(plugin, context);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -686,9 +684,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 ActionMenuPrompt(context, ActionFactory.this);
|
return new ActionMenuPrompt(plugin, context);
|
||||||
} else if (input.equalsIgnoreCase("2") || input.equalsIgnoreCase(Lang.get("noWord"))) {
|
} else if (input.equalsIgnoreCase("2") || input.equalsIgnoreCase(Lang.get("noWord"))) {
|
||||||
return new ActionMenuPrompt(context, ActionFactory.this);
|
return new ActionMenuPrompt(plugin, context);
|
||||||
} else {
|
} else {
|
||||||
return new ActionConfirmDeletePrompt();
|
return new ActionConfirmDeletePrompt();
|
||||||
}
|
}
|
||||||
@ -807,7 +805,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 ActionMainPrompt(context, ActionFactory.this);
|
return new ActionMainPrompt(context);
|
||||||
} 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")) {
|
||||||
@ -824,7 +822,7 @@ public class ActionFactory implements ConversationAbandonedListener {
|
|||||||
} else if (input.equalsIgnoreCase("9")) {
|
} else if (input.equalsIgnoreCase("9")) {
|
||||||
return new CommandsPrompt();
|
return new CommandsPrompt();
|
||||||
}
|
}
|
||||||
return new ActionMainPrompt(context, ActionFactory.this);
|
return new ActionMainPrompt(context);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -867,9 +865,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 ActionMainPrompt(context, ActionFactory.this);
|
return new ActionMainPrompt(context);
|
||||||
}
|
}
|
||||||
return new ActionMainPrompt(context, ActionFactory.this);
|
return new ActionMainPrompt(context);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -920,7 +918,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 ActionMainPrompt(context, ActionFactory.this);
|
return new ActionMainPrompt(context);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -981,7 +979,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 ActionMainPrompt(context, ActionFactory.this);
|
return new ActionMainPrompt(context);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -990,7 +988,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 ActionMainPrompt(context, ActionFactory.this);
|
return new ActionMainPrompt(context);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -1038,9 +1036,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 ActionMenuPrompt(context, ActionFactory.this);
|
return new ActionMenuPrompt(plugin, context);
|
||||||
} else if (input.equalsIgnoreCase("2") || input.equalsIgnoreCase(Lang.get("noWord"))) {
|
} else if (input.equalsIgnoreCase("2") || input.equalsIgnoreCase(Lang.get("noWord"))) {
|
||||||
return new ActionMainPrompt(context, ActionFactory.this);
|
return new ActionMainPrompt(context);
|
||||||
} else {
|
} else {
|
||||||
return new SavePrompt(modName);
|
return new SavePrompt(modName);
|
||||||
}
|
}
|
||||||
@ -1064,7 +1062,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 ActionMainPrompt(context, ActionFactory.this);
|
return new ActionMainPrompt(context);
|
||||||
} else {
|
} else {
|
||||||
return new ExitPrompt();
|
return new ExitPrompt();
|
||||||
}
|
}
|
||||||
@ -1364,14 +1362,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 ActionMainPrompt(context, ActionFactory.this);
|
return new ActionMainPrompt(context);
|
||||||
} 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 ActionMainPrompt(context, ActionFactory.this);
|
return new ActionMainPrompt(context);
|
||||||
} else if (input.equalsIgnoreCase(Lang.get("cmdCancel"))) {
|
} else if (input.equalsIgnoreCase(Lang.get("cmdCancel"))) {
|
||||||
selectedExplosionLocations.remove(player.getUniqueId());
|
selectedExplosionLocations.remove(player.getUniqueId());
|
||||||
return new ActionMainPrompt(context, ActionFactory.this);
|
return new ActionMainPrompt(context);
|
||||||
} else {
|
} else {
|
||||||
return new ExplosionPrompt();
|
return new ExplosionPrompt();
|
||||||
}
|
}
|
||||||
@ -1406,7 +1404,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 ActionMainPrompt(context, ActionFactory.this);
|
return new ActionMainPrompt(context);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1425,7 +1423,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 ActionMainPrompt(context, ActionFactory.this);
|
return new ActionMainPrompt(context);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1482,7 +1480,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 ActionMainPrompt(context, ActionFactory.this);
|
return new ActionMainPrompt(context);
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
@ -1566,7 +1564,7 @@ public class ActionFactory implements ConversationAbandonedListener {
|
|||||||
two = 0;
|
two = 0;
|
||||||
}
|
}
|
||||||
if (one == two) {
|
if (one == two) {
|
||||||
return new ActionMainPrompt(context, ActionFactory.this);
|
return new ActionMainPrompt(context);
|
||||||
} else {
|
} else {
|
||||||
context.getForWhom().sendRawMessage(ChatColor.RED + Lang.get("listsNotSameSize"));
|
context.getForWhom().sendRawMessage(ChatColor.RED + Lang.get("listsNotSameSize"));
|
||||||
return new SoundEffectListPrompt();
|
return new SoundEffectListPrompt();
|
||||||
@ -1731,7 +1729,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 ActionMainPrompt(context, ActionFactory.this);
|
return new ActionMainPrompt(context);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
@ -1847,7 +1845,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 ActionMainPrompt(context, ActionFactory.this);
|
return new ActionMainPrompt(context);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
@ -1945,7 +1943,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 ActionMainPrompt(context, ActionFactory.this);
|
return new ActionMainPrompt(context);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
@ -1965,7 +1963,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 ActionMainPrompt(context, ActionFactory.this);
|
return new ActionMainPrompt(context);
|
||||||
} else if (inp > types.size()) {
|
} else if (inp > types.size()) {
|
||||||
return new MobPrompt();
|
return new MobPrompt();
|
||||||
} else {
|
} else {
|
||||||
@ -2356,14 +2354,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 ActionMainPrompt(context, ActionFactory.this);
|
return new ActionMainPrompt(context);
|
||||||
} 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 ActionMainPrompt(context, ActionFactory.this);
|
return new ActionMainPrompt(context);
|
||||||
} else if (input.equalsIgnoreCase(Lang.get("cmdCancel"))) {
|
} else if (input.equalsIgnoreCase(Lang.get("cmdCancel"))) {
|
||||||
selectedLightningLocations.remove(player.getUniqueId());
|
selectedLightningLocations.remove(player.getUniqueId());
|
||||||
return new ActionMainPrompt(context, ActionFactory.this);
|
return new ActionMainPrompt(context);
|
||||||
} else {
|
} else {
|
||||||
return new LightningPrompt();
|
return new LightningPrompt();
|
||||||
}
|
}
|
||||||
@ -2477,7 +2475,7 @@ public class ActionFactory implements ConversationAbandonedListener {
|
|||||||
three = 0;
|
three = 0;
|
||||||
}
|
}
|
||||||
if (one == two && two == three) {
|
if (one == two && two == three) {
|
||||||
return new ActionMainPrompt(context, ActionFactory.this);
|
return new ActionMainPrompt(context);
|
||||||
} else {
|
} else {
|
||||||
context.getForWhom().sendRawMessage(ChatColor.RED + Lang.get("eventEditorListSizeMismatch"));
|
context.getForWhom().sendRawMessage(ChatColor.RED + Lang.get("eventEditorListSizeMismatch"));
|
||||||
return new PotionEffectPrompt();
|
return new PotionEffectPrompt();
|
||||||
@ -2608,7 +2606,7 @@ public class ActionFactory implements ConversationAbandonedListener {
|
|||||||
} else {
|
} else {
|
||||||
context.setSessionData(CK.E_HUNGER, null);
|
context.setSessionData(CK.E_HUNGER, null);
|
||||||
}
|
}
|
||||||
return new ActionMainPrompt(context, ActionFactory.this);
|
return new ActionMainPrompt(context);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2639,7 +2637,7 @@ public class ActionFactory implements ConversationAbandonedListener {
|
|||||||
} else {
|
} else {
|
||||||
context.setSessionData(CK.E_SATURATION, null);
|
context.setSessionData(CK.E_SATURATION, null);
|
||||||
}
|
}
|
||||||
return new ActionMainPrompt(context, ActionFactory.this);
|
return new ActionMainPrompt(context);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2670,7 +2668,7 @@ public class ActionFactory implements ConversationAbandonedListener {
|
|||||||
} else {
|
} else {
|
||||||
context.setSessionData(CK.E_HEALTH, null);
|
context.setSessionData(CK.E_HEALTH, null);
|
||||||
}
|
}
|
||||||
return new ActionMainPrompt(context, ActionFactory.this);
|
return new ActionMainPrompt(context);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2694,14 +2692,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 ActionMainPrompt(context, ActionFactory.this);
|
return new ActionMainPrompt(context);
|
||||||
} 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 ActionMainPrompt(context, ActionFactory.this);
|
return new ActionMainPrompt(context);
|
||||||
} else if (input.equalsIgnoreCase(Lang.get("cmdCancel"))) {
|
} else if (input.equalsIgnoreCase(Lang.get("cmdCancel"))) {
|
||||||
selectedTeleportLocations.remove(player.getUniqueId());
|
selectedTeleportLocations.remove(player.getUniqueId());
|
||||||
return new ActionMainPrompt(context, ActionFactory.this);
|
return new ActionMainPrompt(context);
|
||||||
} else {
|
} else {
|
||||||
return new TeleportPrompt();
|
return new TeleportPrompt();
|
||||||
}
|
}
|
||||||
@ -2727,7 +2725,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 ActionMainPrompt(context, ActionFactory.this);
|
return new ActionMainPrompt(context);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2759,7 +2757,7 @@ public class ActionFactory implements ConversationAbandonedListener {
|
|||||||
&& input.equalsIgnoreCase(Lang.get("cmdClear")) == false) {
|
&& input.equalsIgnoreCase(Lang.get("cmdClear")) == false) {
|
||||||
if (plugin.getDependencies().getDenizenAPI().containsScript(input)) {
|
if (plugin.getDependencies().getDenizenAPI().containsScript(input)) {
|
||||||
context.setSessionData(CK.E_DENIZEN, input.toUpperCase());
|
context.setSessionData(CK.E_DENIZEN, input.toUpperCase());
|
||||||
return new ActionMainPrompt(context, ActionFactory.this);
|
return new ActionMainPrompt(context);
|
||||||
} else {
|
} else {
|
||||||
player.sendMessage(ChatColor.RED + Lang.get("stageEditorInvalidScript"));
|
player.sendMessage(ChatColor.RED + Lang.get("stageEditorInvalidScript"));
|
||||||
return new DenizenPrompt();
|
return new DenizenPrompt();
|
||||||
@ -2767,9 +2765,9 @@ public class ActionFactory implements ConversationAbandonedListener {
|
|||||||
} else if (input.equalsIgnoreCase(Lang.get("cmdClear"))) {
|
} else if (input.equalsIgnoreCase(Lang.get("cmdClear"))) {
|
||||||
context.setSessionData(CK.E_DENIZEN, null);
|
context.setSessionData(CK.E_DENIZEN, null);
|
||||||
player.sendMessage(ChatColor.YELLOW + Lang.get("stageEditorDenizenCleared"));
|
player.sendMessage(ChatColor.YELLOW + Lang.get("stageEditorDenizenCleared"));
|
||||||
return new ActionMainPrompt(context, ActionFactory.this);
|
return new ActionMainPrompt(context);
|
||||||
} else {
|
} else {
|
||||||
return new ActionMainPrompt(context, ActionFactory.this);
|
return new ActionMainPrompt(context);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -15,6 +15,7 @@ package me.blackvein.quests.convo.actions;
|
|||||||
import org.bukkit.ChatColor;
|
import org.bukkit.ChatColor;
|
||||||
import org.bukkit.conversations.ConversationContext;
|
import org.bukkit.conversations.ConversationContext;
|
||||||
|
|
||||||
|
import me.blackvein.quests.Quests;
|
||||||
import me.blackvein.quests.actions.ActionFactory;
|
import me.blackvein.quests.actions.ActionFactory;
|
||||||
import me.blackvein.quests.convo.QuestsNumericPrompt;
|
import me.blackvein.quests.convo.QuestsNumericPrompt;
|
||||||
|
|
||||||
@ -22,6 +23,12 @@ public abstract class ActionsEditorNumericPrompt extends QuestsNumericPrompt {
|
|||||||
private ConversationContext context;
|
private ConversationContext context;
|
||||||
private ActionFactory factory;
|
private ActionFactory factory;
|
||||||
|
|
||||||
|
public ActionsEditorNumericPrompt(final ConversationContext context) {
|
||||||
|
this.context = context;
|
||||||
|
this.factory = ((Quests)context.getPlugin()).getActionFactory();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Deprecated
|
||||||
public ActionsEditorNumericPrompt(final ConversationContext context, final ActionFactory factory) {
|
public ActionsEditorNumericPrompt(final ConversationContext context, final ActionFactory factory) {
|
||||||
this.context = context;
|
this.context = context;
|
||||||
this.factory = factory;
|
this.factory = factory;
|
||||||
|
@ -14,6 +14,7 @@ package me.blackvein.quests.convo.actions;
|
|||||||
|
|
||||||
import org.bukkit.conversations.ConversationContext;
|
import org.bukkit.conversations.ConversationContext;
|
||||||
|
|
||||||
|
import me.blackvein.quests.Quests;
|
||||||
import me.blackvein.quests.actions.ActionFactory;
|
import me.blackvein.quests.actions.ActionFactory;
|
||||||
import me.blackvein.quests.convo.QuestsStringPrompt;
|
import me.blackvein.quests.convo.QuestsStringPrompt;
|
||||||
|
|
||||||
@ -21,6 +22,12 @@ public abstract class ActionsEditorStringPrompt extends QuestsStringPrompt {
|
|||||||
private ConversationContext context;
|
private ConversationContext context;
|
||||||
private ActionFactory factory;
|
private ActionFactory factory;
|
||||||
|
|
||||||
|
public ActionsEditorStringPrompt(final ConversationContext context) {
|
||||||
|
this.context = context;
|
||||||
|
this.factory = ((Quests)context.getPlugin()).getActionFactory();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Deprecated
|
||||||
public ActionsEditorStringPrompt(final ConversationContext context, final ActionFactory factory) {
|
public ActionsEditorStringPrompt(final ConversationContext context, final ActionFactory factory) {
|
||||||
this.context = context;
|
this.context = context;
|
||||||
this.factory = factory;
|
this.factory = factory;
|
||||||
|
@ -16,12 +16,19 @@ import org.bukkit.ChatColor;
|
|||||||
import org.bukkit.conversations.ConversationContext;
|
import org.bukkit.conversations.ConversationContext;
|
||||||
|
|
||||||
import me.blackvein.quests.QuestFactory;
|
import me.blackvein.quests.QuestFactory;
|
||||||
|
import me.blackvein.quests.Quests;
|
||||||
import me.blackvein.quests.convo.QuestsNumericPrompt;
|
import me.blackvein.quests.convo.QuestsNumericPrompt;
|
||||||
|
|
||||||
public abstract class QuestsEditorNumericPrompt extends QuestsNumericPrompt {
|
public abstract class QuestsEditorNumericPrompt extends QuestsNumericPrompt {
|
||||||
private ConversationContext context;
|
private ConversationContext context;
|
||||||
private QuestFactory factory;
|
private QuestFactory factory;
|
||||||
|
|
||||||
|
public QuestsEditorNumericPrompt(final ConversationContext context) {
|
||||||
|
this.context = context;
|
||||||
|
factory = ((Quests)context.getPlugin()).getQuestFactory();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Deprecated
|
||||||
public QuestsEditorNumericPrompt(final ConversationContext context, final QuestFactory factory) {
|
public QuestsEditorNumericPrompt(final ConversationContext context, final QuestFactory factory) {
|
||||||
this.context = context;
|
this.context = context;
|
||||||
this.factory = factory;
|
this.factory = factory;
|
||||||
|
@ -15,13 +15,19 @@ package me.blackvein.quests.convo.quests;
|
|||||||
import org.bukkit.conversations.ConversationContext;
|
import org.bukkit.conversations.ConversationContext;
|
||||||
|
|
||||||
import me.blackvein.quests.QuestFactory;
|
import me.blackvein.quests.QuestFactory;
|
||||||
|
import me.blackvein.quests.Quests;
|
||||||
import me.blackvein.quests.convo.QuestsStringPrompt;
|
import me.blackvein.quests.convo.QuestsStringPrompt;
|
||||||
|
|
||||||
public abstract class QuestsEditorStringPrompt extends QuestsStringPrompt {
|
public abstract class QuestsEditorStringPrompt extends QuestsStringPrompt {
|
||||||
private ConversationContext context;
|
private ConversationContext context;
|
||||||
private QuestFactory factory;
|
private QuestFactory factory;
|
||||||
|
|
||||||
//TODO - passing factory may be unnecessary
|
public QuestsEditorStringPrompt(final ConversationContext context) {
|
||||||
|
this.context = context;
|
||||||
|
factory = ((Quests)context.getPlugin()).getQuestFactory();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Deprecated
|
||||||
public QuestsEditorStringPrompt(final ConversationContext context, final QuestFactory factory) {
|
public QuestsEditorStringPrompt(final ConversationContext context, final QuestFactory factory) {
|
||||||
this.context = context;
|
this.context = context;
|
||||||
this.factory = factory;
|
this.factory = factory;
|
||||||
|
@ -15,7 +15,6 @@ package me.blackvein.quests.convo.quests.prompts;
|
|||||||
import java.util.LinkedList;
|
import java.util.LinkedList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import me.blackvein.quests.QuestFactory;
|
|
||||||
import me.blackvein.quests.Quests;
|
import me.blackvein.quests.Quests;
|
||||||
import me.blackvein.quests.convo.quests.QuestsEditorNumericPrompt;
|
import me.blackvein.quests.convo.quests.QuestsEditorNumericPrompt;
|
||||||
import me.blackvein.quests.events.editor.quests.QuestsEditorPostOpenNumericPromptEvent;
|
import me.blackvein.quests.events.editor.quests.QuestsEditorPostOpenNumericPromptEvent;
|
||||||
@ -34,14 +33,12 @@ public class BlocksPrompt extends QuestsEditorNumericPrompt {
|
|||||||
private final Quests plugin;
|
private final Quests plugin;
|
||||||
private final int stageNum;
|
private final int stageNum;
|
||||||
private final String pref;
|
private final String pref;
|
||||||
private final QuestFactory factory;
|
|
||||||
|
|
||||||
public BlocksPrompt(Quests plugin, int stageNum, ConversationContext context, QuestFactory qf) {
|
public BlocksPrompt(Quests plugin, int stageNum, ConversationContext context) {
|
||||||
super(context, qf);
|
super(context);
|
||||||
this.plugin = plugin;
|
this.plugin = plugin;
|
||||||
this.stageNum = stageNum;
|
this.stageNum = stageNum;
|
||||||
this.pref = "stage" + stageNum;
|
this.pref = "stage" + stageNum;
|
||||||
this.factory = qf;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private final int size = 6;
|
private final int size = 6;
|
||||||
@ -168,8 +165,8 @@ public class BlocksPrompt extends QuestsEditorNumericPrompt {
|
|||||||
context.setSessionData(pref, Boolean.TRUE);
|
context.setSessionData(pref, Boolean.TRUE);
|
||||||
|
|
||||||
QuestsEditorPostOpenNumericPromptEvent event
|
QuestsEditorPostOpenNumericPromptEvent event
|
||||||
= new QuestsEditorPostOpenNumericPromptEvent(context, factory, this);
|
= new QuestsEditorPostOpenNumericPromptEvent(context, this);
|
||||||
plugin.getServer().getPluginManager().callEvent(event);
|
context.getPlugin().getServer().getPluginManager().callEvent(event);
|
||||||
|
|
||||||
String text = ChatColor.AQUA + "- " + getTitle(context) + " -\n";
|
String text = ChatColor.AQUA + "- " + getTitle(context) + " -\n";
|
||||||
for (int i = 1; i <= size; i++) {
|
for (int i = 1; i <= size; i++) {
|
||||||
@ -194,7 +191,7 @@ public class BlocksPrompt extends QuestsEditorNumericPrompt {
|
|||||||
return new CutBlockListPrompt();
|
return new CutBlockListPrompt();
|
||||||
case 6:
|
case 6:
|
||||||
try {
|
try {
|
||||||
return new StageMainPrompt(plugin, stageNum, context, factory);
|
return new StageMainPrompt(plugin, stageNum, context);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
context.getForWhom().sendRawMessage(ChatColor.RED + Lang.get("itemCreateCriticalError"));
|
context.getForWhom().sendRawMessage(ChatColor.RED + Lang.get("itemCreateCriticalError"));
|
||||||
return Prompt.END_OF_CONVERSATION;
|
return Prompt.END_OF_CONVERSATION;
|
||||||
@ -310,7 +307,7 @@ public class BlocksPrompt extends QuestsEditorNumericPrompt {
|
|||||||
elements.add((short) 0);
|
elements.add((short) 0);
|
||||||
}
|
}
|
||||||
context.setSessionData(pref + CK.S_BREAK_DURABILITY, elements);
|
context.setSessionData(pref + CK.S_BREAK_DURABILITY, elements);
|
||||||
return new BlocksPrompt(plugin, stageNum, context, factory);
|
return new BlocksPrompt(plugin, stageNum, context);
|
||||||
} else {
|
} else {
|
||||||
context.getForWhom().sendRawMessage(ChatColor.RED + Lang.get("listsNotSameSize"));
|
context.getForWhom().sendRawMessage(ChatColor.RED + Lang.get("listsNotSameSize"));
|
||||||
return new BreakBlockListPrompt();
|
return new BreakBlockListPrompt();
|
||||||
@ -547,7 +544,7 @@ public class BlocksPrompt extends QuestsEditorNumericPrompt {
|
|||||||
elements.add((short) 0);
|
elements.add((short) 0);
|
||||||
}
|
}
|
||||||
context.setSessionData(pref + CK.S_DAMAGE_DURABILITY, elements);
|
context.setSessionData(pref + CK.S_DAMAGE_DURABILITY, elements);
|
||||||
return new BlocksPrompt(plugin, stageNum, context, factory);
|
return new BlocksPrompt(plugin, stageNum, context);
|
||||||
} else {
|
} else {
|
||||||
context.getForWhom().sendRawMessage(ChatColor.RED + Lang.get("listsNotSameSize"));
|
context.getForWhom().sendRawMessage(ChatColor.RED + Lang.get("listsNotSameSize"));
|
||||||
return new DamageBlockListPrompt();
|
return new DamageBlockListPrompt();
|
||||||
@ -784,7 +781,7 @@ public class BlocksPrompt extends QuestsEditorNumericPrompt {
|
|||||||
elements.add((short) 0);
|
elements.add((short) 0);
|
||||||
}
|
}
|
||||||
context.setSessionData(pref + CK.S_PLACE_DURABILITY, elements);
|
context.setSessionData(pref + CK.S_PLACE_DURABILITY, elements);
|
||||||
return new BlocksPrompt(plugin, stageNum, context, factory);
|
return new BlocksPrompt(plugin, stageNum, context);
|
||||||
} else {
|
} else {
|
||||||
context.getForWhom().sendRawMessage(ChatColor.RED + Lang.get("listsNotSameSize"));
|
context.getForWhom().sendRawMessage(ChatColor.RED + Lang.get("listsNotSameSize"));
|
||||||
return new PlaceBlockListPrompt();
|
return new PlaceBlockListPrompt();
|
||||||
@ -1021,7 +1018,7 @@ public class BlocksPrompt extends QuestsEditorNumericPrompt {
|
|||||||
elements.add((short) 0);
|
elements.add((short) 0);
|
||||||
}
|
}
|
||||||
context.setSessionData(pref + CK.S_USE_DURABILITY, elements);
|
context.setSessionData(pref + CK.S_USE_DURABILITY, elements);
|
||||||
return new BlocksPrompt(plugin, stageNum, context, factory);
|
return new BlocksPrompt(plugin, stageNum, context);
|
||||||
} else {
|
} else {
|
||||||
context.getForWhom().sendRawMessage(ChatColor.RED + Lang.get("listsNotSameSize"));
|
context.getForWhom().sendRawMessage(ChatColor.RED + Lang.get("listsNotSameSize"));
|
||||||
return new UseBlockListPrompt();
|
return new UseBlockListPrompt();
|
||||||
@ -1258,7 +1255,7 @@ public class BlocksPrompt extends QuestsEditorNumericPrompt {
|
|||||||
elements.add((short) 0);
|
elements.add((short) 0);
|
||||||
}
|
}
|
||||||
context.setSessionData(pref + CK.S_CUT_DURABILITY, elements);
|
context.setSessionData(pref + CK.S_CUT_DURABILITY, elements);
|
||||||
return new BlocksPrompt(plugin, stageNum, context, factory);
|
return new BlocksPrompt(plugin, stageNum, context);
|
||||||
} else {
|
} else {
|
||||||
context.getForWhom().sendRawMessage(ChatColor.RED + Lang.get("listsNotSameSize"));
|
context.getForWhom().sendRawMessage(ChatColor.RED + Lang.get("listsNotSameSize"));
|
||||||
return new CutBlockListPrompt();
|
return new CutBlockListPrompt();
|
||||||
|
@ -18,7 +18,6 @@ import java.util.Calendar;
|
|||||||
import java.util.Locale;
|
import java.util.Locale;
|
||||||
import java.util.TimeZone;
|
import java.util.TimeZone;
|
||||||
|
|
||||||
import me.blackvein.quests.Quests;
|
|
||||||
import me.blackvein.quests.util.CK;
|
import me.blackvein.quests.util.CK;
|
||||||
import me.blackvein.quests.util.Lang;
|
import me.blackvein.quests.util.Lang;
|
||||||
|
|
||||||
@ -30,13 +29,11 @@ import org.bukkit.conversations.StringPrompt;
|
|||||||
|
|
||||||
public class DateTimePrompt extends FixedSetPrompt {
|
public class DateTimePrompt extends FixedSetPrompt {
|
||||||
|
|
||||||
private Quests plugin;
|
|
||||||
private final Prompt oldPrompt;
|
private final Prompt oldPrompt;
|
||||||
private String source = "";
|
private String source = "";
|
||||||
|
|
||||||
public DateTimePrompt(Quests plugin, Prompt old, String origin) {
|
public DateTimePrompt(Prompt old, String origin) {
|
||||||
super("0", "1", "2", "3", "4", "5", "6", "7", "8", "9");
|
super("0", "1", "2", "3", "4", "5", "6", "7", "8", "9");
|
||||||
this.plugin = plugin;
|
|
||||||
oldPrompt = old;
|
oldPrompt = old;
|
||||||
source = origin;
|
source = origin;
|
||||||
}
|
}
|
||||||
@ -78,7 +75,7 @@ public class DateTimePrompt extends FixedSetPrompt {
|
|||||||
}
|
}
|
||||||
TimeZone tz = TimeZone.getTimeZone((String) cc.getSessionData("tempZone"));
|
TimeZone tz = TimeZone.getTimeZone((String) cc.getSessionData("tempZone"));
|
||||||
cal.setTimeZone(tz);
|
cal.setTimeZone(tz);
|
||||||
String[] iso = plugin.getLang().getISO().split("-");
|
String[] iso = Lang.getISO().split("-");
|
||||||
Locale loc = new Locale(iso[0], iso[1]);
|
Locale loc = new Locale(iso[0], iso[1]);
|
||||||
Double hour = (double) (cal.getTimeZone().getRawOffset() / 60 / 60 / 1000);
|
Double hour = (double) (cal.getTimeZone().getRawOffset() / 60 / 60 / 1000);
|
||||||
String[] sep = String.valueOf(hour).replace("-", "").split("\\.");
|
String[] sep = String.valueOf(hour).replace("-", "").split("\\.");
|
||||||
@ -145,12 +142,14 @@ public class DateTimePrompt extends FixedSetPrompt {
|
|||||||
String zone = (String) cc.getSessionData("tempZone");
|
String zone = (String) cc.getSessionData("tempZone");
|
||||||
String date = day + ":" + month + ":" + year + ":"
|
String date = day + ":" + month + ":" + year + ":"
|
||||||
+ hour + ":" + minute + ":" + second + ":" + zone;
|
+ hour + ":" + minute + ":" + second + ":" + zone;
|
||||||
|
if (source != null) {
|
||||||
if (source.equals("start")) {
|
if (source.equals("start")) {
|
||||||
cc.setSessionData(CK.PLN_START_DATE, date);
|
cc.setSessionData(CK.PLN_START_DATE, date);
|
||||||
} else if (source.equals("end")) {
|
} else if (source.equals("end")) {
|
||||||
cc.setSessionData(CK.PLN_END_DATE, date);
|
cc.setSessionData(CK.PLN_END_DATE, date);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
try {
|
try {
|
||||||
return oldPrompt;
|
return oldPrompt;
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
@ -177,14 +176,14 @@ public class DateTimePrompt extends FixedSetPrompt {
|
|||||||
return new DayPrompt();
|
return new DayPrompt();
|
||||||
} else {
|
} else {
|
||||||
cc.setSessionData("tempDay", Integer.parseInt(input));
|
cc.setSessionData("tempDay", Integer.parseInt(input));
|
||||||
return new DateTimePrompt(plugin, oldPrompt, source);
|
return new DateTimePrompt(oldPrompt, source);
|
||||||
}
|
}
|
||||||
} catch (NumberFormatException e) {
|
} catch (NumberFormatException e) {
|
||||||
cc.getForWhom().sendRawMessage(ChatColor.RED + Lang.get("itemCreateInvalidInput"));
|
cc.getForWhom().sendRawMessage(ChatColor.RED + Lang.get("itemCreateInvalidInput"));
|
||||||
return new DayPrompt();
|
return new DayPrompt();
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
return new DateTimePrompt(plugin, oldPrompt, source);
|
return new DateTimePrompt(oldPrompt, source);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -207,14 +206,14 @@ public class DateTimePrompt extends FixedSetPrompt {
|
|||||||
return new MonthPrompt();
|
return new MonthPrompt();
|
||||||
} else {
|
} else {
|
||||||
cc.setSessionData("tempMonth", Integer.parseInt(input) - 1);
|
cc.setSessionData("tempMonth", Integer.parseInt(input) - 1);
|
||||||
return new DateTimePrompt(plugin, oldPrompt, source);
|
return new DateTimePrompt(oldPrompt, source);
|
||||||
}
|
}
|
||||||
} catch (NumberFormatException e) {
|
} catch (NumberFormatException e) {
|
||||||
cc.getForWhom().sendRawMessage(ChatColor.RED + Lang.get("itemCreateInvalidInput"));
|
cc.getForWhom().sendRawMessage(ChatColor.RED + Lang.get("itemCreateInvalidInput"));
|
||||||
return new MonthPrompt();
|
return new MonthPrompt();
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
return new DateTimePrompt(plugin, oldPrompt, source);
|
return new DateTimePrompt(oldPrompt, source);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -237,14 +236,14 @@ public class DateTimePrompt extends FixedSetPrompt {
|
|||||||
return new YearPrompt();
|
return new YearPrompt();
|
||||||
} else {
|
} else {
|
||||||
cc.setSessionData("tempYear", Integer.parseInt(input));
|
cc.setSessionData("tempYear", Integer.parseInt(input));
|
||||||
return new DateTimePrompt(plugin, oldPrompt, source);
|
return new DateTimePrompt(oldPrompt, source);
|
||||||
}
|
}
|
||||||
} catch (NumberFormatException e) {
|
} catch (NumberFormatException e) {
|
||||||
cc.getForWhom().sendRawMessage(ChatColor.RED + Lang.get("itemCreateInvalidInput"));
|
cc.getForWhom().sendRawMessage(ChatColor.RED + Lang.get("itemCreateInvalidInput"));
|
||||||
return new YearPrompt();
|
return new YearPrompt();
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
return new DateTimePrompt(plugin, oldPrompt, source);
|
return new DateTimePrompt(oldPrompt, source);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -267,14 +266,14 @@ public class DateTimePrompt extends FixedSetPrompt {
|
|||||||
return new HourPrompt();
|
return new HourPrompt();
|
||||||
} else {
|
} else {
|
||||||
cc.setSessionData("tempHour", Integer.parseInt(input));
|
cc.setSessionData("tempHour", Integer.parseInt(input));
|
||||||
return new DateTimePrompt(plugin, oldPrompt, source);
|
return new DateTimePrompt(oldPrompt, source);
|
||||||
}
|
}
|
||||||
} catch (NumberFormatException e) {
|
} catch (NumberFormatException e) {
|
||||||
cc.getForWhom().sendRawMessage(ChatColor.RED + Lang.get("itemCreateInvalidInput"));
|
cc.getForWhom().sendRawMessage(ChatColor.RED + Lang.get("itemCreateInvalidInput"));
|
||||||
return new HourPrompt();
|
return new HourPrompt();
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
return new DateTimePrompt(plugin, oldPrompt, source);
|
return new DateTimePrompt(oldPrompt, source);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -297,14 +296,14 @@ public class DateTimePrompt extends FixedSetPrompt {
|
|||||||
return new MinutePrompt();
|
return new MinutePrompt();
|
||||||
} else {
|
} else {
|
||||||
cc.setSessionData("tempMinute", Integer.parseInt(input));
|
cc.setSessionData("tempMinute", Integer.parseInt(input));
|
||||||
return new DateTimePrompt(plugin, oldPrompt, source);
|
return new DateTimePrompt(oldPrompt, source);
|
||||||
}
|
}
|
||||||
} catch (NumberFormatException e) {
|
} catch (NumberFormatException e) {
|
||||||
cc.getForWhom().sendRawMessage(ChatColor.RED + Lang.get("itemCreateInvalidInput"));
|
cc.getForWhom().sendRawMessage(ChatColor.RED + Lang.get("itemCreateInvalidInput"));
|
||||||
return new MinutePrompt();
|
return new MinutePrompt();
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
return new DateTimePrompt(plugin, oldPrompt, source);
|
return new DateTimePrompt(oldPrompt, source);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -327,14 +326,14 @@ public class DateTimePrompt extends FixedSetPrompt {
|
|||||||
return new SecondPrompt();
|
return new SecondPrompt();
|
||||||
} else {
|
} else {
|
||||||
cc.setSessionData("tempSecond", Integer.parseInt(input));
|
cc.setSessionData("tempSecond", Integer.parseInt(input));
|
||||||
return new DateTimePrompt(plugin, oldPrompt, source);
|
return new DateTimePrompt(oldPrompt, source);
|
||||||
}
|
}
|
||||||
} catch (NumberFormatException e) {
|
} catch (NumberFormatException e) {
|
||||||
cc.getForWhom().sendRawMessage(ChatColor.RED + Lang.get("itemCreateInvalidInput"));
|
cc.getForWhom().sendRawMessage(ChatColor.RED + Lang.get("itemCreateInvalidInput"));
|
||||||
return new SecondPrompt();
|
return new SecondPrompt();
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
return new DateTimePrompt(plugin, oldPrompt, source);
|
return new DateTimePrompt(oldPrompt, source);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -363,16 +362,15 @@ public class DateTimePrompt extends FixedSetPrompt {
|
|||||||
cc.setSessionData("tempZone", t[0]);
|
cc.setSessionData("tempZone", t[0]);
|
||||||
} else {
|
} else {
|
||||||
cc.getForWhom().sendRawMessage(ChatColor.RED + Lang.get("itemCreateInvalidInput"));
|
cc.getForWhom().sendRawMessage(ChatColor.RED + Lang.get("itemCreateInvalidInput"));
|
||||||
plugin.getLogger().severe("Unable to get time zone for converted offset " + input);
|
|
||||||
}
|
}
|
||||||
return new DateTimePrompt(plugin, oldPrompt, source);
|
return new DateTimePrompt(oldPrompt, source);
|
||||||
}
|
}
|
||||||
} catch (NumberFormatException e) {
|
} catch (NumberFormatException e) {
|
||||||
cc.getForWhom().sendRawMessage(ChatColor.RED + Lang.get("itemCreateInvalidInput"));
|
cc.getForWhom().sendRawMessage(ChatColor.RED + Lang.get("itemCreateInvalidInput"));
|
||||||
return new OffsetPrompt();
|
return new OffsetPrompt();
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
return new DateTimePrompt(plugin, oldPrompt, source);
|
return new DateTimePrompt(oldPrompt, source);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -401,13 +399,13 @@ public class DateTimePrompt extends FixedSetPrompt {
|
|||||||
for (String z : zones) {
|
for (String z : zones) {
|
||||||
if (z.toLowerCase().startsWith(input.toLowerCase())) {
|
if (z.toLowerCase().startsWith(input.toLowerCase())) {
|
||||||
cc.setSessionData("tempZone", z);
|
cc.setSessionData("tempZone", z);
|
||||||
return new DateTimePrompt(plugin, oldPrompt, source);
|
return new DateTimePrompt(oldPrompt, source);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
cc.getForWhom().sendRawMessage(ChatColor.RED + Lang.get("itemCreateInvalidInput"));
|
cc.getForWhom().sendRawMessage(ChatColor.RED + Lang.get("itemCreateInvalidInput"));
|
||||||
return new ZonePrompt(zones);
|
return new ZonePrompt(zones);
|
||||||
} else {
|
} else {
|
||||||
return new DateTimePrompt(plugin, oldPrompt, source);
|
return new DateTimePrompt(oldPrompt, source);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -6,7 +6,6 @@ import org.bukkit.conversations.Prompt;
|
|||||||
import org.bukkit.inventory.ItemStack;
|
import org.bukkit.inventory.ItemStack;
|
||||||
|
|
||||||
import me.blackvein.quests.Quest;
|
import me.blackvein.quests.Quest;
|
||||||
import me.blackvein.quests.QuestFactory;
|
|
||||||
import me.blackvein.quests.Quests;
|
import me.blackvein.quests.Quests;
|
||||||
import me.blackvein.quests.convo.quests.QuestsEditorNumericPrompt;
|
import me.blackvein.quests.convo.quests.QuestsEditorNumericPrompt;
|
||||||
import me.blackvein.quests.events.editor.quests.QuestsEditorPostOpenNumericPromptEvent;
|
import me.blackvein.quests.events.editor.quests.QuestsEditorPostOpenNumericPromptEvent;
|
||||||
@ -16,12 +15,10 @@ import me.blackvein.quests.util.Lang;
|
|||||||
|
|
||||||
public class GUIDisplayPrompt extends QuestsEditorNumericPrompt {
|
public class GUIDisplayPrompt extends QuestsEditorNumericPrompt {
|
||||||
private final Quests plugin;
|
private final Quests plugin;
|
||||||
private final QuestFactory factory;
|
|
||||||
|
|
||||||
public GUIDisplayPrompt(Quests plugin, ConversationContext context, QuestFactory qf) {
|
public GUIDisplayPrompt(Quests plugin, ConversationContext context) {
|
||||||
super(context, qf);
|
super(context);
|
||||||
this.plugin = plugin;
|
this.plugin = plugin;
|
||||||
this.factory = qf;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private final int size = 3;
|
private final int size = 3;
|
||||||
@ -67,7 +64,7 @@ public class GUIDisplayPrompt extends QuestsEditorNumericPrompt {
|
|||||||
@Override
|
@Override
|
||||||
public String getPromptText(ConversationContext context) {
|
public String getPromptText(ConversationContext context) {
|
||||||
QuestsEditorPostOpenNumericPromptEvent event
|
QuestsEditorPostOpenNumericPromptEvent event
|
||||||
= new QuestsEditorPostOpenNumericPromptEvent(context, factory, this);
|
= new QuestsEditorPostOpenNumericPromptEvent(context, this);
|
||||||
plugin.getServer().getPluginManager().callEvent(event);
|
plugin.getServer().getPluginManager().callEvent(event);
|
||||||
|
|
||||||
if (context.getSessionData("tempStack") != null) {
|
if (context.getSessionData("tempStack") != null) {
|
||||||
@ -111,9 +108,9 @@ public class GUIDisplayPrompt extends QuestsEditorNumericPrompt {
|
|||||||
case 2:
|
case 2:
|
||||||
context.setSessionData(CK.Q_GUIDISPLAY, null);
|
context.setSessionData(CK.Q_GUIDISPLAY, null);
|
||||||
context.getForWhom().sendRawMessage(ChatColor.YELLOW + Lang.get("questGUICleared"));
|
context.getForWhom().sendRawMessage(ChatColor.YELLOW + Lang.get("questGUICleared"));
|
||||||
return new GUIDisplayPrompt(plugin, context, factory);
|
return new GUIDisplayPrompt(plugin, context);
|
||||||
case 3:
|
case 3:
|
||||||
return factory.returnToMenu(context);
|
return plugin.getQuestFactory().returnToMenu(context);
|
||||||
default:
|
default:
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
@ -15,7 +15,6 @@ package me.blackvein.quests.convo.quests.prompts;
|
|||||||
import java.util.LinkedList;
|
import java.util.LinkedList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import me.blackvein.quests.QuestFactory;
|
|
||||||
import me.blackvein.quests.Quests;
|
import me.blackvein.quests.Quests;
|
||||||
import me.blackvein.quests.util.CK;
|
import me.blackvein.quests.util.CK;
|
||||||
import me.blackvein.quests.util.ItemUtil;
|
import me.blackvein.quests.util.ItemUtil;
|
||||||
@ -35,14 +34,12 @@ public class ItemsPrompt extends FixedSetPrompt {
|
|||||||
private final Quests plugin;
|
private final Quests plugin;
|
||||||
private final int stageNum;
|
private final int stageNum;
|
||||||
private final String pref;
|
private final String pref;
|
||||||
private final QuestFactory factory;
|
|
||||||
|
|
||||||
public ItemsPrompt(Quests plugin, int stageNum, QuestFactory qf) {
|
public ItemsPrompt(Quests plugin, int stageNum) {
|
||||||
super("1", "2", "3", "4", "5");
|
super("1", "2", "3", "4", "5");
|
||||||
this.plugin = plugin;
|
this.plugin = plugin;
|
||||||
this.stageNum = stageNum;
|
this.stageNum = stageNum;
|
||||||
this.pref = "stage" + stageNum;
|
this.pref = "stage" + stageNum;
|
||||||
this.factory = qf;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
@ -133,7 +130,7 @@ public class ItemsPrompt extends FixedSetPrompt {
|
|||||||
return new BrewListPrompt();
|
return new BrewListPrompt();
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
return new StageMainPrompt(plugin, stageNum, context, factory);
|
return new StageMainPrompt(plugin, stageNum, context);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
context.getForWhom().sendRawMessage(ChatColor.RED + Lang.get("itemCreateCriticalError"));
|
context.getForWhom().sendRawMessage(ChatColor.RED + Lang.get("itemCreateCriticalError"));
|
||||||
return Prompt.END_OF_CONVERSATION;
|
return Prompt.END_OF_CONVERSATION;
|
||||||
@ -190,7 +187,7 @@ public class ItemsPrompt extends FixedSetPrompt {
|
|||||||
context.setSessionData(pref + CK.S_CRAFT_ITEMS, null);
|
context.setSessionData(pref + CK.S_CRAFT_ITEMS, null);
|
||||||
return new CraftListPrompt();
|
return new CraftListPrompt();
|
||||||
} else if (input.equalsIgnoreCase("3")) {
|
} else if (input.equalsIgnoreCase("3")) {
|
||||||
return new ItemsPrompt(plugin, stageNum, factory);
|
return new ItemsPrompt(plugin, stageNum);
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
@ -251,7 +248,7 @@ public class ItemsPrompt extends FixedSetPrompt {
|
|||||||
context.setSessionData(pref + CK.S_SMELT_ITEMS, null);
|
context.setSessionData(pref + CK.S_SMELT_ITEMS, null);
|
||||||
return new SmeltListPrompt();
|
return new SmeltListPrompt();
|
||||||
} else if (input.equalsIgnoreCase("3")) {
|
} else if (input.equalsIgnoreCase("3")) {
|
||||||
return new ItemsPrompt(plugin, stageNum, factory);
|
return new ItemsPrompt(plugin, stageNum);
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
@ -361,7 +358,7 @@ public class ItemsPrompt extends FixedSetPrompt {
|
|||||||
three = 0;
|
three = 0;
|
||||||
}
|
}
|
||||||
if (one == two && two == three) {
|
if (one == two && two == three) {
|
||||||
return new ItemsPrompt(plugin, stageNum, factory);
|
return new ItemsPrompt(plugin, stageNum);
|
||||||
} else {
|
} else {
|
||||||
context.getForWhom().sendRawMessage(ChatColor.RED + Lang.get("listsNotSameSize"));
|
context.getForWhom().sendRawMessage(ChatColor.RED + Lang.get("listsNotSameSize"));
|
||||||
return new EnchantmentListPrompt();
|
return new EnchantmentListPrompt();
|
||||||
@ -549,7 +546,7 @@ public class ItemsPrompt extends FixedSetPrompt {
|
|||||||
context.setSessionData(pref + CK.S_BREW_ITEMS, null);
|
context.setSessionData(pref + CK.S_BREW_ITEMS, null);
|
||||||
return new BrewListPrompt();
|
return new BrewListPrompt();
|
||||||
} else if (input.equalsIgnoreCase("3")) {
|
} else if (input.equalsIgnoreCase("3")) {
|
||||||
return new ItemsPrompt(plugin, stageNum, factory);
|
return new ItemsPrompt(plugin, stageNum);
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
@ -30,7 +30,6 @@ import org.bukkit.entity.EntityType;
|
|||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.entity.Tameable;
|
import org.bukkit.entity.Tameable;
|
||||||
|
|
||||||
import me.blackvein.quests.QuestFactory;
|
|
||||||
import me.blackvein.quests.Quests;
|
import me.blackvein.quests.Quests;
|
||||||
import me.blackvein.quests.util.CK;
|
import me.blackvein.quests.util.CK;
|
||||||
import me.blackvein.quests.util.ConfigUtil;
|
import me.blackvein.quests.util.ConfigUtil;
|
||||||
@ -41,14 +40,12 @@ public class MobsPrompt extends FixedSetPrompt {
|
|||||||
private final Quests plugin;
|
private final Quests plugin;
|
||||||
private final int stageNum;
|
private final int stageNum;
|
||||||
private final String pref;
|
private final String pref;
|
||||||
private final QuestFactory factory;
|
|
||||||
|
|
||||||
public MobsPrompt(Quests plugin, int stageNum, QuestFactory qf) {
|
public MobsPrompt(Quests plugin, int stageNum) {
|
||||||
super("1", "2", "3", "4", "5", "6");
|
super("1", "2", "3", "4", "5", "6");
|
||||||
this.plugin = plugin;
|
this.plugin = plugin;
|
||||||
this.stageNum = stageNum;
|
this.stageNum = stageNum;
|
||||||
this.pref = "stage" + stageNum;
|
this.pref = "stage" + stageNum;
|
||||||
this.factory = qf;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
@ -149,7 +146,7 @@ public class MobsPrompt extends FixedSetPrompt {
|
|||||||
return new ShearListPrompt();
|
return new ShearListPrompt();
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
return new StageMainPrompt(plugin, stageNum, context, factory);
|
return new StageMainPrompt(plugin, stageNum, context);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
context.getForWhom().sendRawMessage(ChatColor.RED + Lang.get("itemCreateCriticalError"));
|
context.getForWhom().sendRawMessage(ChatColor.RED + Lang.get("itemCreateCriticalError"));
|
||||||
return Prompt.END_OF_CONVERSATION;
|
return Prompt.END_OF_CONVERSATION;
|
||||||
@ -252,9 +249,9 @@ public class MobsPrompt extends FixedSetPrompt {
|
|||||||
context.getForWhom().sendRawMessage(ChatColor.RED + Lang.get("stageEditorNoMobTypes"));
|
context.getForWhom().sendRawMessage(ChatColor.RED + Lang.get("stageEditorNoMobTypes"));
|
||||||
return new MobListPrompt();
|
return new MobListPrompt();
|
||||||
} else {
|
} else {
|
||||||
Map<UUID, Block> temp = factory.getSelectedKillLocations();
|
Map<UUID, Block> temp = plugin.getQuestFactory().getSelectedKillLocations();
|
||||||
temp.put(((Player) context.getForWhom()).getUniqueId(), null);
|
temp.put(((Player) context.getForWhom()).getUniqueId(), null);
|
||||||
factory.setSelectedKillLocations(temp);
|
plugin.getQuestFactory().setSelectedKillLocations(temp);
|
||||||
return new MobLocationPrompt();
|
return new MobLocationPrompt();
|
||||||
}
|
}
|
||||||
} else if (input.equalsIgnoreCase("4")) {
|
} else if (input.equalsIgnoreCase("4")) {
|
||||||
@ -313,13 +310,13 @@ public class MobsPrompt extends FixedSetPrompt {
|
|||||||
if (one == two) {
|
if (one == two) {
|
||||||
if (three != 0 || four != 0 || five != 0) {
|
if (three != 0 || four != 0 || five != 0) {
|
||||||
if (two == three && three == four && four == five) {
|
if (two == three && three == four && four == five) {
|
||||||
return new StageMainPrompt(plugin, stageNum, context, factory);
|
return new StageMainPrompt(plugin, stageNum, context);
|
||||||
} else {
|
} else {
|
||||||
context.getForWhom().sendRawMessage(ChatColor.RED + Lang.get("listsNotSameSize"));
|
context.getForWhom().sendRawMessage(ChatColor.RED + Lang.get("listsNotSameSize"));
|
||||||
return new MobListPrompt();
|
return new MobListPrompt();
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
return new StageMainPrompt(plugin, stageNum, context, factory);
|
return new StageMainPrompt(plugin, stageNum, context);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
context.getForWhom().sendRawMessage(ChatColor.RED + Lang.get("listsNotSameSize"));
|
context.getForWhom().sendRawMessage(ChatColor.RED + Lang.get("listsNotSameSize"));
|
||||||
@ -443,7 +440,7 @@ public class MobsPrompt extends FixedSetPrompt {
|
|||||||
public Prompt acceptInput(ConversationContext context, String input) {
|
public Prompt acceptInput(ConversationContext context, String input) {
|
||||||
Player player = (Player) context.getForWhom();
|
Player player = (Player) context.getForWhom();
|
||||||
if (input.equalsIgnoreCase(Lang.get("cmdAdd"))) {
|
if (input.equalsIgnoreCase(Lang.get("cmdAdd"))) {
|
||||||
Block block = factory.getSelectedKillLocations().get(player.getUniqueId());
|
Block block = plugin.getQuestFactory().getSelectedKillLocations().get(player.getUniqueId());
|
||||||
if (block != null) {
|
if (block != null) {
|
||||||
Location loc = block.getLocation();
|
Location loc = block.getLocation();
|
||||||
LinkedList<String> locs;
|
LinkedList<String> locs;
|
||||||
@ -454,18 +451,18 @@ public class MobsPrompt extends FixedSetPrompt {
|
|||||||
}
|
}
|
||||||
locs.add(ConfigUtil.getLocationInfo(loc));
|
locs.add(ConfigUtil.getLocationInfo(loc));
|
||||||
context.setSessionData(pref + CK.S_MOB_KILL_LOCATIONS, locs);
|
context.setSessionData(pref + CK.S_MOB_KILL_LOCATIONS, locs);
|
||||||
Map<UUID, Block> temp = factory.getSelectedKillLocations();
|
Map<UUID, Block> temp = plugin.getQuestFactory().getSelectedKillLocations();
|
||||||
temp.remove(player.getUniqueId());
|
temp.remove(player.getUniqueId());
|
||||||
factory.setSelectedKillLocations(temp);
|
plugin.getQuestFactory().setSelectedKillLocations(temp);
|
||||||
} else {
|
} else {
|
||||||
player.sendMessage(ChatColor.RED + Lang.get("stageEditorNoBlock"));
|
player.sendMessage(ChatColor.RED + Lang.get("stageEditorNoBlock"));
|
||||||
return new MobLocationPrompt();
|
return new MobLocationPrompt();
|
||||||
}
|
}
|
||||||
return new MobListPrompt();
|
return new MobListPrompt();
|
||||||
} else if (input.equalsIgnoreCase(Lang.get("cmdCancel"))) {
|
} else if (input.equalsIgnoreCase(Lang.get("cmdCancel"))) {
|
||||||
Map<UUID, Block> temp = factory.getSelectedKillLocations();
|
Map<UUID, Block> temp = plugin.getQuestFactory().getSelectedKillLocations();
|
||||||
temp.remove(player.getUniqueId());
|
temp.remove(player.getUniqueId());
|
||||||
factory.setSelectedKillLocations(temp);
|
plugin.getQuestFactory().setSelectedKillLocations(temp);
|
||||||
return new MobListPrompt();
|
return new MobListPrompt();
|
||||||
} else {
|
} else {
|
||||||
return new MobLocationPrompt();
|
return new MobLocationPrompt();
|
||||||
@ -551,7 +548,7 @@ public class MobsPrompt extends FixedSetPrompt {
|
|||||||
} else if (input.equalsIgnoreCase(Lang.get("cmdClear"))) {
|
} else if (input.equalsIgnoreCase(Lang.get("cmdClear"))) {
|
||||||
context.setSessionData(pref + CK.S_FISH, null);
|
context.setSessionData(pref + CK.S_FISH, null);
|
||||||
}
|
}
|
||||||
return new StageMainPrompt(plugin, stageNum, context, factory);
|
return new StageMainPrompt(plugin, stageNum, context);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -582,7 +579,7 @@ public class MobsPrompt extends FixedSetPrompt {
|
|||||||
} else if (input.equalsIgnoreCase(Lang.get("cmdClear"))) {
|
} else if (input.equalsIgnoreCase(Lang.get("cmdClear"))) {
|
||||||
context.setSessionData(pref + CK.S_COW_MILK, null);
|
context.setSessionData(pref + CK.S_COW_MILK, null);
|
||||||
}
|
}
|
||||||
return new StageMainPrompt(plugin, stageNum, context, factory);
|
return new StageMainPrompt(plugin, stageNum, context);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -659,7 +656,7 @@ public class MobsPrompt extends FixedSetPrompt {
|
|||||||
two = 0;
|
two = 0;
|
||||||
}
|
}
|
||||||
if (one == two) {
|
if (one == two) {
|
||||||
return new StageMainPrompt(plugin, stageNum, context, factory);
|
return new StageMainPrompt(plugin, stageNum, context);
|
||||||
} else {
|
} else {
|
||||||
context.getForWhom().sendRawMessage(ChatColor.RED + Lang.get("listsNotSameSize"));
|
context.getForWhom().sendRawMessage(ChatColor.RED + Lang.get("listsNotSameSize"));
|
||||||
return new TameListPrompt();
|
return new TameListPrompt();
|
||||||
@ -829,7 +826,7 @@ public class MobsPrompt extends FixedSetPrompt {
|
|||||||
two = 0;
|
two = 0;
|
||||||
}
|
}
|
||||||
if (one == two) {
|
if (one == two) {
|
||||||
return new StageMainPrompt(plugin, stageNum, context, factory);
|
return new StageMainPrompt(plugin, stageNum, context);
|
||||||
} else {
|
} else {
|
||||||
context.getForWhom().sendRawMessage(ChatColor.RED + Lang.get("listsNotSameSize"));
|
context.getForWhom().sendRawMessage(ChatColor.RED + Lang.get("listsNotSameSize"));
|
||||||
return new ShearListPrompt();
|
return new ShearListPrompt();
|
||||||
|
@ -25,7 +25,6 @@ import org.bukkit.conversations.StringPrompt;
|
|||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.inventory.ItemStack;
|
import org.bukkit.inventory.ItemStack;
|
||||||
|
|
||||||
import me.blackvein.quests.QuestFactory;
|
|
||||||
import me.blackvein.quests.Quests;
|
import me.blackvein.quests.Quests;
|
||||||
import me.blackvein.quests.util.CK;
|
import me.blackvein.quests.util.CK;
|
||||||
import me.blackvein.quests.util.ItemUtil;
|
import me.blackvein.quests.util.ItemUtil;
|
||||||
@ -35,14 +34,12 @@ public class NPCsPrompt extends FixedSetPrompt {
|
|||||||
private final Quests plugin;
|
private final Quests plugin;
|
||||||
private final int stageNum;
|
private final int stageNum;
|
||||||
private final String pref;
|
private final String pref;
|
||||||
private final QuestFactory factory;
|
|
||||||
|
|
||||||
public NPCsPrompt(Quests plugin, int stageNum, QuestFactory qf) {
|
public NPCsPrompt(Quests plugin, int stageNum) {
|
||||||
super("1", "2", "3", "4");
|
super("1", "2", "3", "4");
|
||||||
this.plugin = plugin;
|
this.plugin = plugin;
|
||||||
this.stageNum = stageNum;
|
this.stageNum = stageNum;
|
||||||
this.pref = "stage" + stageNum;
|
this.pref = "stage" + stageNum;
|
||||||
this.factory = qf;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
@ -127,25 +124,25 @@ public class NPCsPrompt extends FixedSetPrompt {
|
|||||||
return new DeliveryListPrompt();
|
return new DeliveryListPrompt();
|
||||||
} else {
|
} else {
|
||||||
context.getForWhom().sendRawMessage(ChatColor.RED + Lang.get("stageEditorNoCitizens"));
|
context.getForWhom().sendRawMessage(ChatColor.RED + Lang.get("stageEditorNoCitizens"));
|
||||||
return new StageMainPrompt(plugin, stageNum, context, factory);
|
return new StageMainPrompt(plugin, stageNum, context);
|
||||||
}
|
}
|
||||||
} else if (input.equalsIgnoreCase("2")) {
|
} else if (input.equalsIgnoreCase("2")) {
|
||||||
if (plugin.getDependencies().getCitizens() != null) {
|
if (plugin.getDependencies().getCitizens() != null) {
|
||||||
return new NPCIDsToTalkToPrompt();
|
return new NPCIDsToTalkToPrompt();
|
||||||
} else {
|
} else {
|
||||||
context.getForWhom().sendRawMessage(ChatColor.RED + Lang.get("stageEditorNoCitizens"));
|
context.getForWhom().sendRawMessage(ChatColor.RED + Lang.get("stageEditorNoCitizens"));
|
||||||
return new StageMainPrompt(plugin, stageNum, context, factory);
|
return new StageMainPrompt(plugin, stageNum, context);
|
||||||
}
|
}
|
||||||
} else if (input.equalsIgnoreCase("3")) {
|
} else if (input.equalsIgnoreCase("3")) {
|
||||||
if (plugin.getDependencies().getCitizens() != null) {
|
if (plugin.getDependencies().getCitizens() != null) {
|
||||||
return new NPCKillListPrompt();
|
return new NPCKillListPrompt();
|
||||||
} else {
|
} else {
|
||||||
context.getForWhom().sendRawMessage(ChatColor.RED + Lang.get("stageEditorNoCitizens"));
|
context.getForWhom().sendRawMessage(ChatColor.RED + Lang.get("stageEditorNoCitizens"));
|
||||||
return new StageMainPrompt(plugin, stageNum, context, factory);
|
return new StageMainPrompt(plugin, stageNum, context);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
return new StageMainPrompt(plugin, stageNum, context, factory);
|
return new StageMainPrompt(plugin, stageNum, context);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
context.getForWhom().sendRawMessage(ChatColor.RED + Lang.get("itemCreateCriticalError"));
|
context.getForWhom().sendRawMessage(ChatColor.RED + Lang.get("itemCreateCriticalError"));
|
||||||
return Prompt.END_OF_CONVERSATION;
|
return Prompt.END_OF_CONVERSATION;
|
||||||
@ -264,7 +261,7 @@ public class NPCsPrompt extends FixedSetPrompt {
|
|||||||
context.getForWhom().sendRawMessage(ChatColor.RED + Lang.get("stageEditorNoDeliveryMessage"));
|
context.getForWhom().sendRawMessage(ChatColor.RED + Lang.get("stageEditorNoDeliveryMessage"));
|
||||||
return new DeliveryListPrompt();
|
return new DeliveryListPrompt();
|
||||||
} else {
|
} else {
|
||||||
return new NPCsPrompt(plugin, stageNum, factory);
|
return new NPCsPrompt(plugin, stageNum);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
context.getForWhom().sendRawMessage(ChatColor.RED + Lang.get("listsNotSameSize"));
|
context.getForWhom().sendRawMessage(ChatColor.RED + Lang.get("listsNotSameSize"));
|
||||||
@ -294,9 +291,9 @@ public class NPCsPrompt extends FixedSetPrompt {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getPromptText(ConversationContext context) {
|
public String getPromptText(ConversationContext context) {
|
||||||
HashSet<Player> temp = factory.getSelectingNpcs();
|
HashSet<Player> temp = plugin.getQuestFactory().getSelectingNpcs();
|
||||||
temp.add((Player) context.getForWhom());
|
temp.add((Player) context.getForWhom());
|
||||||
factory.setSelectingNpcs(temp);
|
plugin.getQuestFactory().setSelectingNpcs(temp);
|
||||||
return ChatColor.YELLOW + Lang.get("stageEditorNPCPrompt") + "\n" + ChatColor.GOLD + Lang.get("npcHint");
|
return ChatColor.YELLOW + Lang.get("stageEditorNPCPrompt") + "\n" + ChatColor.GOLD + Lang.get("npcHint");
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -323,9 +320,9 @@ public class NPCsPrompt extends FixedSetPrompt {
|
|||||||
}
|
}
|
||||||
context.setSessionData(pref + CK.S_DELIVERY_NPCS, npcs);
|
context.setSessionData(pref + CK.S_DELIVERY_NPCS, npcs);
|
||||||
}
|
}
|
||||||
HashSet<Player> temp = factory.getSelectingNpcs();
|
HashSet<Player> temp = plugin.getQuestFactory().getSelectingNpcs();
|
||||||
temp.remove((Player) context.getForWhom());
|
temp.remove((Player) context.getForWhom());
|
||||||
factory.setSelectingNpcs(temp);
|
plugin.getQuestFactory().setSelectingNpcs(temp);
|
||||||
return new DeliveryListPrompt();
|
return new DeliveryListPrompt();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -354,9 +351,9 @@ public class NPCsPrompt extends FixedSetPrompt {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getPromptText(ConversationContext context) {
|
public String getPromptText(ConversationContext context) {
|
||||||
HashSet<Player> temp = factory.getSelectingNpcs();
|
HashSet<Player> temp = plugin.getQuestFactory().getSelectingNpcs();
|
||||||
temp.add((Player) context.getForWhom());
|
temp.add((Player) context.getForWhom());
|
||||||
factory.setSelectingNpcs(temp);
|
plugin.getQuestFactory().setSelectingNpcs(temp);
|
||||||
return ChatColor.YELLOW + Lang.get("stageEditorNPCToTalkToPrompt") + "\n" + ChatColor.GOLD
|
return ChatColor.YELLOW + Lang.get("stageEditorNPCToTalkToPrompt") + "\n" + ChatColor.GOLD
|
||||||
+ Lang.get("npcHint");
|
+ Lang.get("npcHint");
|
||||||
}
|
}
|
||||||
@ -383,14 +380,14 @@ public class NPCsPrompt extends FixedSetPrompt {
|
|||||||
return new NPCIDsToTalkToPrompt();
|
return new NPCIDsToTalkToPrompt();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
HashSet<Player> temp = factory.getSelectingNpcs();
|
HashSet<Player> temp = plugin.getQuestFactory().getSelectingNpcs();
|
||||||
temp.remove((Player) context.getForWhom());
|
temp.remove((Player) context.getForWhom());
|
||||||
factory.setSelectingNpcs(temp);
|
plugin.getQuestFactory().setSelectingNpcs(temp);
|
||||||
context.setSessionData(pref + CK.S_NPCS_TO_TALK_TO, npcs);
|
context.setSessionData(pref + CK.S_NPCS_TO_TALK_TO, npcs);
|
||||||
} else if (input.equalsIgnoreCase(Lang.get("cmdClear"))) {
|
} else if (input.equalsIgnoreCase(Lang.get("cmdClear"))) {
|
||||||
context.setSessionData(pref + CK.S_NPCS_TO_TALK_TO, null);
|
context.setSessionData(pref + CK.S_NPCS_TO_TALK_TO, null);
|
||||||
}
|
}
|
||||||
return new StageMainPrompt(plugin, stageNum, context, factory);
|
return new StageMainPrompt(plugin, stageNum, context);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -469,7 +466,7 @@ public class NPCsPrompt extends FixedSetPrompt {
|
|||||||
two = 0;
|
two = 0;
|
||||||
}
|
}
|
||||||
if (one == two) {
|
if (one == two) {
|
||||||
return new StageMainPrompt(plugin, stageNum, context, factory);
|
return new StageMainPrompt(plugin, stageNum, context);
|
||||||
} else {
|
} else {
|
||||||
context.getForWhom().sendRawMessage(ChatColor.RED + Lang.get("listsNotSameSize"));
|
context.getForWhom().sendRawMessage(ChatColor.RED + Lang.get("listsNotSameSize"));
|
||||||
return new NPCKillListPrompt();
|
return new NPCKillListPrompt();
|
||||||
@ -493,9 +490,9 @@ public class NPCsPrompt extends FixedSetPrompt {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getPromptText(ConversationContext context) {
|
public String getPromptText(ConversationContext context) {
|
||||||
HashSet<Player> temp = factory.getSelectingNpcs();
|
HashSet<Player> temp = plugin.getQuestFactory().getSelectingNpcs();
|
||||||
temp.add((Player) context.getForWhom());
|
temp.add((Player) context.getForWhom());
|
||||||
factory.setSelectingNpcs(temp);
|
plugin.getQuestFactory().setSelectingNpcs(temp);
|
||||||
return ChatColor.YELLOW + Lang.get("stageEditorNPCPrompt") + "\n" + ChatColor.GOLD + Lang.get("npcHint");
|
return ChatColor.YELLOW + Lang.get("stageEditorNPCPrompt") + "\n" + ChatColor.GOLD + Lang.get("npcHint");
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -522,9 +519,9 @@ public class NPCsPrompt extends FixedSetPrompt {
|
|||||||
}
|
}
|
||||||
context.setSessionData(pref + CK.S_NPCS_TO_KILL, npcs);
|
context.setSessionData(pref + CK.S_NPCS_TO_KILL, npcs);
|
||||||
}
|
}
|
||||||
HashSet<Player> temp = factory.getSelectingNpcs();
|
HashSet<Player> temp = plugin.getQuestFactory().getSelectingNpcs();
|
||||||
temp.remove((Player) context.getForWhom());
|
temp.remove((Player) context.getForWhom());
|
||||||
factory.setSelectingNpcs(temp);
|
plugin.getQuestFactory().setSelectingNpcs(temp);
|
||||||
return new NPCKillListPrompt();
|
return new NPCKillListPrompt();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -17,7 +17,6 @@ import org.bukkit.conversations.ConversationContext;
|
|||||||
import org.bukkit.conversations.Prompt;
|
import org.bukkit.conversations.Prompt;
|
||||||
|
|
||||||
import me.blackvein.quests.Options;
|
import me.blackvein.quests.Options;
|
||||||
import me.blackvein.quests.QuestFactory;
|
|
||||||
import me.blackvein.quests.Quests;
|
import me.blackvein.quests.Quests;
|
||||||
import me.blackvein.quests.convo.quests.QuestsEditorNumericPrompt;
|
import me.blackvein.quests.convo.quests.QuestsEditorNumericPrompt;
|
||||||
import me.blackvein.quests.convo.quests.QuestsEditorStringPrompt;
|
import me.blackvein.quests.convo.quests.QuestsEditorStringPrompt;
|
||||||
@ -29,14 +28,12 @@ import me.blackvein.quests.util.Lang;
|
|||||||
public class OptionsPrompt extends QuestsEditorNumericPrompt {
|
public class OptionsPrompt extends QuestsEditorNumericPrompt {
|
||||||
|
|
||||||
private final Quests plugin;
|
private final Quests plugin;
|
||||||
private final QuestFactory factory;
|
|
||||||
private String tempKey;
|
private String tempKey;
|
||||||
private Prompt tempPrompt;
|
private Prompt tempPrompt;
|
||||||
|
|
||||||
public OptionsPrompt(Quests plugin, ConversationContext context, QuestFactory qf) {
|
public OptionsPrompt(Quests plugin, ConversationContext context) {
|
||||||
super(context, qf);
|
super(context);
|
||||||
this.plugin = plugin;
|
this.plugin = plugin;
|
||||||
factory = qf;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private final int size = 3;
|
private final int size = 3;
|
||||||
@ -87,7 +84,7 @@ public class OptionsPrompt extends QuestsEditorNumericPrompt {
|
|||||||
@Override
|
@Override
|
||||||
public String getPromptText(ConversationContext context) {
|
public String getPromptText(ConversationContext context) {
|
||||||
QuestsEditorPostOpenNumericPromptEvent event
|
QuestsEditorPostOpenNumericPromptEvent event
|
||||||
= new QuestsEditorPostOpenNumericPromptEvent(context, factory, this);
|
= new QuestsEditorPostOpenNumericPromptEvent(context, this);
|
||||||
plugin.getServer().getPluginManager().callEvent(event);
|
plugin.getServer().getPluginManager().callEvent(event);
|
||||||
|
|
||||||
String text = ChatColor.DARK_GREEN + getTitle(context)
|
String text = ChatColor.DARK_GREEN + getTitle(context)
|
||||||
@ -104,19 +101,19 @@ public class OptionsPrompt extends QuestsEditorNumericPrompt {
|
|||||||
protected Prompt acceptValidatedInput(ConversationContext context, Number input) {
|
protected Prompt acceptValidatedInput(ConversationContext context, Number input) {
|
||||||
switch (input.intValue()) {
|
switch (input.intValue()) {
|
||||||
case 1:
|
case 1:
|
||||||
return new GeneralPrompt(plugin, context, factory);
|
return new GeneralPrompt(plugin, context);
|
||||||
case 2:
|
case 2:
|
||||||
return new MultiplayerPrompt(plugin, context, factory);
|
return new MultiplayerPrompt(plugin, context);
|
||||||
case 3:
|
case 3:
|
||||||
return factory.returnToMenu(context);
|
return plugin.getQuestFactory().returnToMenu(context);
|
||||||
default:
|
default:
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public class TrueFalsePrompt extends QuestsEditorStringPrompt {
|
public class TrueFalsePrompt extends QuestsEditorStringPrompt {
|
||||||
public TrueFalsePrompt(Quests plugin, ConversationContext context, QuestFactory factory) {
|
public TrueFalsePrompt(Quests plugin, ConversationContext context) {
|
||||||
super(context, factory);
|
super(context);
|
||||||
}
|
}
|
||||||
|
|
||||||
private final int size = 4;
|
private final int size = 4;
|
||||||
@ -156,7 +153,7 @@ public class OptionsPrompt extends QuestsEditorNumericPrompt {
|
|||||||
@Override
|
@Override
|
||||||
public String getPromptText(ConversationContext context) {
|
public String getPromptText(ConversationContext context) {
|
||||||
QuestsEditorPostOpenStringPromptEvent event
|
QuestsEditorPostOpenStringPromptEvent event
|
||||||
= new QuestsEditorPostOpenStringPromptEvent(context, factory, this);
|
= new QuestsEditorPostOpenStringPromptEvent(context, this);
|
||||||
plugin.getServer().getPluginManager().callEvent(event);
|
plugin.getServer().getPluginManager().callEvent(event);
|
||||||
|
|
||||||
String text = Lang.get("optBooleanPrompt");
|
String text = Lang.get("optBooleanPrompt");
|
||||||
@ -177,7 +174,7 @@ public class OptionsPrompt extends QuestsEditorNumericPrompt {
|
|||||||
context.setSessionData(tempKey, false);
|
context.setSessionData(tempKey, false);
|
||||||
} else {
|
} else {
|
||||||
context.getForWhom().sendRawMessage(ChatColor.RED + Lang.get("itemCreateInvalidInput"));
|
context.getForWhom().sendRawMessage(ChatColor.RED + Lang.get("itemCreateInvalidInput"));
|
||||||
return new TrueFalsePrompt(plugin, context, factory);
|
return new TrueFalsePrompt(plugin, context);
|
||||||
}
|
}
|
||||||
} else if (input.equalsIgnoreCase(Lang.get("cmdClear"))) {
|
} else if (input.equalsIgnoreCase(Lang.get("cmdClear"))) {
|
||||||
context.setSessionData(tempKey, null);
|
context.setSessionData(tempKey, null);
|
||||||
@ -188,8 +185,8 @@ public class OptionsPrompt extends QuestsEditorNumericPrompt {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public class LevelPrompt extends QuestsEditorStringPrompt {
|
public class LevelPrompt extends QuestsEditorStringPrompt {
|
||||||
public LevelPrompt(Quests plugin, ConversationContext context, QuestFactory factory) {
|
public LevelPrompt(Quests plugin, ConversationContext context) {
|
||||||
super(context, factory);
|
super(context);
|
||||||
}
|
}
|
||||||
|
|
||||||
private final int size = 6;
|
private final int size = 6;
|
||||||
@ -249,7 +246,7 @@ public class OptionsPrompt extends QuestsEditorNumericPrompt {
|
|||||||
@Override
|
@Override
|
||||||
public String getPromptText(ConversationContext context) {
|
public String getPromptText(ConversationContext context) {
|
||||||
QuestsEditorPostOpenStringPromptEvent event
|
QuestsEditorPostOpenStringPromptEvent event
|
||||||
= new QuestsEditorPostOpenStringPromptEvent(context, factory, this);
|
= new QuestsEditorPostOpenStringPromptEvent(context, this);
|
||||||
plugin.getServer().getPluginManager().callEvent(event);
|
plugin.getServer().getPluginManager().callEvent(event);
|
||||||
|
|
||||||
String text = Lang.get("optNumberPrompt");
|
String text = Lang.get("optNumberPrompt");
|
||||||
@ -284,8 +281,8 @@ public class OptionsPrompt extends QuestsEditorNumericPrompt {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public class GeneralPrompt extends QuestsEditorNumericPrompt {
|
public class GeneralPrompt extends QuestsEditorNumericPrompt {
|
||||||
public GeneralPrompt(Quests plugin, ConversationContext context, QuestFactory factory) {
|
public GeneralPrompt(Quests plugin, ConversationContext context) {
|
||||||
super(context, factory);
|
super(context);
|
||||||
}
|
}
|
||||||
|
|
||||||
private final int size = 3;
|
private final int size = 3;
|
||||||
@ -365,7 +362,7 @@ public class OptionsPrompt extends QuestsEditorNumericPrompt {
|
|||||||
@Override
|
@Override
|
||||||
public String getPromptText(ConversationContext context) {
|
public String getPromptText(ConversationContext context) {
|
||||||
QuestsEditorPostOpenNumericPromptEvent event
|
QuestsEditorPostOpenNumericPromptEvent event
|
||||||
= new QuestsEditorPostOpenNumericPromptEvent(context, factory, this);
|
= new QuestsEditorPostOpenNumericPromptEvent(context, this);
|
||||||
plugin.getServer().getPluginManager().callEvent(event);
|
plugin.getServer().getPluginManager().callEvent(event);
|
||||||
|
|
||||||
String text = ChatColor.DARK_GREEN + "- " + getTitle(context) + " -\n";
|
String text = ChatColor.DARK_GREEN + "- " + getTitle(context) + " -\n";
|
||||||
@ -381,17 +378,17 @@ public class OptionsPrompt extends QuestsEditorNumericPrompt {
|
|||||||
switch (input.intValue()) {
|
switch (input.intValue()) {
|
||||||
case 1:
|
case 1:
|
||||||
tempKey = CK.OPT_ALLOW_COMMANDS;
|
tempKey = CK.OPT_ALLOW_COMMANDS;
|
||||||
tempPrompt = new GeneralPrompt(plugin, context, factory);
|
tempPrompt = new GeneralPrompt(plugin, context);
|
||||||
return new TrueFalsePrompt(plugin, context, factory);
|
return new TrueFalsePrompt(plugin, context);
|
||||||
case 2:
|
case 2:
|
||||||
tempKey = CK.OPT_ALLOW_QUITTING;
|
tempKey = CK.OPT_ALLOW_QUITTING;
|
||||||
tempPrompt = new GeneralPrompt(plugin, context, factory);
|
tempPrompt = new GeneralPrompt(plugin, context);
|
||||||
return new TrueFalsePrompt(plugin, context, factory);
|
return new TrueFalsePrompt(plugin, context);
|
||||||
case 3:
|
case 3:
|
||||||
tempKey = null;
|
tempKey = null;
|
||||||
tempPrompt = null;
|
tempPrompt = null;
|
||||||
try {
|
try {
|
||||||
return new OptionsPrompt(plugin, context, factory);
|
return new OptionsPrompt(plugin, context);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
context.getForWhom().sendRawMessage(ChatColor.RED + Lang.get("itemCreateCriticalError"));
|
context.getForWhom().sendRawMessage(ChatColor.RED + Lang.get("itemCreateCriticalError"));
|
||||||
return Prompt.END_OF_CONVERSATION;
|
return Prompt.END_OF_CONVERSATION;
|
||||||
@ -403,8 +400,8 @@ public class OptionsPrompt extends QuestsEditorNumericPrompt {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public class MultiplayerPrompt extends QuestsEditorNumericPrompt {
|
public class MultiplayerPrompt extends QuestsEditorNumericPrompt {
|
||||||
public MultiplayerPrompt(Quests plugin, ConversationContext context, QuestFactory factory) {
|
public MultiplayerPrompt(Quests plugin, ConversationContext context) {
|
||||||
super(context, factory);
|
super(context);
|
||||||
}
|
}
|
||||||
|
|
||||||
private final int size = 5;
|
private final int size = 5;
|
||||||
@ -512,7 +509,7 @@ public class OptionsPrompt extends QuestsEditorNumericPrompt {
|
|||||||
@Override
|
@Override
|
||||||
public String getPromptText(ConversationContext context) {
|
public String getPromptText(ConversationContext context) {
|
||||||
QuestsEditorPostOpenNumericPromptEvent event
|
QuestsEditorPostOpenNumericPromptEvent event
|
||||||
= new QuestsEditorPostOpenNumericPromptEvent(context, factory, this);
|
= new QuestsEditorPostOpenNumericPromptEvent(context, this);
|
||||||
plugin.getServer().getPluginManager().callEvent(event);
|
plugin.getServer().getPluginManager().callEvent(event);
|
||||||
|
|
||||||
String text = ChatColor.DARK_GREEN + "- " + getTitle(context) + " -\n";
|
String text = ChatColor.DARK_GREEN + "- " + getTitle(context) + " -\n";
|
||||||
@ -528,25 +525,25 @@ public class OptionsPrompt extends QuestsEditorNumericPrompt {
|
|||||||
switch (input.intValue()) {
|
switch (input.intValue()) {
|
||||||
case 1:
|
case 1:
|
||||||
tempKey = CK.OPT_USE_DUNGEONSXL_PLUGIN;
|
tempKey = CK.OPT_USE_DUNGEONSXL_PLUGIN;
|
||||||
tempPrompt = new MultiplayerPrompt(plugin, context, factory);
|
tempPrompt = new MultiplayerPrompt(plugin, context);
|
||||||
return new TrueFalsePrompt(plugin, context, factory);
|
return new TrueFalsePrompt(plugin, context);
|
||||||
case 2:
|
case 2:
|
||||||
tempKey = CK.OPT_USE_PARTIES_PLUGIN;
|
tempKey = CK.OPT_USE_PARTIES_PLUGIN;
|
||||||
tempPrompt = new MultiplayerPrompt(plugin, context, factory);
|
tempPrompt = new MultiplayerPrompt(plugin, context);
|
||||||
return new TrueFalsePrompt(plugin, context, factory);
|
return new TrueFalsePrompt(plugin, context);
|
||||||
case 3:
|
case 3:
|
||||||
tempKey = CK.OPT_SHARE_PROGRESS_LEVEL;
|
tempKey = CK.OPT_SHARE_PROGRESS_LEVEL;
|
||||||
tempPrompt = new MultiplayerPrompt(plugin, context, factory);
|
tempPrompt = new MultiplayerPrompt(plugin, context);
|
||||||
return new LevelPrompt(plugin, context, factory);
|
return new LevelPrompt(plugin, context);
|
||||||
case 4:
|
case 4:
|
||||||
tempKey = CK.OPT_REQUIRE_SAME_QUEST;
|
tempKey = CK.OPT_REQUIRE_SAME_QUEST;
|
||||||
tempPrompt = new MultiplayerPrompt(plugin, context, factory);
|
tempPrompt = new MultiplayerPrompt(plugin, context);
|
||||||
return new TrueFalsePrompt(plugin, context, factory);
|
return new TrueFalsePrompt(plugin, context);
|
||||||
case 5:
|
case 5:
|
||||||
tempKey = null;
|
tempKey = null;
|
||||||
tempPrompt = null;
|
tempPrompt = null;
|
||||||
try {
|
try {
|
||||||
return new OptionsPrompt(plugin, context, factory);
|
return new OptionsPrompt(plugin, context);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
context.getForWhom().sendRawMessage(ChatColor.RED + Lang.get("itemCreateCriticalError"));
|
context.getForWhom().sendRawMessage(ChatColor.RED + Lang.get("itemCreateCriticalError"));
|
||||||
return Prompt.END_OF_CONVERSATION;
|
return Prompt.END_OF_CONVERSATION;
|
||||||
|
@ -14,7 +14,7 @@ public class OverridePrompt extends QuestsEditorStringPrompt {
|
|||||||
private String classPrefix;
|
private String classPrefix;
|
||||||
|
|
||||||
public OverridePrompt(ConversationContext context, Prompt old, String promptText) {
|
public OverridePrompt(ConversationContext context, Prompt old, String promptText) {
|
||||||
super(context, null);
|
super(context);
|
||||||
oldPrompt = old;
|
oldPrompt = old;
|
||||||
classPrefix = old.getClass().getSimpleName();
|
classPrefix = old.getClass().getSimpleName();
|
||||||
this.promptText = promptText;
|
this.promptText = promptText;
|
||||||
@ -38,8 +38,7 @@ public class OverridePrompt extends QuestsEditorStringPrompt {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getPromptText(ConversationContext context) {
|
public String getPromptText(ConversationContext context) {
|
||||||
QuestsEditorPostOpenStringPromptEvent event
|
QuestsEditorPostOpenStringPromptEvent event = new QuestsEditorPostOpenStringPromptEvent(context, this);
|
||||||
= new QuestsEditorPostOpenStringPromptEvent(context, null, this);
|
|
||||||
context.getPlugin().getServer().getPluginManager().callEvent(event);
|
context.getPlugin().getServer().getPluginManager().callEvent(event);
|
||||||
|
|
||||||
String text = ChatColor.YELLOW + promptText + "\n";;
|
String text = ChatColor.YELLOW + promptText + "\n";;
|
||||||
|
@ -18,7 +18,6 @@ import java.util.Calendar;
|
|||||||
import java.util.Locale;
|
import java.util.Locale;
|
||||||
import java.util.TimeZone;
|
import java.util.TimeZone;
|
||||||
|
|
||||||
import me.blackvein.quests.QuestFactory;
|
|
||||||
import me.blackvein.quests.Quests;
|
import me.blackvein.quests.Quests;
|
||||||
import me.blackvein.quests.convo.quests.QuestsEditorNumericPrompt;
|
import me.blackvein.quests.convo.quests.QuestsEditorNumericPrompt;
|
||||||
import me.blackvein.quests.events.editor.quests.QuestsEditorPostOpenNumericPromptEvent;
|
import me.blackvein.quests.events.editor.quests.QuestsEditorPostOpenNumericPromptEvent;
|
||||||
@ -34,12 +33,10 @@ import org.bukkit.conversations.StringPrompt;
|
|||||||
public class PlannerPrompt extends QuestsEditorNumericPrompt {
|
public class PlannerPrompt extends QuestsEditorNumericPrompt {
|
||||||
|
|
||||||
private final Quests plugin;
|
private final Quests plugin;
|
||||||
private final QuestFactory factory;
|
|
||||||
|
|
||||||
public PlannerPrompt(Quests plugin, ConversationContext context, QuestFactory qf) {
|
public PlannerPrompt(Quests plugin, ConversationContext context) {
|
||||||
super(context, qf);
|
super(context);
|
||||||
this.plugin = plugin;
|
this.plugin = plugin;
|
||||||
factory = qf;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private final int size = 5;
|
private final int size = 5;
|
||||||
@ -138,7 +135,7 @@ public class PlannerPrompt extends QuestsEditorNumericPrompt {
|
|||||||
@Override
|
@Override
|
||||||
public String getPromptText(ConversationContext context) {
|
public String getPromptText(ConversationContext context) {
|
||||||
QuestsEditorPostOpenNumericPromptEvent event
|
QuestsEditorPostOpenNumericPromptEvent event
|
||||||
= new QuestsEditorPostOpenNumericPromptEvent(context, factory, this);
|
= new QuestsEditorPostOpenNumericPromptEvent(context, this);
|
||||||
plugin.getServer().getPluginManager().callEvent(event);
|
plugin.getServer().getPluginManager().callEvent(event);
|
||||||
|
|
||||||
String text = ChatColor.DARK_AQUA + getTitle(context).replace((String) context
|
String text = ChatColor.DARK_AQUA + getTitle(context).replace((String) context
|
||||||
@ -155,20 +152,20 @@ public class PlannerPrompt extends QuestsEditorNumericPrompt {
|
|||||||
protected Prompt acceptValidatedInput(ConversationContext context, Number input) {
|
protected Prompt acceptValidatedInput(ConversationContext context, Number input) {
|
||||||
switch (input.intValue()) {
|
switch (input.intValue()) {
|
||||||
case 1:
|
case 1:
|
||||||
return new DateTimePrompt(plugin, PlannerPrompt.this, "start");
|
return new DateTimePrompt(PlannerPrompt.this, "start");
|
||||||
case 2:
|
case 2:
|
||||||
return new DateTimePrompt(plugin, PlannerPrompt.this, "end");
|
return new DateTimePrompt(PlannerPrompt.this, "end");
|
||||||
case 3:
|
case 3:
|
||||||
if (context.getSessionData(CK.PLN_START_DATE) != null && context.getSessionData(CK.PLN_END_DATE) != null) {
|
if (context.getSessionData(CK.PLN_START_DATE) != null && context.getSessionData(CK.PLN_END_DATE) != null) {
|
||||||
return new RepeatPrompt();
|
return new RepeatPrompt();
|
||||||
} else {
|
} else {
|
||||||
context.getForWhom().sendRawMessage(ChatColor.RED + Lang.get("invalidOption"));
|
context.getForWhom().sendRawMessage(ChatColor.RED + Lang.get("invalidOption"));
|
||||||
return new PlannerPrompt(plugin, context, factory);
|
return new PlannerPrompt(plugin, context);
|
||||||
}
|
}
|
||||||
case 4:
|
case 4:
|
||||||
return new CooldownPrompt();
|
return new CooldownPrompt();
|
||||||
case 5:
|
case 5:
|
||||||
return factory.returnToMenu(context);
|
return plugin.getQuestFactory().returnToMenu(context);
|
||||||
default:
|
default:
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
@ -184,11 +181,11 @@ public class PlannerPrompt extends QuestsEditorNumericPrompt {
|
|||||||
@Override
|
@Override
|
||||||
public Prompt acceptInput(ConversationContext context, String input) {
|
public Prompt acceptInput(ConversationContext context, String input) {
|
||||||
if (input.equalsIgnoreCase(Lang.get("cmdCancel"))) {
|
if (input.equalsIgnoreCase(Lang.get("cmdCancel"))) {
|
||||||
return new PlannerPrompt(plugin, context, factory);
|
return new PlannerPrompt(plugin, context);
|
||||||
}
|
}
|
||||||
if (input.equalsIgnoreCase(Lang.get("cmdClear"))) {
|
if (input.equalsIgnoreCase(Lang.get("cmdClear"))) {
|
||||||
context.setSessionData(CK.PLN_REPEAT_CYCLE, null);
|
context.setSessionData(CK.PLN_REPEAT_CYCLE, null);
|
||||||
return new PlannerPrompt(plugin, context, factory);
|
return new PlannerPrompt(plugin, context);
|
||||||
}
|
}
|
||||||
long delay;
|
long delay;
|
||||||
try {
|
try {
|
||||||
@ -204,7 +201,7 @@ public class PlannerPrompt extends QuestsEditorNumericPrompt {
|
|||||||
.replace("<input>", input));
|
.replace("<input>", input));
|
||||||
return new RepeatPrompt();
|
return new RepeatPrompt();
|
||||||
}
|
}
|
||||||
return new PlannerPrompt(plugin, context, factory);
|
return new PlannerPrompt(plugin, context);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -218,11 +215,11 @@ public class PlannerPrompt extends QuestsEditorNumericPrompt {
|
|||||||
@Override
|
@Override
|
||||||
public Prompt acceptInput(ConversationContext context, String input) {
|
public Prompt acceptInput(ConversationContext context, String input) {
|
||||||
if (input.equalsIgnoreCase(Lang.get("cmdCancel"))) {
|
if (input.equalsIgnoreCase(Lang.get("cmdCancel"))) {
|
||||||
return new PlannerPrompt(plugin, context, factory);
|
return new PlannerPrompt(plugin, context);
|
||||||
}
|
}
|
||||||
if (input.equalsIgnoreCase(Lang.get("cmdClear"))) {
|
if (input.equalsIgnoreCase(Lang.get("cmdClear"))) {
|
||||||
context.setSessionData(CK.PLN_COOLDOWN, null);
|
context.setSessionData(CK.PLN_COOLDOWN, null);
|
||||||
return new PlannerPrompt(plugin, context, factory);
|
return new PlannerPrompt(plugin, context);
|
||||||
}
|
}
|
||||||
long delay;
|
long delay;
|
||||||
try {
|
try {
|
||||||
@ -238,7 +235,7 @@ public class PlannerPrompt extends QuestsEditorNumericPrompt {
|
|||||||
.replace("<input>", input));
|
.replace("<input>", input));
|
||||||
return new CooldownPrompt();
|
return new CooldownPrompt();
|
||||||
}
|
}
|
||||||
return new PlannerPrompt(plugin, context, factory);
|
return new PlannerPrompt(plugin, context);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -260,7 +257,7 @@ public class PlannerPrompt extends QuestsEditorNumericPrompt {
|
|||||||
|
|
||||||
TimeZone tz = TimeZone.getTimeZone(date[6]);
|
TimeZone tz = TimeZone.getTimeZone(date[6]);
|
||||||
cal.setTimeZone(tz);
|
cal.setTimeZone(tz);
|
||||||
String[] iso = plugin.getLang().getISO().split("-");
|
String[] iso = Lang.getISO().split("-");
|
||||||
Locale loc = new Locale(iso[0], iso[1]);
|
Locale loc = new Locale(iso[0], iso[1]);
|
||||||
Double zhour = (double) (cal.getTimeZone().getRawOffset() / 60 / 60 / 1000);
|
Double zhour = (double) (cal.getTimeZone().getRawOffset() / 60 / 60 / 1000);
|
||||||
String[] sep = String.valueOf(zhour).replace("-", "").split("\\.");
|
String[] sep = String.valueOf(zhour).replace("-", "").split("\\.");
|
||||||
|
@ -31,7 +31,6 @@ import com.herocraftonline.heroes.characters.classes.HeroClass;
|
|||||||
|
|
||||||
import me.blackvein.quests.CustomRequirement;
|
import me.blackvein.quests.CustomRequirement;
|
||||||
import me.blackvein.quests.Quest;
|
import me.blackvein.quests.Quest;
|
||||||
import me.blackvein.quests.QuestFactory;
|
|
||||||
import me.blackvein.quests.Quests;
|
import me.blackvein.quests.Quests;
|
||||||
import me.blackvein.quests.convo.quests.QuestsEditorNumericPrompt;
|
import me.blackvein.quests.convo.quests.QuestsEditorNumericPrompt;
|
||||||
import me.blackvein.quests.events.editor.quests.QuestsEditorPostOpenNumericPromptEvent;
|
import me.blackvein.quests.events.editor.quests.QuestsEditorPostOpenNumericPromptEvent;
|
||||||
@ -44,15 +43,13 @@ public class RequirementsPrompt extends QuestsEditorNumericPrompt {
|
|||||||
|
|
||||||
private final Quests plugin;
|
private final Quests plugin;
|
||||||
private final String classPrefix;
|
private final String classPrefix;
|
||||||
private final QuestFactory factory;
|
|
||||||
private boolean hasRequirement = false;
|
private boolean hasRequirement = false;
|
||||||
private final int size = 11;
|
private final int size = 11;
|
||||||
|
|
||||||
public RequirementsPrompt(Quests plugin, ConversationContext context, QuestFactory qf) {
|
public RequirementsPrompt(Quests plugin, ConversationContext context) {
|
||||||
super(context, qf);
|
super(context);
|
||||||
this.plugin = plugin;
|
this.plugin = plugin;
|
||||||
this.classPrefix = getClass().getSimpleName();
|
this.classPrefix = getClass().getSimpleName();
|
||||||
this.factory = qf;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getSize() {
|
public int getSize() {
|
||||||
@ -294,7 +291,7 @@ public class RequirementsPrompt extends QuestsEditorNumericPrompt {
|
|||||||
checkRequirement(context);
|
checkRequirement(context);
|
||||||
|
|
||||||
QuestsEditorPostOpenNumericPromptEvent event
|
QuestsEditorPostOpenNumericPromptEvent event
|
||||||
= new QuestsEditorPostOpenNumericPromptEvent(context, factory, this);
|
= new QuestsEditorPostOpenNumericPromptEvent(context, this);
|
||||||
plugin.getServer().getPluginManager().callEvent(event);
|
plugin.getServer().getPluginManager().callEvent(event);
|
||||||
|
|
||||||
String text = ChatColor.DARK_AQUA + getTitle(context).replace((String) context
|
String text = ChatColor.DARK_AQUA + getTitle(context).replace((String) context
|
||||||
@ -315,7 +312,7 @@ public class RequirementsPrompt extends QuestsEditorNumericPrompt {
|
|||||||
case 2:
|
case 2:
|
||||||
return new QuestPointsPrompt();
|
return new QuestPointsPrompt();
|
||||||
case 3:
|
case 3:
|
||||||
return new ItemListPrompt(plugin, context, factory);
|
return new ItemListPrompt(plugin, context);
|
||||||
case 4:
|
case 4:
|
||||||
return new PermissionsPrompt();
|
return new PermissionsPrompt();
|
||||||
case 5:
|
case 5:
|
||||||
@ -326,28 +323,29 @@ public class RequirementsPrompt extends QuestsEditorNumericPrompt {
|
|||||||
if (plugin.getDependencies().getMcmmoClassic() != null) {
|
if (plugin.getDependencies().getMcmmoClassic() != null) {
|
||||||
return new mcMMOPrompt();
|
return new mcMMOPrompt();
|
||||||
} else {
|
} else {
|
||||||
return new RequirementsPrompt(plugin, context, factory);
|
return new RequirementsPrompt(plugin, context);
|
||||||
}
|
}
|
||||||
case 8:
|
case 8:
|
||||||
if (plugin.getDependencies().getHeroes() != null) {
|
if (plugin.getDependencies().getHeroes() != null) {
|
||||||
return new HeroesPrompt();
|
return new HeroesPrompt();
|
||||||
} else {
|
} else {
|
||||||
return new RequirementsPrompt(plugin, context, factory);
|
return new RequirementsPrompt(plugin, context);
|
||||||
}
|
}
|
||||||
case 9:
|
case 9:
|
||||||
return new CustomRequirementsPrompt();
|
return new CustomRequirementsPrompt();
|
||||||
case 10:
|
case 10:
|
||||||
if (hasRequirement) {
|
if (hasRequirement) {
|
||||||
return new OverridePrompt.Builder()
|
return new OverridePrompt.Builder()
|
||||||
|
.context(context)
|
||||||
.source(this)
|
.source(this)
|
||||||
.promptText(Lang.get("overrideCreateEnter"))
|
.promptText(Lang.get("overrideCreateEnter"))
|
||||||
.build();
|
.build();
|
||||||
} else {
|
} else {
|
||||||
context.getForWhom().sendRawMessage(ChatColor.RED + Lang.get("invalidOption"));
|
context.getForWhom().sendRawMessage(ChatColor.RED + Lang.get("invalidOption"));
|
||||||
return new RequirementsPrompt(plugin, context, factory);
|
return new RequirementsPrompt(plugin, context);
|
||||||
}
|
}
|
||||||
case 11:
|
case 11:
|
||||||
return factory.returnToMenu(context);
|
return plugin.getQuestFactory().returnToMenu(context);
|
||||||
default:
|
default:
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
@ -404,9 +402,9 @@ public class RequirementsPrompt extends QuestsEditorNumericPrompt {
|
|||||||
}
|
}
|
||||||
} else if (input.equalsIgnoreCase(Lang.get("cmdClear"))) {
|
} else if (input.equalsIgnoreCase(Lang.get("cmdClear"))) {
|
||||||
context.setSessionData(CK.REQ_MONEY, null);
|
context.setSessionData(CK.REQ_MONEY, null);
|
||||||
return new RequirementsPrompt(plugin, context, factory);
|
return new RequirementsPrompt(plugin, context);
|
||||||
}
|
}
|
||||||
return new RequirementsPrompt(plugin, context, factory);
|
return new RequirementsPrompt(plugin, context);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -436,9 +434,9 @@ public class RequirementsPrompt extends QuestsEditorNumericPrompt {
|
|||||||
}
|
}
|
||||||
} else if (input.equalsIgnoreCase(Lang.get("cmdClear"))) {
|
} else if (input.equalsIgnoreCase(Lang.get("cmdClear"))) {
|
||||||
context.setSessionData(CK.REQ_QUEST_POINTS, null);
|
context.setSessionData(CK.REQ_QUEST_POINTS, null);
|
||||||
return new RequirementsPrompt(plugin, context, factory);
|
return new RequirementsPrompt(plugin, context);
|
||||||
}
|
}
|
||||||
return new RequirementsPrompt(plugin, context, factory);
|
return new RequirementsPrompt(plugin, context);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -506,13 +504,13 @@ public class RequirementsPrompt extends QuestsEditorNumericPrompt {
|
|||||||
context.setSessionData(CK.REQ_QUEST_BLOCK, null);
|
context.setSessionData(CK.REQ_QUEST_BLOCK, null);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return new RequirementsPrompt(plugin, context, factory);
|
return new RequirementsPrompt(plugin, context);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public class ItemListPrompt extends QuestsEditorNumericPrompt {
|
public class ItemListPrompt extends QuestsEditorNumericPrompt {
|
||||||
public ItemListPrompt(Quests plugin, ConversationContext context, QuestFactory factory) {
|
public ItemListPrompt(Quests plugin, ConversationContext context) {
|
||||||
super(context, factory);
|
super(context);
|
||||||
}
|
}
|
||||||
|
|
||||||
private final int size = 4;
|
private final int size = 4;
|
||||||
@ -615,7 +613,7 @@ public class RequirementsPrompt extends QuestsEditorNumericPrompt {
|
|||||||
}
|
}
|
||||||
|
|
||||||
QuestsEditorPostOpenNumericPromptEvent event
|
QuestsEditorPostOpenNumericPromptEvent event
|
||||||
= new QuestsEditorPostOpenNumericPromptEvent(context, factory, this);
|
= new QuestsEditorPostOpenNumericPromptEvent(context, this);
|
||||||
plugin.getServer().getPluginManager().callEvent(event);
|
plugin.getServer().getPluginManager().callEvent(event);
|
||||||
|
|
||||||
String text = ChatColor.GOLD + getTitle(context) + "\n";
|
String text = ChatColor.GOLD + getTitle(context) + "\n";
|
||||||
@ -635,7 +633,7 @@ public class RequirementsPrompt extends QuestsEditorNumericPrompt {
|
|||||||
case 2:
|
case 2:
|
||||||
if (context.getSessionData(CK.REQ_ITEMS) == null) {
|
if (context.getSessionData(CK.REQ_ITEMS) == null) {
|
||||||
context.getForWhom().sendRawMessage(ChatColor.RED + Lang.get("reqMustAddItem"));
|
context.getForWhom().sendRawMessage(ChatColor.RED + Lang.get("reqMustAddItem"));
|
||||||
return new ItemListPrompt(plugin, context, factory);
|
return new ItemListPrompt(plugin, context);
|
||||||
} else {
|
} else {
|
||||||
return new RemoveItemsPrompt();
|
return new RemoveItemsPrompt();
|
||||||
}
|
}
|
||||||
@ -643,7 +641,7 @@ public class RequirementsPrompt extends QuestsEditorNumericPrompt {
|
|||||||
context.getForWhom().sendRawMessage(ChatColor.YELLOW + Lang.get("reqItemCleared"));
|
context.getForWhom().sendRawMessage(ChatColor.YELLOW + Lang.get("reqItemCleared"));
|
||||||
context.setSessionData(CK.REQ_ITEMS, null);
|
context.setSessionData(CK.REQ_ITEMS, null);
|
||||||
context.setSessionData(CK.REQ_ITEMS_REMOVE, null);
|
context.setSessionData(CK.REQ_ITEMS_REMOVE, null);
|
||||||
return new ItemListPrompt(plugin, context, factory);
|
return new ItemListPrompt(plugin, context);
|
||||||
case 4:
|
case 4:
|
||||||
int one;
|
int one;
|
||||||
int two;
|
int two;
|
||||||
@ -658,10 +656,10 @@ public class RequirementsPrompt extends QuestsEditorNumericPrompt {
|
|||||||
two = 0;
|
two = 0;
|
||||||
}
|
}
|
||||||
if (one == two) {
|
if (one == two) {
|
||||||
return new RequirementsPrompt(plugin, context, factory);
|
return new RequirementsPrompt(plugin, context);
|
||||||
} else {
|
} else {
|
||||||
context.getForWhom().sendRawMessage(ChatColor.RED + Lang.get("listsNotSameSize"));
|
context.getForWhom().sendRawMessage(ChatColor.RED + Lang.get("listsNotSameSize"));
|
||||||
return new ItemListPrompt(plugin, context, factory);
|
return new ItemListPrompt(plugin, context);
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
return null;
|
return null;
|
||||||
@ -705,7 +703,7 @@ public class RequirementsPrompt extends QuestsEditorNumericPrompt {
|
|||||||
}
|
}
|
||||||
context.setSessionData(CK.REQ_ITEMS_REMOVE, booleans);
|
context.setSessionData(CK.REQ_ITEMS_REMOVE, booleans);
|
||||||
}
|
}
|
||||||
return new ItemListPrompt(plugin, context, factory);
|
return new ItemListPrompt(plugin, context);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -727,7 +725,7 @@ public class RequirementsPrompt extends QuestsEditorNumericPrompt {
|
|||||||
} else if (input.equalsIgnoreCase(Lang.get("cmdClear"))) {
|
} else if (input.equalsIgnoreCase(Lang.get("cmdClear"))) {
|
||||||
context.setSessionData(CK.REQ_PERMISSION, null);
|
context.setSessionData(CK.REQ_PERMISSION, null);
|
||||||
}
|
}
|
||||||
return new RequirementsPrompt(plugin, context, factory);
|
return new RequirementsPrompt(plugin, context);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -809,7 +807,7 @@ public class RequirementsPrompt extends QuestsEditorNumericPrompt {
|
|||||||
context.setSessionData(CK.REQ_CUSTOM_DATA_TEMP, null);
|
context.setSessionData(CK.REQ_CUSTOM_DATA_TEMP, null);
|
||||||
context.getForWhom().sendRawMessage(ChatColor.YELLOW + Lang.get("reqCustomCleared"));
|
context.getForWhom().sendRawMessage(ChatColor.YELLOW + Lang.get("reqCustomCleared"));
|
||||||
}
|
}
|
||||||
return new RequirementsPrompt(plugin, context, factory);
|
return new RequirementsPrompt(plugin, context);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -874,7 +872,7 @@ public class RequirementsPrompt extends QuestsEditorNumericPrompt {
|
|||||||
return new RequirementCustomDataListPrompt();
|
return new RequirementCustomDataListPrompt();
|
||||||
} else {
|
} else {
|
||||||
context.setSessionData(CK.REQ_CUSTOM_DATA_DESCRIPTIONS, null);
|
context.setSessionData(CK.REQ_CUSTOM_DATA_DESCRIPTIONS, null);
|
||||||
return new RequirementsPrompt(plugin, context, factory);
|
return new RequirementsPrompt(plugin, context);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -955,7 +953,7 @@ public class RequirementsPrompt extends QuestsEditorNumericPrompt {
|
|||||||
} else if (input.equalsIgnoreCase("2")) {
|
} else if (input.equalsIgnoreCase("2")) {
|
||||||
return new mcMMOAmountsPrompt();
|
return new mcMMOAmountsPrompt();
|
||||||
} else if (input.equalsIgnoreCase("3")) {
|
} else if (input.equalsIgnoreCase("3")) {
|
||||||
return new RequirementsPrompt(plugin, context, factory);
|
return new RequirementsPrompt(plugin, context);
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
@ -1082,7 +1080,7 @@ public class RequirementsPrompt extends QuestsEditorNumericPrompt {
|
|||||||
} else if (input.equalsIgnoreCase("2")) {
|
} else if (input.equalsIgnoreCase("2")) {
|
||||||
return new HeroesSecondaryPrompt();
|
return new HeroesSecondaryPrompt();
|
||||||
} else if (input.equalsIgnoreCase("3")) {
|
} else if (input.equalsIgnoreCase("3")) {
|
||||||
return new RequirementsPrompt(plugin, context, factory);
|
return new RequirementsPrompt(plugin, context);
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
@ -31,7 +31,6 @@ import com.gmail.nossr50.datatypes.skills.SkillType;
|
|||||||
import com.herocraftonline.heroes.characters.classes.HeroClass;
|
import com.herocraftonline.heroes.characters.classes.HeroClass;
|
||||||
|
|
||||||
import me.blackvein.quests.CustomReward;
|
import me.blackvein.quests.CustomReward;
|
||||||
import me.blackvein.quests.QuestFactory;
|
|
||||||
import me.blackvein.quests.Quests;
|
import me.blackvein.quests.Quests;
|
||||||
import me.blackvein.quests.convo.quests.QuestsEditorNumericPrompt;
|
import me.blackvein.quests.convo.quests.QuestsEditorNumericPrompt;
|
||||||
import me.blackvein.quests.events.editor.quests.QuestsEditorPostOpenNumericPromptEvent;
|
import me.blackvein.quests.events.editor.quests.QuestsEditorPostOpenNumericPromptEvent;
|
||||||
@ -44,15 +43,13 @@ public class RewardsPrompt extends QuestsEditorNumericPrompt {
|
|||||||
|
|
||||||
private final Quests plugin;
|
private final Quests plugin;
|
||||||
private final String classPrefix;
|
private final String classPrefix;
|
||||||
private final QuestFactory factory;
|
|
||||||
private boolean hasReward = false;
|
private boolean hasReward = false;
|
||||||
private final int size = 12;
|
private final int size = 12;
|
||||||
|
|
||||||
public RewardsPrompt(Quests plugin, ConversationContext context, QuestFactory qf) {
|
public RewardsPrompt(Quests plugin, ConversationContext context) {
|
||||||
super(context, qf);
|
super(context);
|
||||||
this.plugin = plugin;
|
this.plugin = plugin;
|
||||||
this.classPrefix = getClass().getSimpleName();
|
this.classPrefix = getClass().getSimpleName();
|
||||||
factory = qf;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getSize() {
|
public int getSize() {
|
||||||
@ -335,7 +332,7 @@ public class RewardsPrompt extends QuestsEditorNumericPrompt {
|
|||||||
checkReward(context);
|
checkReward(context);
|
||||||
|
|
||||||
QuestsEditorPostOpenNumericPromptEvent event
|
QuestsEditorPostOpenNumericPromptEvent event
|
||||||
= new QuestsEditorPostOpenNumericPromptEvent(context, factory, this);
|
= new QuestsEditorPostOpenNumericPromptEvent(context, this);
|
||||||
plugin.getServer().getPluginManager().callEvent(event);
|
plugin.getServer().getPluginManager().callEvent(event);
|
||||||
|
|
||||||
String text = ChatColor.LIGHT_PURPLE + getTitle(context).replace((String) context
|
String text = ChatColor.LIGHT_PURPLE + getTitle(context).replace((String) context
|
||||||
@ -355,7 +352,7 @@ public class RewardsPrompt extends QuestsEditorNumericPrompt {
|
|||||||
if (plugin.getDependencies().getVaultEconomy() != null) {
|
if (plugin.getDependencies().getVaultEconomy() != null) {
|
||||||
return new MoneyPrompt();
|
return new MoneyPrompt();
|
||||||
} else {
|
} else {
|
||||||
return new RewardsPrompt(plugin, context, factory);
|
return new RewardsPrompt(plugin, context);
|
||||||
}
|
}
|
||||||
case 2:
|
case 2:
|
||||||
return new QuestPointsPrompt();
|
return new QuestPointsPrompt();
|
||||||
@ -366,24 +363,24 @@ public class RewardsPrompt extends QuestsEditorNumericPrompt {
|
|||||||
case 5:
|
case 5:
|
||||||
return new CommandsPrompt();
|
return new CommandsPrompt();
|
||||||
case 6:
|
case 6:
|
||||||
return new PermissionsListPrompt(context, factory);
|
return new PermissionsListPrompt(context);
|
||||||
case 7:
|
case 7:
|
||||||
if (plugin.getDependencies().getMcmmoClassic() != null) {
|
if (plugin.getDependencies().getMcmmoClassic() != null) {
|
||||||
return new mcMMOListPrompt();
|
return new mcMMOListPrompt();
|
||||||
} else {
|
} else {
|
||||||
return new RewardsPrompt(plugin, context, factory);
|
return new RewardsPrompt(plugin, context);
|
||||||
}
|
}
|
||||||
case 8:
|
case 8:
|
||||||
if (plugin.getDependencies().getHeroes() != null) {
|
if (plugin.getDependencies().getHeroes() != null) {
|
||||||
return new HeroesListPrompt();
|
return new HeroesListPrompt();
|
||||||
} else {
|
} else {
|
||||||
return new RewardsPrompt(plugin, context, factory);
|
return new RewardsPrompt(plugin, context);
|
||||||
}
|
}
|
||||||
case 9:
|
case 9:
|
||||||
if (plugin.getDependencies().getPhatLoots() != null) {
|
if (plugin.getDependencies().getPhatLoots() != null) {
|
||||||
return new PhatLootsPrompt();
|
return new PhatLootsPrompt();
|
||||||
} else {
|
} else {
|
||||||
return new RewardsPrompt(plugin, context, factory);
|
return new RewardsPrompt(plugin, context);
|
||||||
}
|
}
|
||||||
case 10:
|
case 10:
|
||||||
return new CustomRewardsPrompt();
|
return new CustomRewardsPrompt();
|
||||||
@ -395,10 +392,10 @@ public class RewardsPrompt extends QuestsEditorNumericPrompt {
|
|||||||
.build();
|
.build();
|
||||||
} else {
|
} else {
|
||||||
context.getForWhom().sendRawMessage(ChatColor.RED + Lang.get("invalidOption"));
|
context.getForWhom().sendRawMessage(ChatColor.RED + Lang.get("invalidOption"));
|
||||||
return new RewardsPrompt(plugin, context, factory);
|
return new RewardsPrompt(plugin, context);
|
||||||
}
|
}
|
||||||
case 12:
|
case 12:
|
||||||
return factory.returnToMenu(context);
|
return plugin.getQuestFactory().returnToMenu(context);
|
||||||
default:
|
default:
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
@ -455,9 +452,9 @@ public class RewardsPrompt extends QuestsEditorNumericPrompt {
|
|||||||
}
|
}
|
||||||
} else if (input.equalsIgnoreCase(Lang.get("cmdClear"))) {
|
} else if (input.equalsIgnoreCase(Lang.get("cmdClear"))) {
|
||||||
context.setSessionData(CK.REW_MONEY, null);
|
context.setSessionData(CK.REW_MONEY, null);
|
||||||
return new RewardsPrompt(plugin, context, factory);
|
return new RewardsPrompt(plugin, context);
|
||||||
}
|
}
|
||||||
return new RewardsPrompt(plugin, context, factory);
|
return new RewardsPrompt(plugin, context);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -487,9 +484,9 @@ public class RewardsPrompt extends QuestsEditorNumericPrompt {
|
|||||||
}
|
}
|
||||||
} else if (input.equalsIgnoreCase(Lang.get("cmdClear"))) {
|
} else if (input.equalsIgnoreCase(Lang.get("cmdClear"))) {
|
||||||
context.setSessionData(CK.REW_EXP, null);
|
context.setSessionData(CK.REW_EXP, null);
|
||||||
return new RewardsPrompt(plugin, context, factory);
|
return new RewardsPrompt(plugin, context);
|
||||||
}
|
}
|
||||||
return new RewardsPrompt(plugin, context, factory);
|
return new RewardsPrompt(plugin, context);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -519,9 +516,9 @@ public class RewardsPrompt extends QuestsEditorNumericPrompt {
|
|||||||
}
|
}
|
||||||
} else if (input.equalsIgnoreCase(Lang.get("cmdClear"))) {
|
} else if (input.equalsIgnoreCase(Lang.get("cmdClear"))) {
|
||||||
context.setSessionData(CK.REW_QUEST_POINTS, null);
|
context.setSessionData(CK.REW_QUEST_POINTS, null);
|
||||||
return new RewardsPrompt(plugin, context, factory);
|
return new RewardsPrompt(plugin, context);
|
||||||
}
|
}
|
||||||
return new RewardsPrompt(plugin, context, factory);
|
return new RewardsPrompt(plugin, context);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -579,7 +576,7 @@ public class RewardsPrompt extends QuestsEditorNumericPrompt {
|
|||||||
context.setSessionData(CK.REW_ITEMS, null);
|
context.setSessionData(CK.REW_ITEMS, null);
|
||||||
return new ItemListPrompt();
|
return new ItemListPrompt();
|
||||||
} else if (input.equalsIgnoreCase("3")) {
|
} else if (input.equalsIgnoreCase("3")) {
|
||||||
return new RewardsPrompt(plugin, context, factory);
|
return new RewardsPrompt(plugin, context);
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
@ -617,14 +614,14 @@ public class RewardsPrompt extends QuestsEditorNumericPrompt {
|
|||||||
} else if (input.equalsIgnoreCase(Lang.get("cmdClear"))) {
|
} else if (input.equalsIgnoreCase(Lang.get("cmdClear"))) {
|
||||||
context.setSessionData(CK.REW_COMMAND, null);
|
context.setSessionData(CK.REW_COMMAND, null);
|
||||||
}
|
}
|
||||||
return new RewardsPrompt(plugin, context, factory);
|
return new RewardsPrompt(plugin, context);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private class PermissionsListPrompt extends QuestsEditorNumericPrompt {
|
private class PermissionsListPrompt extends QuestsEditorNumericPrompt {
|
||||||
|
|
||||||
public PermissionsListPrompt(ConversationContext context, QuestFactory factory) {
|
public PermissionsListPrompt(ConversationContext context) {
|
||||||
super(context, factory);
|
super(context);
|
||||||
}
|
}
|
||||||
|
|
||||||
private final int size = 4;
|
private final int size = 4;
|
||||||
@ -718,7 +715,7 @@ public class RewardsPrompt extends QuestsEditorNumericPrompt {
|
|||||||
@Override
|
@Override
|
||||||
public String getPromptText(ConversationContext context) {
|
public String getPromptText(ConversationContext context) {
|
||||||
QuestsEditorPostOpenNumericPromptEvent event
|
QuestsEditorPostOpenNumericPromptEvent event
|
||||||
= new QuestsEditorPostOpenNumericPromptEvent(context, factory, this);
|
= new QuestsEditorPostOpenNumericPromptEvent(context, this);
|
||||||
plugin.getServer().getPluginManager().callEvent(event);
|
plugin.getServer().getPluginManager().callEvent(event);
|
||||||
|
|
||||||
String text = ChatColor.GOLD + getTitle(context) + "\n";
|
String text = ChatColor.GOLD + getTitle(context) + "\n";
|
||||||
@ -740,9 +737,9 @@ public class RewardsPrompt extends QuestsEditorNumericPrompt {
|
|||||||
context.getForWhom().sendRawMessage(ChatColor.YELLOW + Lang.get("rewPermissionsCleared"));
|
context.getForWhom().sendRawMessage(ChatColor.YELLOW + Lang.get("rewPermissionsCleared"));
|
||||||
context.setSessionData(CK.REW_PERMISSION, null);
|
context.setSessionData(CK.REW_PERMISSION, null);
|
||||||
context.setSessionData(CK.REW_PERMISSION_WORLDS, null);
|
context.setSessionData(CK.REW_PERMISSION_WORLDS, null);
|
||||||
return new PermissionsListPrompt(context, factory);
|
return new PermissionsListPrompt(context);
|
||||||
case 4:
|
case 4:
|
||||||
return new RewardsPrompt(plugin, context, factory);
|
return new RewardsPrompt(plugin, context);
|
||||||
default:
|
default:
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
@ -768,7 +765,7 @@ public class RewardsPrompt extends QuestsEditorNumericPrompt {
|
|||||||
} else if (input.equalsIgnoreCase(Lang.get("cmdClear"))) {
|
} else if (input.equalsIgnoreCase(Lang.get("cmdClear"))) {
|
||||||
context.setSessionData(CK.REW_PERMISSION, null);
|
context.setSessionData(CK.REW_PERMISSION, null);
|
||||||
}
|
}
|
||||||
return new PermissionsListPrompt(context, factory);
|
return new PermissionsListPrompt(context);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -797,7 +794,7 @@ public class RewardsPrompt extends QuestsEditorNumericPrompt {
|
|||||||
} else if (input.equalsIgnoreCase(Lang.get("cmdClear"))) {
|
} else if (input.equalsIgnoreCase(Lang.get("cmdClear"))) {
|
||||||
context.setSessionData(CK.REW_PERMISSION_WORLDS, null);
|
context.setSessionData(CK.REW_PERMISSION_WORLDS, null);
|
||||||
}
|
}
|
||||||
return new PermissionsListPrompt(context, factory);
|
return new PermissionsListPrompt(context);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -874,7 +871,7 @@ public class RewardsPrompt extends QuestsEditorNumericPrompt {
|
|||||||
two = 0;
|
two = 0;
|
||||||
}
|
}
|
||||||
if (one == two) {
|
if (one == two) {
|
||||||
return new RewardsPrompt(plugin, context, factory);
|
return new RewardsPrompt(plugin, context);
|
||||||
} else {
|
} else {
|
||||||
context.getForWhom().sendRawMessage(ChatColor.RED + Lang.get("rewMcMMOListsNotSameSize"));
|
context.getForWhom().sendRawMessage(ChatColor.RED + Lang.get("rewMcMMOListsNotSameSize"));
|
||||||
return new mcMMOListPrompt();
|
return new mcMMOListPrompt();
|
||||||
@ -1037,7 +1034,7 @@ public class RewardsPrompt extends QuestsEditorNumericPrompt {
|
|||||||
two = 0;
|
two = 0;
|
||||||
}
|
}
|
||||||
if (one == two) {
|
if (one == two) {
|
||||||
return new RewardsPrompt(plugin, context, factory);
|
return new RewardsPrompt(plugin, context);
|
||||||
} else {
|
} else {
|
||||||
context.getForWhom().sendRawMessage(ChatColor.RED + Lang.get("rewHeroesListsNotSameSize"));
|
context.getForWhom().sendRawMessage(ChatColor.RED + Lang.get("rewHeroesListsNotSameSize"));
|
||||||
return new HeroesListPrompt();
|
return new HeroesListPrompt();
|
||||||
@ -1164,13 +1161,13 @@ public class RewardsPrompt extends QuestsEditorNumericPrompt {
|
|||||||
}
|
}
|
||||||
loots.addAll(Arrays.asList(arr));
|
loots.addAll(Arrays.asList(arr));
|
||||||
context.setSessionData(CK.REW_PHAT_LOOTS, loots);
|
context.setSessionData(CK.REW_PHAT_LOOTS, loots);
|
||||||
return new RewardsPrompt(plugin, context, factory);
|
return new RewardsPrompt(plugin, context);
|
||||||
} else if (input.equalsIgnoreCase(Lang.get("cmdClear"))) {
|
} else if (input.equalsIgnoreCase(Lang.get("cmdClear"))) {
|
||||||
context.setSessionData(CK.REW_PHAT_LOOTS, null);
|
context.setSessionData(CK.REW_PHAT_LOOTS, null);
|
||||||
context.getForWhom().sendRawMessage(ChatColor.YELLOW + Lang.get("rewPhatLootsCleared"));
|
context.getForWhom().sendRawMessage(ChatColor.YELLOW + Lang.get("rewPhatLootsCleared"));
|
||||||
return new RewardsPrompt(plugin, context, factory);
|
return new RewardsPrompt(plugin, context);
|
||||||
} else {
|
} else {
|
||||||
return new RewardsPrompt(plugin, context, factory);
|
return new RewardsPrompt(plugin, context);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1253,7 +1250,7 @@ public class RewardsPrompt extends QuestsEditorNumericPrompt {
|
|||||||
context.setSessionData(CK.REW_CUSTOM_DATA_TEMP, null);
|
context.setSessionData(CK.REW_CUSTOM_DATA_TEMP, null);
|
||||||
context.getForWhom().sendRawMessage(ChatColor.YELLOW + Lang.get("rewCustomCleared"));
|
context.getForWhom().sendRawMessage(ChatColor.YELLOW + Lang.get("rewCustomCleared"));
|
||||||
}
|
}
|
||||||
return new RewardsPrompt(plugin, context, factory);
|
return new RewardsPrompt(plugin, context);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1318,7 +1315,7 @@ public class RewardsPrompt extends QuestsEditorNumericPrompt {
|
|||||||
return new RewardCustomDataListPrompt();
|
return new RewardCustomDataListPrompt();
|
||||||
} else {
|
} else {
|
||||||
context.setSessionData(CK.REW_CUSTOM_DATA_DESCRIPTIONS, null);
|
context.setSessionData(CK.REW_CUSTOM_DATA_DESCRIPTIONS, null);
|
||||||
return new RewardsPrompt(plugin, context, factory);
|
return new RewardsPrompt(plugin, context);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -30,7 +30,6 @@ import org.bukkit.conversations.StringPrompt;
|
|||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
import me.blackvein.quests.CustomObjective;
|
import me.blackvein.quests.CustomObjective;
|
||||||
import me.blackvein.quests.QuestFactory;
|
|
||||||
import me.blackvein.quests.Quests;
|
import me.blackvein.quests.Quests;
|
||||||
import me.blackvein.quests.actions.Action;
|
import me.blackvein.quests.actions.Action;
|
||||||
import me.blackvein.quests.convo.quests.QuestsEditorNumericPrompt;
|
import me.blackvein.quests.convo.quests.QuestsEditorNumericPrompt;
|
||||||
@ -41,22 +40,19 @@ import me.blackvein.quests.util.Lang;
|
|||||||
import me.blackvein.quests.util.MiscUtil;
|
import me.blackvein.quests.util.MiscUtil;
|
||||||
|
|
||||||
public class StageMainPrompt extends QuestsEditorNumericPrompt {
|
public class StageMainPrompt extends QuestsEditorNumericPrompt {
|
||||||
|
|
||||||
private final Quests plugin;
|
private final Quests plugin;
|
||||||
private final int stageNum;
|
private final int stageNum;
|
||||||
private final String stagePrefix;
|
private final String stagePrefix;
|
||||||
private final String classPrefix;
|
private final String classPrefix;
|
||||||
private final QuestFactory factory;
|
|
||||||
private boolean hasObjective = false;
|
private boolean hasObjective = false;
|
||||||
private final int size = 16;
|
private final int size = 16;
|
||||||
|
|
||||||
public StageMainPrompt(Quests plugin, int stageNum, ConversationContext context, QuestFactory qf) {
|
public StageMainPrompt(Quests plugin, int stageNum, ConversationContext context) {
|
||||||
super(context, qf);
|
super(context);
|
||||||
this.plugin = plugin;
|
this.plugin = plugin;
|
||||||
this.stageNum = stageNum;
|
this.stageNum = stageNum;
|
||||||
this.stagePrefix = "stage" + stageNum;
|
this.stagePrefix = "stage" + stageNum;
|
||||||
this.classPrefix = getClass().getSimpleName();
|
this.classPrefix = getClass().getSimpleName();
|
||||||
this.factory = qf;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getStageNumber() {
|
public int getStageNumber() {
|
||||||
@ -389,8 +385,8 @@ public class StageMainPrompt extends QuestsEditorNumericPrompt {
|
|||||||
checkObjective(context);
|
checkObjective(context);
|
||||||
|
|
||||||
QuestsEditorPostOpenNumericPromptEvent event
|
QuestsEditorPostOpenNumericPromptEvent event
|
||||||
= new QuestsEditorPostOpenNumericPromptEvent(context, factory, this);
|
= new QuestsEditorPostOpenNumericPromptEvent(context, this);
|
||||||
plugin.getServer().getPluginManager().callEvent(event);
|
context.getPlugin().getServer().getPluginManager().callEvent(event);
|
||||||
|
|
||||||
String text = ChatColor.LIGHT_PURPLE + "- " + ChatColor.AQUA
|
String text = ChatColor.LIGHT_PURPLE + "- " + ChatColor.AQUA
|
||||||
+ getTitle(context).replaceFirst(" \\| ", ChatColor.LIGHT_PURPLE + " | ") + " -\n";
|
+ getTitle(context).replaceFirst(" \\| ", ChatColor.LIGHT_PURPLE + " | ") + " -\n";
|
||||||
@ -405,13 +401,13 @@ public class StageMainPrompt extends QuestsEditorNumericPrompt {
|
|||||||
protected Prompt acceptValidatedInput(ConversationContext context, Number input) {
|
protected Prompt acceptValidatedInput(ConversationContext context, Number input) {
|
||||||
switch (input.intValue()) {
|
switch (input.intValue()) {
|
||||||
case 1:
|
case 1:
|
||||||
return new BlocksPrompt(plugin, stageNum, context, factory);
|
return new BlocksPrompt(plugin, stageNum, context);
|
||||||
case 2:
|
case 2:
|
||||||
return new ItemsPrompt(plugin, stageNum, factory);
|
return new ItemsPrompt(plugin, stageNum);
|
||||||
case 3:
|
case 3:
|
||||||
return new NPCsPrompt(plugin, stageNum, factory);
|
return new NPCsPrompt(plugin, stageNum);
|
||||||
case 4:
|
case 4:
|
||||||
return new MobsPrompt(plugin, stageNum, factory);
|
return new MobsPrompt(plugin, stageNum);
|
||||||
case 5:
|
case 5:
|
||||||
return new KillPlayerPrompt();
|
return new KillPlayerPrompt();
|
||||||
case 6:
|
case 6:
|
||||||
@ -425,19 +421,19 @@ public class StageMainPrompt extends QuestsEditorNumericPrompt {
|
|||||||
return new EventListPrompt();
|
return new EventListPrompt();
|
||||||
} else {
|
} else {
|
||||||
context.getForWhom().sendRawMessage(ChatColor.RED + Lang.get("invalidOption"));
|
context.getForWhom().sendRawMessage(ChatColor.RED + Lang.get("invalidOption"));
|
||||||
return new StageMainPrompt(plugin, stageNum, context, factory);
|
return new StageMainPrompt(plugin, stageNum, context);
|
||||||
}
|
}
|
||||||
case 10:
|
case 10:
|
||||||
if (hasObjective) {
|
if (hasObjective) {
|
||||||
return new DelayPrompt();
|
return new DelayPrompt();
|
||||||
} else {
|
} else {
|
||||||
context.getForWhom().sendRawMessage(ChatColor.RED + Lang.get("invalidOption"));
|
context.getForWhom().sendRawMessage(ChatColor.RED + Lang.get("invalidOption"));
|
||||||
return new StageMainPrompt(plugin, stageNum, context, factory);
|
return new StageMainPrompt(plugin, stageNum, context);
|
||||||
}
|
}
|
||||||
case 11:
|
case 11:
|
||||||
if (context.getSessionData(stagePrefix + CK.S_DELAY) == null) {
|
if (context.getSessionData(stagePrefix + CK.S_DELAY) == null) {
|
||||||
context.getForWhom().sendRawMessage(ChatColor.RED + Lang.get("stageEditorNoDelaySet"));
|
context.getForWhom().sendRawMessage(ChatColor.RED + Lang.get("stageEditorNoDelaySet"));
|
||||||
return new StageMainPrompt(plugin, stageNum, context, factory);
|
return new StageMainPrompt(plugin, stageNum, context);
|
||||||
} else {
|
} else {
|
||||||
return new DelayMessagePrompt();
|
return new DelayMessagePrompt();
|
||||||
}
|
}
|
||||||
@ -446,14 +442,14 @@ public class StageMainPrompt extends QuestsEditorNumericPrompt {
|
|||||||
return new StartMessagePrompt();
|
return new StartMessagePrompt();
|
||||||
} else {
|
} else {
|
||||||
context.getForWhom().sendRawMessage(ChatColor.RED + Lang.get("invalidOption"));
|
context.getForWhom().sendRawMessage(ChatColor.RED + Lang.get("invalidOption"));
|
||||||
return new StageMainPrompt(plugin, stageNum, context, factory);
|
return new StageMainPrompt(plugin, stageNum, context);
|
||||||
}
|
}
|
||||||
case 13:
|
case 13:
|
||||||
if (hasObjective) {
|
if (hasObjective) {
|
||||||
return new CompleteMessagePrompt();
|
return new CompleteMessagePrompt();
|
||||||
} else {
|
} else {
|
||||||
context.getForWhom().sendRawMessage(ChatColor.RED + Lang.get("invalidOption"));
|
context.getForWhom().sendRawMessage(ChatColor.RED + Lang.get("invalidOption"));
|
||||||
return new StageMainPrompt(plugin, stageNum, context, factory);
|
return new StageMainPrompt(plugin, stageNum, context);
|
||||||
}
|
}
|
||||||
case 14:
|
case 14:
|
||||||
if (hasObjective) {
|
if (hasObjective) {
|
||||||
@ -463,14 +459,14 @@ public class StageMainPrompt extends QuestsEditorNumericPrompt {
|
|||||||
.build();
|
.build();
|
||||||
} else {
|
} else {
|
||||||
context.getForWhom().sendRawMessage(ChatColor.RED + Lang.get("invalidOption"));
|
context.getForWhom().sendRawMessage(ChatColor.RED + Lang.get("invalidOption"));
|
||||||
return new StageMainPrompt(plugin, stageNum, context, factory);
|
return new StageMainPrompt(plugin, stageNum, context);
|
||||||
}
|
}
|
||||||
case 15:
|
case 15:
|
||||||
return new DeletePrompt();
|
return new DeletePrompt();
|
||||||
case 16:
|
case 16:
|
||||||
return new StageMenuPrompt(plugin, context, factory);
|
return new StageMenuPrompt(plugin, context);
|
||||||
default:
|
default:
|
||||||
return new StageMainPrompt(plugin, stageNum, context, factory);
|
return new StageMainPrompt(plugin, stageNum, context);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -582,7 +578,7 @@ public class StageMainPrompt extends QuestsEditorNumericPrompt {
|
|||||||
two = 0;
|
two = 0;
|
||||||
}
|
}
|
||||||
if (one == two) {
|
if (one == two) {
|
||||||
return new StageMainPrompt(plugin, stageNum, context, factory);
|
return new StageMainPrompt(plugin, stageNum, context);
|
||||||
} else {
|
} else {
|
||||||
context.getForWhom().sendRawMessage(ChatColor.RED + Lang.get("listsNotSameSize"));
|
context.getForWhom().sendRawMessage(ChatColor.RED + Lang.get("listsNotSameSize"));
|
||||||
return new PasswordListPrompt();
|
return new PasswordListPrompt();
|
||||||
@ -684,7 +680,7 @@ public class StageMainPrompt extends QuestsEditorNumericPrompt {
|
|||||||
} else if (input.equalsIgnoreCase(Lang.get("cmdClear"))) {
|
} else if (input.equalsIgnoreCase(Lang.get("cmdClear"))) {
|
||||||
context.setSessionData(stagePrefix + CK.S_PLAYER_KILL, null);
|
context.setSessionData(stagePrefix + CK.S_PLAYER_KILL, null);
|
||||||
}
|
}
|
||||||
return new StageMainPrompt(plugin, stageNum, context, factory);
|
return new StageMainPrompt(plugin, stageNum, context);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -746,9 +742,9 @@ public class StageMainPrompt extends QuestsEditorNumericPrompt {
|
|||||||
@Override
|
@Override
|
||||||
protected Prompt acceptValidatedInput(ConversationContext context, String input) {
|
protected Prompt acceptValidatedInput(ConversationContext context, String input) {
|
||||||
if (input.equalsIgnoreCase("1")) {
|
if (input.equalsIgnoreCase("1")) {
|
||||||
Map<UUID, Block> temp = factory.getSelectedReachLocations();
|
Map<UUID, Block> temp = plugin.getQuestFactory().getSelectedReachLocations();
|
||||||
temp.put(((Player) context.getForWhom()).getUniqueId(), null);
|
temp.put(((Player) context.getForWhom()).getUniqueId(), null);
|
||||||
factory.setSelectedReachLocations(temp);
|
plugin.getQuestFactory().setSelectedReachLocations(temp);
|
||||||
return new ReachLocationPrompt();
|
return new ReachLocationPrompt();
|
||||||
} else if (input.equalsIgnoreCase("2")) {
|
} else if (input.equalsIgnoreCase("2")) {
|
||||||
if (context.getSessionData(stagePrefix + CK.S_REACH_LOCATIONS) == null) {
|
if (context.getSessionData(stagePrefix + CK.S_REACH_LOCATIONS) == null) {
|
||||||
@ -790,7 +786,7 @@ public class StageMainPrompt extends QuestsEditorNumericPrompt {
|
|||||||
three = 0;
|
three = 0;
|
||||||
}
|
}
|
||||||
if (one == two && two == three) {
|
if (one == two && two == three) {
|
||||||
return new StageMainPrompt(plugin, stageNum, context, factory);
|
return new StageMainPrompt(plugin, stageNum, context);
|
||||||
} else {
|
} else {
|
||||||
context.getForWhom().sendRawMessage(ChatColor.RED + Lang.get("listsNotSameSize"));
|
context.getForWhom().sendRawMessage(ChatColor.RED + Lang.get("listsNotSameSize"));
|
||||||
return new ReachListPrompt();
|
return new ReachListPrompt();
|
||||||
@ -828,7 +824,7 @@ public class StageMainPrompt extends QuestsEditorNumericPrompt {
|
|||||||
public Prompt acceptInput(ConversationContext context, String input) {
|
public Prompt acceptInput(ConversationContext context, String input) {
|
||||||
Player player = (Player) context.getForWhom();
|
Player player = (Player) context.getForWhom();
|
||||||
if (input.equalsIgnoreCase(Lang.get("cmdAdd"))) {
|
if (input.equalsIgnoreCase(Lang.get("cmdAdd"))) {
|
||||||
Block block = factory.getSelectedReachLocations().get(player.getUniqueId());
|
Block block = plugin.getQuestFactory().getSelectedReachLocations().get(player.getUniqueId());
|
||||||
if (block != null) {
|
if (block != null) {
|
||||||
Location loc = block.getLocation();
|
Location loc = block.getLocation();
|
||||||
LinkedList<String> locs;
|
LinkedList<String> locs;
|
||||||
@ -839,18 +835,18 @@ public class StageMainPrompt extends QuestsEditorNumericPrompt {
|
|||||||
}
|
}
|
||||||
locs.add(ConfigUtil.getLocationInfo(loc));
|
locs.add(ConfigUtil.getLocationInfo(loc));
|
||||||
context.setSessionData(stagePrefix + CK.S_REACH_LOCATIONS, locs);
|
context.setSessionData(stagePrefix + CK.S_REACH_LOCATIONS, locs);
|
||||||
Map<UUID, Block> temp = factory.getSelectedReachLocations();
|
Map<UUID, Block> temp = plugin.getQuestFactory().getSelectedReachLocations();
|
||||||
temp.remove(player.getUniqueId());
|
temp.remove(player.getUniqueId());
|
||||||
factory.setSelectedReachLocations(temp);
|
plugin.getQuestFactory().setSelectedReachLocations(temp);
|
||||||
} else {
|
} else {
|
||||||
player.sendMessage(ChatColor.RED + Lang.get("stageEditorNoBlockSelected"));
|
player.sendMessage(ChatColor.RED + Lang.get("stageEditorNoBlockSelected"));
|
||||||
return new ReachLocationPrompt();
|
return new ReachLocationPrompt();
|
||||||
}
|
}
|
||||||
return new ReachListPrompt();
|
return new ReachListPrompt();
|
||||||
} else if (input.equalsIgnoreCase(Lang.get("cmdCancel"))) {
|
} else if (input.equalsIgnoreCase(Lang.get("cmdCancel"))) {
|
||||||
Map<UUID, Block> temp = factory.getSelectedReachLocations();
|
Map<UUID, Block> temp = plugin.getQuestFactory().getSelectedReachLocations();
|
||||||
temp.remove(player.getUniqueId());
|
temp.remove(player.getUniqueId());
|
||||||
factory.setSelectedReachLocations(temp);
|
plugin.getQuestFactory().setSelectedReachLocations(temp);
|
||||||
return new ReachListPrompt();
|
return new ReachListPrompt();
|
||||||
} else {
|
} else {
|
||||||
return new ReachLocationPrompt();
|
return new ReachLocationPrompt();
|
||||||
@ -1001,7 +997,7 @@ public class StageMainPrompt extends QuestsEditorNumericPrompt {
|
|||||||
} else if (input.equalsIgnoreCase("6")) {
|
} else if (input.equalsIgnoreCase("6")) {
|
||||||
return new CommandEventPrompt();
|
return new CommandEventPrompt();
|
||||||
} else if (input.equalsIgnoreCase("7")) {
|
} else if (input.equalsIgnoreCase("7")) {
|
||||||
return new StageMainPrompt(plugin, stageNum, context, factory);
|
return new StageMainPrompt(plugin, stageNum, context);
|
||||||
} else {
|
} else {
|
||||||
return new EventListPrompt();
|
return new EventListPrompt();
|
||||||
}
|
}
|
||||||
@ -1393,12 +1389,12 @@ public class StageMainPrompt extends QuestsEditorNumericPrompt {
|
|||||||
public Prompt acceptInput(ConversationContext context, String input) {
|
public Prompt acceptInput(ConversationContext context, String input) {
|
||||||
Player player = (Player) context.getForWhom();
|
Player player = (Player) context.getForWhom();
|
||||||
if (input.equalsIgnoreCase(Lang.get("cmdCancel"))) {
|
if (input.equalsIgnoreCase(Lang.get("cmdCancel"))) {
|
||||||
return new StageMainPrompt(plugin, stageNum, context, factory);
|
return new StageMainPrompt(plugin, stageNum, context);
|
||||||
}
|
}
|
||||||
if (input.equalsIgnoreCase(Lang.get("cmdClear"))) {
|
if (input.equalsIgnoreCase(Lang.get("cmdClear"))) {
|
||||||
context.setSessionData(stagePrefix + CK.S_DELAY, null);
|
context.setSessionData(stagePrefix + CK.S_DELAY, null);
|
||||||
player.sendMessage(ChatColor.GREEN + Lang.get("stageEditorDelayCleared"));
|
player.sendMessage(ChatColor.GREEN + Lang.get("stageEditorDelayCleared"));
|
||||||
return new StageMainPrompt(plugin, stageNum, context, factory);
|
return new StageMainPrompt(plugin, stageNum, context);
|
||||||
}
|
}
|
||||||
long stageDelay;
|
long stageDelay;
|
||||||
try {
|
try {
|
||||||
@ -1413,7 +1409,7 @@ public class StageMainPrompt extends QuestsEditorNumericPrompt {
|
|||||||
return new DelayPrompt();
|
return new DelayPrompt();
|
||||||
} else {
|
} else {
|
||||||
context.setSessionData(stagePrefix + CK.S_DELAY, stageDelay);
|
context.setSessionData(stagePrefix + CK.S_DELAY, stageDelay);
|
||||||
return new StageMainPrompt(plugin, stageNum, context, factory);
|
return new StageMainPrompt(plugin, stageNum, context);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1431,11 +1427,11 @@ public class StageMainPrompt extends QuestsEditorNumericPrompt {
|
|||||||
if (input.equalsIgnoreCase(Lang.get("cmdCancel")) == false
|
if (input.equalsIgnoreCase(Lang.get("cmdCancel")) == false
|
||||||
&& input.equalsIgnoreCase(Lang.get("cmdClear")) == false) {
|
&& input.equalsIgnoreCase(Lang.get("cmdClear")) == false) {
|
||||||
context.setSessionData(stagePrefix + CK.S_DELAY_MESSAGE, input);
|
context.setSessionData(stagePrefix + CK.S_DELAY_MESSAGE, input);
|
||||||
return new StageMainPrompt(plugin, stageNum, context, factory);
|
return new StageMainPrompt(plugin, stageNum, context);
|
||||||
} else if (input.equalsIgnoreCase(Lang.get("cmdClear"))) {
|
} else if (input.equalsIgnoreCase(Lang.get("cmdClear"))) {
|
||||||
context.setSessionData(stagePrefix + CK.S_DELAY_MESSAGE, null);
|
context.setSessionData(stagePrefix + CK.S_DELAY_MESSAGE, null);
|
||||||
player.sendMessage(ChatColor.YELLOW + Lang.get("stageEditorMessageCleared"));
|
player.sendMessage(ChatColor.YELLOW + Lang.get("stageEditorMessageCleared"));
|
||||||
return new StageMainPrompt(plugin, stageNum, context, factory);
|
return new StageMainPrompt(plugin, stageNum, context);
|
||||||
} else {
|
} else {
|
||||||
return new DelayMessagePrompt();
|
return new DelayMessagePrompt();
|
||||||
}
|
}
|
||||||
@ -1459,11 +1455,11 @@ public class StageMainPrompt extends QuestsEditorNumericPrompt {
|
|||||||
public Prompt acceptInput(ConversationContext context, String input) {
|
public Prompt acceptInput(ConversationContext context, String input) {
|
||||||
Player player = (Player) context.getForWhom();
|
Player player = (Player) context.getForWhom();
|
||||||
if (input.equalsIgnoreCase("1") || input.equalsIgnoreCase("Yes")) {
|
if (input.equalsIgnoreCase("1") || input.equalsIgnoreCase("Yes")) {
|
||||||
new StageMenuPrompt(plugin, context, factory).deleteStage(context, stageNum);
|
new StageMenuPrompt(plugin, context).deleteStage(context, stageNum);
|
||||||
player.sendMessage(ChatColor.YELLOW + Lang.get("stageEditorDeleteSucces"));
|
player.sendMessage(ChatColor.YELLOW + Lang.get("stageEditorDeleteSucces"));
|
||||||
return new StageMenuPrompt(plugin, context, factory);
|
return new StageMenuPrompt(plugin, context);
|
||||||
} else if (input.equalsIgnoreCase("2") || input.equalsIgnoreCase("No")) {
|
} else if (input.equalsIgnoreCase("2") || input.equalsIgnoreCase("No")) {
|
||||||
return new StageMainPrompt(plugin, stageNum, context, factory);
|
return new StageMainPrompt(plugin, stageNum, context);
|
||||||
} else {
|
} else {
|
||||||
player.sendMessage(ChatColor.RED + Lang.get("invalidOption"));
|
player.sendMessage(ChatColor.RED + Lang.get("invalidOption"));
|
||||||
return new DeletePrompt();
|
return new DeletePrompt();
|
||||||
@ -1484,13 +1480,13 @@ public class StageMainPrompt extends QuestsEditorNumericPrompt {
|
|||||||
if (input.equalsIgnoreCase(Lang.get("cmdCancel")) == false
|
if (input.equalsIgnoreCase(Lang.get("cmdCancel")) == false
|
||||||
&& input.equalsIgnoreCase(Lang.get("cmdClear")) == false) {
|
&& input.equalsIgnoreCase(Lang.get("cmdClear")) == false) {
|
||||||
context.setSessionData(stagePrefix + CK.S_START_MESSAGE, input);
|
context.setSessionData(stagePrefix + CK.S_START_MESSAGE, input);
|
||||||
return new StageMainPrompt(plugin, stageNum, context, factory);
|
return new StageMainPrompt(plugin, stageNum, context);
|
||||||
} else if (input.equalsIgnoreCase(Lang.get("cmdClear"))) {
|
} else if (input.equalsIgnoreCase(Lang.get("cmdClear"))) {
|
||||||
context.setSessionData(stagePrefix + CK.S_START_MESSAGE, null);
|
context.setSessionData(stagePrefix + CK.S_START_MESSAGE, null);
|
||||||
player.sendMessage(ChatColor.YELLOW + Lang.get("stageEditorMessageCleared"));
|
player.sendMessage(ChatColor.YELLOW + Lang.get("stageEditorMessageCleared"));
|
||||||
return new StageMainPrompt(plugin, stageNum, context, factory);
|
return new StageMainPrompt(plugin, stageNum, context);
|
||||||
} else {
|
} else {
|
||||||
return new StageMainPrompt(plugin, stageNum, context, factory);
|
return new StageMainPrompt(plugin, stageNum, context);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1508,13 +1504,13 @@ public class StageMainPrompt extends QuestsEditorNumericPrompt {
|
|||||||
if (input.equalsIgnoreCase(Lang.get("cmdCancel")) == false
|
if (input.equalsIgnoreCase(Lang.get("cmdCancel")) == false
|
||||||
&& input.equalsIgnoreCase(Lang.get("cmdClear")) == false) {
|
&& input.equalsIgnoreCase(Lang.get("cmdClear")) == false) {
|
||||||
context.setSessionData(stagePrefix + CK.S_COMPLETE_MESSAGE, input);
|
context.setSessionData(stagePrefix + CK.S_COMPLETE_MESSAGE, input);
|
||||||
return new StageMainPrompt(plugin, stageNum, context, factory);
|
return new StageMainPrompt(plugin, stageNum, context);
|
||||||
} else if (input.equalsIgnoreCase(Lang.get("cmdClear"))) {
|
} else if (input.equalsIgnoreCase(Lang.get("cmdClear"))) {
|
||||||
context.setSessionData(stagePrefix + CK.S_COMPLETE_MESSAGE, null);
|
context.setSessionData(stagePrefix + CK.S_COMPLETE_MESSAGE, null);
|
||||||
player.sendMessage(ChatColor.YELLOW + Lang.get("stageEditorMessageCleared"));
|
player.sendMessage(ChatColor.YELLOW + Lang.get("stageEditorMessageCleared"));
|
||||||
return new StageMainPrompt(plugin, stageNum, context, factory);
|
return new StageMainPrompt(plugin, stageNum, context);
|
||||||
} else {
|
} else {
|
||||||
return new StageMainPrompt(plugin, stageNum, context, factory);
|
return new StageMainPrompt(plugin, stageNum, context);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1609,7 +1605,7 @@ public class StageMainPrompt extends QuestsEditorNumericPrompt {
|
|||||||
context.setSessionData(stagePrefix + CK.S_CUSTOM_OBJECTIVES_DATA_TEMP, null);
|
context.setSessionData(stagePrefix + CK.S_CUSTOM_OBJECTIVES_DATA_TEMP, null);
|
||||||
context.getForWhom().sendRawMessage(ChatColor.YELLOW + Lang.get("stageEditorCustomCleared"));
|
context.getForWhom().sendRawMessage(ChatColor.YELLOW + Lang.get("stageEditorCustomCleared"));
|
||||||
}
|
}
|
||||||
return new StageMainPrompt(plugin, stageNum, context, factory);
|
return new StageMainPrompt(plugin, stageNum, context);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1656,7 +1652,7 @@ public class StageMainPrompt extends QuestsEditorNumericPrompt {
|
|||||||
context.setSessionData(stagePrefix + CK.S_CUSTOM_OBJECTIVES_DATA_DESCRIPTIONS, found.getDescriptions());
|
context.setSessionData(stagePrefix + CK.S_CUSTOM_OBJECTIVES_DATA_DESCRIPTIONS, found.getDescriptions());
|
||||||
return new ObjectiveCustomDataListPrompt();
|
return new ObjectiveCustomDataListPrompt();
|
||||||
} else {
|
} else {
|
||||||
return new StageMainPrompt(plugin, stageNum, context, factory);
|
return new StageMainPrompt(plugin, stageNum, context);
|
||||||
}
|
}
|
||||||
} catch (NumberFormatException e) {
|
} catch (NumberFormatException e) {
|
||||||
context.getForWhom().sendRawMessage(ChatColor.RED + Lang.get("reqNotANumber")
|
context.getForWhom().sendRawMessage(ChatColor.RED + Lang.get("reqNotANumber")
|
||||||
@ -1750,7 +1746,7 @@ public class StageMainPrompt extends QuestsEditorNumericPrompt {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
context.setSessionData(stagePrefix + CK.S_CUSTOM_OBJECTIVES_DATA_DESCRIPTIONS, null);
|
context.setSessionData(stagePrefix + CK.S_CUSTOM_OBJECTIVES_DATA_DESCRIPTIONS, null);
|
||||||
return new StageMainPrompt(plugin, stageNum, context, factory);
|
return new StageMainPrompt(plugin, stageNum, context);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -16,7 +16,6 @@ import org.bukkit.ChatColor;
|
|||||||
import org.bukkit.conversations.ConversationContext;
|
import org.bukkit.conversations.ConversationContext;
|
||||||
import org.bukkit.conversations.Prompt;
|
import org.bukkit.conversations.Prompt;
|
||||||
|
|
||||||
import me.blackvein.quests.QuestFactory;
|
|
||||||
import me.blackvein.quests.Quests;
|
import me.blackvein.quests.Quests;
|
||||||
import me.blackvein.quests.convo.quests.QuestsEditorNumericPrompt;
|
import me.blackvein.quests.convo.quests.QuestsEditorNumericPrompt;
|
||||||
import me.blackvein.quests.events.editor.quests.QuestsEditorPostOpenNumericPromptEvent;
|
import me.blackvein.quests.events.editor.quests.QuestsEditorPostOpenNumericPromptEvent;
|
||||||
@ -26,13 +25,11 @@ import me.blackvein.quests.util.Lang;
|
|||||||
public class StageMenuPrompt extends QuestsEditorNumericPrompt {
|
public class StageMenuPrompt extends QuestsEditorNumericPrompt {
|
||||||
|
|
||||||
private final Quests plugin;
|
private final Quests plugin;
|
||||||
private final QuestFactory factory;
|
|
||||||
private int size = 2;
|
private int size = 2;
|
||||||
|
|
||||||
public StageMenuPrompt(Quests plugin, ConversationContext context, QuestFactory qf) {
|
public StageMenuPrompt(Quests plugin, ConversationContext context) {
|
||||||
super(context, qf);
|
super(context);
|
||||||
this.plugin = plugin;
|
this.plugin = plugin;
|
||||||
factory = qf;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getSize() {
|
public int getSize() {
|
||||||
@ -78,7 +75,7 @@ public class StageMenuPrompt extends QuestsEditorNumericPrompt {
|
|||||||
@Override
|
@Override
|
||||||
public String getPromptText(ConversationContext context) {
|
public String getPromptText(ConversationContext context) {
|
||||||
QuestsEditorPostOpenNumericPromptEvent event
|
QuestsEditorPostOpenNumericPromptEvent event
|
||||||
= new QuestsEditorPostOpenNumericPromptEvent(context, factory, this);
|
= new QuestsEditorPostOpenNumericPromptEvent(context, this);
|
||||||
plugin.getServer().getPluginManager().callEvent(event);
|
plugin.getServer().getPluginManager().callEvent(event);
|
||||||
|
|
||||||
String text = ChatColor.LIGHT_PURPLE + "- " + getTitle(context) + " -\n";
|
String text = ChatColor.LIGHT_PURPLE + "- " + getTitle(context) + " -\n";
|
||||||
@ -95,14 +92,14 @@ public class StageMenuPrompt extends QuestsEditorNumericPrompt {
|
|||||||
int stages = getStages(context);
|
int stages = getStages(context);
|
||||||
if (i > 0) {
|
if (i > 0) {
|
||||||
if (i < (stages + 1) && i > 0) {
|
if (i < (stages + 1) && i > 0) {
|
||||||
return new StageMainPrompt(plugin, (i), context, factory);
|
return new StageMainPrompt(plugin, (i), context);
|
||||||
} else if (i == (stages + 1)) {
|
} else if (i == (stages + 1)) {
|
||||||
return new StageMainPrompt(plugin, (stages + 1), context, factory);
|
return new StageMainPrompt(plugin, (stages + 1), context);
|
||||||
} else if (i == (stages + 2)) {
|
} else if (i == (stages + 2)) {
|
||||||
return factory.returnToMenu(context);
|
return plugin.getQuestFactory().returnToMenu(context);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return new StageMenuPrompt(plugin, context, factory);
|
return new StageMenuPrompt(plugin, context);
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getStages(ConversationContext context) {
|
public int getStages(ConversationContext context) {
|
||||||
|
@ -16,6 +16,7 @@ import org.bukkit.conversations.ConversationContext;
|
|||||||
import org.bukkit.conversations.Prompt;
|
import org.bukkit.conversations.Prompt;
|
||||||
import org.bukkit.event.HandlerList;
|
import org.bukkit.event.HandlerList;
|
||||||
|
|
||||||
|
import me.blackvein.quests.Quests;
|
||||||
import me.blackvein.quests.actions.ActionFactory;
|
import me.blackvein.quests.actions.ActionFactory;
|
||||||
import me.blackvein.quests.events.QuestsEvent;
|
import me.blackvein.quests.events.QuestsEvent;
|
||||||
|
|
||||||
@ -28,12 +29,27 @@ public abstract class ActionsEditorEvent extends QuestsEvent {
|
|||||||
protected ActionFactory factory;
|
protected ActionFactory factory;
|
||||||
protected Prompt prompt;
|
protected Prompt prompt;
|
||||||
|
|
||||||
|
public ActionsEditorEvent(final ConversationContext context, final Prompt prompt) {
|
||||||
|
this.context = context;
|
||||||
|
this.factory = ((Quests)context.getPlugin()).getActionFactory();
|
||||||
|
this.prompt = prompt;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ActionsEditorEvent(final ConversationContext context, final Prompt prompt, boolean async) {
|
||||||
|
super(async);
|
||||||
|
this.context = context;
|
||||||
|
this.factory = ((Quests)context.getPlugin()).getActionFactory();
|
||||||
|
this.prompt = prompt;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Deprecated
|
||||||
public ActionsEditorEvent(final ConversationContext context, ActionFactory factory, final Prompt prompt) {
|
public ActionsEditorEvent(final ConversationContext context, ActionFactory factory, final Prompt prompt) {
|
||||||
this.context = context;
|
this.context = context;
|
||||||
this.factory = factory;
|
this.factory = factory;
|
||||||
this.prompt = prompt;
|
this.prompt = prompt;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Deprecated
|
||||||
public ActionsEditorEvent(final ConversationContext context, ActionFactory factory, final Prompt prompt,
|
public ActionsEditorEvent(final ConversationContext context, ActionFactory factory, final Prompt prompt,
|
||||||
boolean async) {
|
boolean async) {
|
||||||
super(async);
|
super(async);
|
||||||
|
@ -15,6 +15,7 @@ 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;
|
||||||
|
|
||||||
|
import me.blackvein.quests.Quests;
|
||||||
import me.blackvein.quests.actions.ActionFactory;
|
import me.blackvein.quests.actions.ActionFactory;
|
||||||
import me.blackvein.quests.convo.actions.ActionsEditorNumericPrompt;
|
import me.blackvein.quests.convo.actions.ActionsEditorNumericPrompt;
|
||||||
|
|
||||||
@ -23,6 +24,14 @@ public class ActionsEditorPostOpenNumericPromptEvent extends ActionsEditorEvent
|
|||||||
private ActionFactory factory;
|
private ActionFactory factory;
|
||||||
private ActionsEditorNumericPrompt prompt;
|
private ActionsEditorNumericPrompt prompt;
|
||||||
|
|
||||||
|
public ActionsEditorPostOpenNumericPromptEvent(ConversationContext context, ActionsEditorNumericPrompt prompt) {
|
||||||
|
super(context, prompt);
|
||||||
|
this.context = context;
|
||||||
|
this.factory = ((Quests)context.getPlugin()).getActionFactory();
|
||||||
|
this.prompt = prompt;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Deprecated
|
||||||
public ActionsEditorPostOpenNumericPromptEvent(ConversationContext context, ActionFactory factory,
|
public ActionsEditorPostOpenNumericPromptEvent(ConversationContext context, ActionFactory factory,
|
||||||
ActionsEditorNumericPrompt prompt) {
|
ActionsEditorNumericPrompt prompt) {
|
||||||
super(context, factory, prompt);
|
super(context, factory, prompt);
|
||||||
|
@ -15,6 +15,7 @@ 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;
|
||||||
|
|
||||||
|
import me.blackvein.quests.Quests;
|
||||||
import me.blackvein.quests.actions.ActionFactory;
|
import me.blackvein.quests.actions.ActionFactory;
|
||||||
import me.blackvein.quests.convo.actions.ActionsEditorStringPrompt;
|
import me.blackvein.quests.convo.actions.ActionsEditorStringPrompt;
|
||||||
|
|
||||||
@ -23,6 +24,14 @@ public class ActionsEditorPostOpenStringPromptEvent extends ActionsEditorEvent {
|
|||||||
private ActionFactory factory;
|
private ActionFactory factory;
|
||||||
private ActionsEditorStringPrompt prompt;
|
private ActionsEditorStringPrompt prompt;
|
||||||
|
|
||||||
|
public ActionsEditorPostOpenStringPromptEvent(ConversationContext context, ActionsEditorStringPrompt prompt) {
|
||||||
|
super(context, prompt);
|
||||||
|
this.context = context;
|
||||||
|
this.factory = ((Quests)context.getPlugin()).getActionFactory();
|
||||||
|
this.prompt = prompt;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Deprecated
|
||||||
public ActionsEditorPostOpenStringPromptEvent(ConversationContext context, ActionFactory factory,
|
public ActionsEditorPostOpenStringPromptEvent(ConversationContext context, ActionFactory factory,
|
||||||
ActionsEditorStringPrompt prompt) {
|
ActionsEditorStringPrompt prompt) {
|
||||||
super(context, factory, prompt);
|
super(context, factory, prompt);
|
||||||
|
@ -17,6 +17,7 @@ import org.bukkit.conversations.Prompt;
|
|||||||
import org.bukkit.event.HandlerList;
|
import org.bukkit.event.HandlerList;
|
||||||
|
|
||||||
import me.blackvein.quests.QuestFactory;
|
import me.blackvein.quests.QuestFactory;
|
||||||
|
import me.blackvein.quests.Quests;
|
||||||
import me.blackvein.quests.events.QuestsEvent;
|
import me.blackvein.quests.events.QuestsEvent;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -28,12 +29,27 @@ public abstract class QuestsEditorEvent extends QuestsEvent {
|
|||||||
protected QuestFactory factory;
|
protected QuestFactory factory;
|
||||||
protected Prompt prompt;
|
protected Prompt prompt;
|
||||||
|
|
||||||
|
public QuestsEditorEvent(final ConversationContext context, final Prompt prompt) {
|
||||||
|
this.context = context;
|
||||||
|
this.factory = ((Quests)context.getPlugin()).getQuestFactory();
|
||||||
|
this.prompt = prompt;
|
||||||
|
}
|
||||||
|
|
||||||
|
public QuestsEditorEvent(final ConversationContext context, final Prompt prompt, boolean async) {
|
||||||
|
super(async);
|
||||||
|
this.context = context;
|
||||||
|
this.factory = ((Quests)context.getPlugin()).getQuestFactory();
|
||||||
|
this.prompt = prompt;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Deprecated
|
||||||
public QuestsEditorEvent(final ConversationContext context, QuestFactory factory, final Prompt prompt) {
|
public QuestsEditorEvent(final ConversationContext context, QuestFactory factory, final Prompt prompt) {
|
||||||
this.context = context;
|
this.context = context;
|
||||||
this.factory = factory;
|
this.factory = factory;
|
||||||
this.prompt = prompt;
|
this.prompt = prompt;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Deprecated
|
||||||
public QuestsEditorEvent(final ConversationContext context, QuestFactory factory, final Prompt prompt,
|
public QuestsEditorEvent(final ConversationContext context, QuestFactory factory, final Prompt prompt,
|
||||||
boolean async) {
|
boolean async) {
|
||||||
super(async);
|
super(async);
|
||||||
|
@ -16,6 +16,7 @@ import org.bukkit.conversations.ConversationContext;
|
|||||||
import org.bukkit.event.HandlerList;
|
import org.bukkit.event.HandlerList;
|
||||||
|
|
||||||
import me.blackvein.quests.QuestFactory;
|
import me.blackvein.quests.QuestFactory;
|
||||||
|
import me.blackvein.quests.Quests;
|
||||||
import me.blackvein.quests.convo.quests.QuestsEditorNumericPrompt;
|
import me.blackvein.quests.convo.quests.QuestsEditorNumericPrompt;
|
||||||
|
|
||||||
public class QuestsEditorPostOpenNumericPromptEvent extends QuestsEditorEvent {
|
public class QuestsEditorPostOpenNumericPromptEvent extends QuestsEditorEvent {
|
||||||
@ -23,6 +24,14 @@ public class QuestsEditorPostOpenNumericPromptEvent extends QuestsEditorEvent {
|
|||||||
private QuestFactory factory;
|
private QuestFactory factory;
|
||||||
private QuestsEditorNumericPrompt prompt;
|
private QuestsEditorNumericPrompt prompt;
|
||||||
|
|
||||||
|
public QuestsEditorPostOpenNumericPromptEvent(ConversationContext context, QuestsEditorNumericPrompt prompt) {
|
||||||
|
super(context, prompt);
|
||||||
|
this.context = context;
|
||||||
|
this.factory = ((Quests)context.getPlugin()).getQuestFactory();
|
||||||
|
this.prompt = prompt;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Deprecated
|
||||||
public QuestsEditorPostOpenNumericPromptEvent(ConversationContext context, QuestFactory factory,
|
public QuestsEditorPostOpenNumericPromptEvent(ConversationContext context, QuestFactory factory,
|
||||||
QuestsEditorNumericPrompt prompt) {
|
QuestsEditorNumericPrompt prompt) {
|
||||||
super(context, factory, prompt);
|
super(context, factory, prompt);
|
||||||
|
@ -16,6 +16,7 @@ import org.bukkit.conversations.ConversationContext;
|
|||||||
import org.bukkit.event.HandlerList;
|
import org.bukkit.event.HandlerList;
|
||||||
|
|
||||||
import me.blackvein.quests.QuestFactory;
|
import me.blackvein.quests.QuestFactory;
|
||||||
|
import me.blackvein.quests.Quests;
|
||||||
import me.blackvein.quests.convo.quests.QuestsEditorStringPrompt;
|
import me.blackvein.quests.convo.quests.QuestsEditorStringPrompt;
|
||||||
|
|
||||||
public class QuestsEditorPostOpenStringPromptEvent extends QuestsEditorEvent {
|
public class QuestsEditorPostOpenStringPromptEvent extends QuestsEditorEvent {
|
||||||
@ -23,6 +24,14 @@ public class QuestsEditorPostOpenStringPromptEvent extends QuestsEditorEvent {
|
|||||||
private QuestFactory factory;
|
private QuestFactory factory;
|
||||||
private QuestsEditorStringPrompt prompt;
|
private QuestsEditorStringPrompt prompt;
|
||||||
|
|
||||||
|
public QuestsEditorPostOpenStringPromptEvent(ConversationContext context, QuestsEditorStringPrompt prompt) {
|
||||||
|
super(context, prompt);
|
||||||
|
this.context = context;
|
||||||
|
this.factory = ((Quests)context.getPlugin()).getQuestFactory();
|
||||||
|
this.prompt = prompt;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Deprecated
|
||||||
public QuestsEditorPostOpenStringPromptEvent(ConversationContext context, QuestFactory factory,
|
public QuestsEditorPostOpenStringPromptEvent(ConversationContext context, QuestFactory factory,
|
||||||
QuestsEditorStringPrompt prompt) {
|
QuestsEditorStringPrompt prompt) {
|
||||||
super(context, factory, prompt);
|
super(context, factory, prompt);
|
||||||
|
@ -484,7 +484,7 @@ public class CmdExecutor implements CommandExecutor {
|
|||||||
|| cs.hasPermission("quests.actions.editor") || cs.hasPermission("quests.events.editor")) {
|
|| cs.hasPermission("quests.actions.editor") || cs.hasPermission("quests.events.editor")) {
|
||||||
Conversable c = (Conversable) cs;
|
Conversable c = (Conversable) cs;
|
||||||
if (!c.isConversing()) {
|
if (!c.isConversing()) {
|
||||||
plugin.getEventFactory().getConversationFactory().buildConversation(c).begin();
|
plugin.getActionFactory().getConversationFactory().buildConversation(c).begin();
|
||||||
} else {
|
} else {
|
||||||
cs.sendMessage(ChatColor.RED + Lang.get("duplicateEditor"));
|
cs.sendMessage(ChatColor.RED + Lang.get("duplicateEditor"));
|
||||||
}
|
}
|
||||||
|
@ -22,6 +22,7 @@ import java.util.LinkedHashMap;
|
|||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Map.Entry;
|
import java.util.Map.Entry;
|
||||||
|
|
||||||
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.ChatColor;
|
import org.bukkit.ChatColor;
|
||||||
import org.bukkit.configuration.InvalidConfigurationException;
|
import org.bukkit.configuration.InvalidConfigurationException;
|
||||||
import org.bukkit.configuration.file.FileConfiguration;
|
import org.bukkit.configuration.file.FileConfiguration;
|
||||||
@ -30,31 +31,21 @@ import org.bukkit.entity.Player;
|
|||||||
|
|
||||||
import me.blackvein.quests.Quests;
|
import me.blackvein.quests.Quests;
|
||||||
import me.clip.placeholderapi.PlaceholderAPI;
|
import me.clip.placeholderapi.PlaceholderAPI;
|
||||||
import me.clip.placeholderapi.PlaceholderAPIPlugin;
|
|
||||||
|
|
||||||
public class Lang {
|
public class Lang {
|
||||||
|
|
||||||
private String iso = "en-US";
|
private static String iso = "en-US";
|
||||||
private static final LangToken tokens = new LangToken();
|
|
||||||
private static final LinkedHashMap<String, String> langMap = new LinkedHashMap<String, String>();
|
private static final LinkedHashMap<String, String> langMap = new LinkedHashMap<String, String>();
|
||||||
private final Quests plugin;
|
|
||||||
private static PlaceholderAPIPlugin placeholder;
|
|
||||||
|
|
||||||
public Lang(Quests plugin) {
|
public static String getISO() {
|
||||||
tokens.initTokens();
|
|
||||||
this.plugin = plugin;
|
|
||||||
Lang.placeholder = plugin.getDependencies().getPlaceholderApi();
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getISO() {
|
|
||||||
return iso;
|
return iso;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setISO(String iso) {
|
public static void setISO(String iso) {
|
||||||
this.iso = iso;
|
Lang.iso = iso;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Collection<String> values() {
|
public static Collection<String> values() {
|
||||||
return langMap.values();
|
return langMap.values();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -66,7 +57,7 @@ public class Lang {
|
|||||||
* @return formatted string, plus processing through PlaceholderAPI by clip
|
* @return formatted string, plus processing through PlaceholderAPI by clip
|
||||||
*/
|
*/
|
||||||
public static String get(Player p, String key) {
|
public static String get(Player p, String key) {
|
||||||
return langMap.containsKey(key) ? tokens.convertString(p, langMap.get(key)) : "NULL";
|
return langMap.containsKey(key) ? LangToken.convertString(p, langMap.get(key)) : "NULL";
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -76,7 +67,7 @@ public class Lang {
|
|||||||
* @return formatted string
|
* @return formatted string
|
||||||
*/
|
*/
|
||||||
public static String get(String key) {
|
public static String get(String key) {
|
||||||
return langMap.containsKey(key) ? tokens.convertString(langMap.get(key)) : "NULL";
|
return langMap.containsKey(key) ? LangToken.convertString(langMap.get(key)) : "NULL";
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -124,7 +115,7 @@ public class Lang {
|
|||||||
return orig;
|
return orig;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void loadLang() throws InvalidConfigurationException, IOException {
|
public static void loadLang(Quests plugin) throws InvalidConfigurationException, IOException {
|
||||||
File langFile = new File(plugin.getDataFolder(), File.separator + "lang" + File.separator + iso + File.separator
|
File langFile = new File(plugin.getDataFolder(), File.separator + "lang" + File.separator + iso + File.separator
|
||||||
+ "strings.yml");
|
+ "strings.yml");
|
||||||
File langFile_new = new File(plugin.getDataFolder(), File.separator + "lang" + File.separator + iso
|
File langFile_new = new File(plugin.getDataFolder(), File.separator + "lang" + File.separator + iso
|
||||||
@ -215,9 +206,9 @@ public class Lang {
|
|||||||
|
|
||||||
private static class LangToken {
|
private static class LangToken {
|
||||||
|
|
||||||
Map<String, String> tokenMap = new HashMap<String, String>();
|
static Map<String, String> tokenMap = new HashMap<String, String>();
|
||||||
|
|
||||||
public void initTokens() {
|
public static void init() {
|
||||||
tokenMap.put("%br%", "\n");
|
tokenMap.put("%br%", "\n");
|
||||||
tokenMap.put("%tab%", "\t");
|
tokenMap.put("%tab%", "\t");
|
||||||
tokenMap.put("%rtr%", "\r");
|
tokenMap.put("%rtr%", "\r");
|
||||||
@ -245,7 +236,10 @@ public class Lang {
|
|||||||
tokenMap.put("%yellow%", ChatColor.YELLOW.toString());
|
tokenMap.put("%yellow%", ChatColor.YELLOW.toString());
|
||||||
}
|
}
|
||||||
|
|
||||||
public String convertString(String s) {
|
public static String convertString(String s) {
|
||||||
|
if (tokenMap.isEmpty()) {
|
||||||
|
LangToken.init();
|
||||||
|
}
|
||||||
for (String token : tokenMap.keySet()) {
|
for (String token : tokenMap.keySet()) {
|
||||||
s = s.replace(token, tokenMap.get(token));
|
s = s.replace(token, tokenMap.get(token));
|
||||||
s = s.replace(token.toUpperCase(), tokenMap.get(token));
|
s = s.replace(token.toUpperCase(), tokenMap.get(token));
|
||||||
@ -253,14 +247,19 @@ public class Lang {
|
|||||||
return s;
|
return s;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String convertString(Player p, String s) {
|
public static String convertString(Player p, String s) {
|
||||||
|
if (tokenMap.isEmpty()) {
|
||||||
|
LangToken.init();
|
||||||
|
}
|
||||||
for (String token : tokenMap.keySet()) {
|
for (String token : tokenMap.keySet()) {
|
||||||
s = s.replace(token, tokenMap.get(token));
|
s = s.replace(token, tokenMap.get(token));
|
||||||
s = s.replace(token.toUpperCase(), tokenMap.get(token));
|
s = s.replace(token.toUpperCase(), tokenMap.get(token));
|
||||||
if (placeholder != null) {
|
if (Bukkit.getServer().getPluginManager().getPlugin("PlaceholderAPI") != null ) {
|
||||||
|
if (!Bukkit.getServer().getPluginManager().getPlugin("PlaceholderAPI").isEnabled()) {
|
||||||
s = PlaceholderAPI.setPlaceholders(p, s);
|
s = PlaceholderAPI.setPlaceholders(p, s);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
return s;
|
return s;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user