mirror of
https://github.com/PikaMug/Quests.git
synced 2025-02-02 13:41:30 +01:00
Supply external conversation hooks, part 28
This commit is contained in:
parent
51e42937ee
commit
19925f46e8
@ -18,7 +18,6 @@ import java.util.List;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.conversations.ConversationContext;
|
||||
import org.bukkit.conversations.Prompt;
|
||||
import org.bukkit.conversations.StringPrompt;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import me.blackvein.quests.Quest;
|
||||
@ -107,14 +106,14 @@ public class QuestMenuPrompt extends QuestsEditorNumericPrompt {
|
||||
}
|
||||
case 2:
|
||||
if (player.hasPermission("quests.editor.*") || player.hasPermission("quests.editor.edit")) {
|
||||
return new QuestSelectEditPrompt();
|
||||
return new QuestSelectEditPrompt(context);
|
||||
} else {
|
||||
player.sendMessage(ChatColor.RED + Lang.get("noPermission"));
|
||||
return new QuestMenuPrompt(context);
|
||||
}
|
||||
case 3:
|
||||
if (player.hasPermission("quests.editor.*") || player.hasPermission("quests.editor.delete")) {
|
||||
return new QuestSelectDeletePrompt();
|
||||
return new QuestSelectDeletePrompt(context);
|
||||
} else {
|
||||
player.sendMessage(ChatColor.RED + Lang.get("noPermission"));
|
||||
return new QuestMenuPrompt(context);
|
||||
@ -187,15 +186,27 @@ public class QuestMenuPrompt extends QuestsEditorNumericPrompt {
|
||||
}
|
||||
}
|
||||
|
||||
public class QuestSelectEditPrompt extends StringPrompt {
|
||||
public class QuestSelectEditPrompt extends QuestsEditorStringPrompt {
|
||||
|
||||
public QuestSelectEditPrompt(ConversationContext context) {
|
||||
super(context);
|
||||
}
|
||||
|
||||
public String getTitle(ConversationContext context) {
|
||||
return Lang.get("questCreateTitle");
|
||||
}
|
||||
|
||||
public String getQueryText(ConversationContext context) {
|
||||
return Lang.get("questEditorEnterQuestName");
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getPromptText(ConversationContext context) {
|
||||
String s = ChatColor.GOLD + Lang.get("questEditTitle") + "\n";
|
||||
String s = ChatColor.GOLD + getTitle(context) + "\n";
|
||||
for (Quest q : plugin.getQuests()) {
|
||||
s += ChatColor.GRAY + "- " + ChatColor.AQUA + q.getName() + "\n";
|
||||
}
|
||||
return s + ChatColor.YELLOW + Lang.get("questEditorEnterQuestName");
|
||||
return s + ChatColor.YELLOW + getQueryText(context);
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -206,23 +217,35 @@ public class QuestMenuPrompt extends QuestsEditorNumericPrompt {
|
||||
plugin.getQuestFactory().loadQuest(context, q);
|
||||
return new QuestMainPrompt(context);
|
||||
}
|
||||
return new QuestSelectEditPrompt();
|
||||
return new QuestSelectEditPrompt(context);
|
||||
} else {
|
||||
return new QuestMenuPrompt(context);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public class QuestSelectDeletePrompt extends StringPrompt {
|
||||
public class QuestSelectDeletePrompt extends QuestsEditorStringPrompt {
|
||||
|
||||
public QuestSelectDeletePrompt(ConversationContext context) {
|
||||
super(context);
|
||||
}
|
||||
|
||||
public String getTitle(ConversationContext context) {
|
||||
return Lang.get("questCreateTitle");
|
||||
}
|
||||
|
||||
public String getQueryText(ConversationContext context) {
|
||||
return Lang.get("questEditorEnterQuestName");
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getPromptText(ConversationContext context) {
|
||||
String text = ChatColor.GOLD + Lang.get("questDeleteTitle") + "\n";
|
||||
String text = ChatColor.GOLD + getTitle(context) + "\n";
|
||||
for (Quest quest : plugin.getQuests()) {
|
||||
text += ChatColor.AQUA + quest.getName() + ChatColor.GRAY + ",";
|
||||
}
|
||||
text = text.substring(0, text.length() - 1) + "\n";
|
||||
text += ChatColor.YELLOW + Lang.get("questEditorEnterQuestName");
|
||||
text += ChatColor.YELLOW + getQueryText(context);
|
||||
return text;
|
||||
}
|
||||
|
||||
@ -240,7 +263,7 @@ public class QuestMenuPrompt extends QuestsEditorNumericPrompt {
|
||||
}
|
||||
if (used.isEmpty()) {
|
||||
context.setSessionData(CK.ED_QUEST_DELETE, found.getName());
|
||||
return new QuestConfirmDeletePrompt();
|
||||
return new QuestConfirmDeletePrompt(context);
|
||||
} else {
|
||||
((Player) context.getForWhom()).sendMessage(ChatColor.RED
|
||||
+ Lang.get("questEditorQuestAsRequirement1") + " \"" + ChatColor.DARK_PURPLE
|
||||
@ -251,18 +274,30 @@ public class QuestMenuPrompt extends QuestsEditorNumericPrompt {
|
||||
}
|
||||
((Player) context.getForWhom()).sendMessage(ChatColor.RED
|
||||
+ Lang.get("questEditorQuestAsRequirement3"));
|
||||
return new QuestSelectDeletePrompt();
|
||||
return new QuestSelectDeletePrompt(context);
|
||||
}
|
||||
}
|
||||
((Player) context.getForWhom()).sendMessage(ChatColor.RED + Lang.get("questEditorQuestNotFound"));
|
||||
return new QuestSelectDeletePrompt();
|
||||
return new QuestSelectDeletePrompt(context);
|
||||
} else {
|
||||
return new QuestMenuPrompt(context);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public class QuestConfirmDeletePrompt extends StringPrompt {
|
||||
public class QuestConfirmDeletePrompt extends QuestsEditorStringPrompt {
|
||||
|
||||
public QuestConfirmDeletePrompt(ConversationContext context) {
|
||||
super(context);
|
||||
}
|
||||
|
||||
public String getTitle(ConversationContext context) {
|
||||
return null;
|
||||
}
|
||||
|
||||
public String getQueryText(ConversationContext context) {
|
||||
return Lang.get("confirmDelete");
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getPromptText(ConversationContext context) {
|
||||
@ -270,7 +305,7 @@ public class QuestMenuPrompt extends QuestsEditorNumericPrompt {
|
||||
+ Lang.get("yesWord") + "\n";
|
||||
text += ChatColor.RED + "" + ChatColor.BOLD + "2" + ChatColor.RESET + "" + ChatColor.RED + " - "
|
||||
+ Lang.get("noWord");
|
||||
return ChatColor.RED + Lang.get("confirmDelete") + " (" + ChatColor.YELLOW
|
||||
return ChatColor.RED + getQueryText(context) + " (" + ChatColor.YELLOW
|
||||
+ (String) context.getSessionData(CK.ED_QUEST_DELETE) + ChatColor.RED + ")\n" + text;
|
||||
}
|
||||
|
||||
@ -282,7 +317,7 @@ public class QuestMenuPrompt extends QuestsEditorNumericPrompt {
|
||||
} else if (input.equalsIgnoreCase("2") || input.equalsIgnoreCase(Lang.get("noWord"))) {
|
||||
return new QuestMenuPrompt(context);
|
||||
} else {
|
||||
return new QuestConfirmDeletePrompt();
|
||||
return new QuestConfirmDeletePrompt(context);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -100,9 +100,9 @@ public class OptionsPrompt extends QuestsEditorNumericPrompt {
|
||||
protected Prompt acceptValidatedInput(ConversationContext context, Number input) {
|
||||
switch (input.intValue()) {
|
||||
case 1:
|
||||
return new GeneralPrompt(context);
|
||||
return new OptionsGeneralPrompt(context);
|
||||
case 2:
|
||||
return new MultiplayerPrompt(context);
|
||||
return new OptionsMultiplayerPrompt(context);
|
||||
case 3:
|
||||
return plugin.getQuestFactory().returnToMenu(context);
|
||||
default:
|
||||
@ -277,8 +277,8 @@ public class OptionsPrompt extends QuestsEditorNumericPrompt {
|
||||
}
|
||||
}
|
||||
|
||||
public class GeneralPrompt extends QuestsEditorNumericPrompt {
|
||||
public GeneralPrompt(ConversationContext context) {
|
||||
public class OptionsGeneralPrompt extends QuestsEditorNumericPrompt {
|
||||
public OptionsGeneralPrompt(ConversationContext context) {
|
||||
super(context);
|
||||
}
|
||||
|
||||
@ -374,11 +374,11 @@ public class OptionsPrompt extends QuestsEditorNumericPrompt {
|
||||
switch (input.intValue()) {
|
||||
case 1:
|
||||
tempKey = CK.OPT_ALLOW_COMMANDS;
|
||||
tempPrompt = new GeneralPrompt(context);
|
||||
tempPrompt = new OptionsGeneralPrompt(context);
|
||||
return new TrueFalsePrompt(context);
|
||||
case 2:
|
||||
tempKey = CK.OPT_ALLOW_QUITTING;
|
||||
tempPrompt = new GeneralPrompt(context);
|
||||
tempPrompt = new OptionsGeneralPrompt(context);
|
||||
return new TrueFalsePrompt(context);
|
||||
case 3:
|
||||
tempKey = null;
|
||||
@ -395,8 +395,8 @@ public class OptionsPrompt extends QuestsEditorNumericPrompt {
|
||||
}
|
||||
}
|
||||
|
||||
public class MultiplayerPrompt extends QuestsEditorNumericPrompt {
|
||||
public MultiplayerPrompt(ConversationContext context) {
|
||||
public class OptionsMultiplayerPrompt extends QuestsEditorNumericPrompt {
|
||||
public OptionsMultiplayerPrompt(ConversationContext context) {
|
||||
super(context);
|
||||
}
|
||||
|
||||
@ -520,19 +520,19 @@ public class OptionsPrompt extends QuestsEditorNumericPrompt {
|
||||
switch (input.intValue()) {
|
||||
case 1:
|
||||
tempKey = CK.OPT_USE_DUNGEONSXL_PLUGIN;
|
||||
tempPrompt = new MultiplayerPrompt(context);
|
||||
tempPrompt = new OptionsMultiplayerPrompt(context);
|
||||
return new TrueFalsePrompt(context);
|
||||
case 2:
|
||||
tempKey = CK.OPT_USE_PARTIES_PLUGIN;
|
||||
tempPrompt = new MultiplayerPrompt(context);
|
||||
tempPrompt = new OptionsMultiplayerPrompt(context);
|
||||
return new TrueFalsePrompt(context);
|
||||
case 3:
|
||||
tempKey = CK.OPT_SHARE_PROGRESS_LEVEL;
|
||||
tempPrompt = new MultiplayerPrompt(context);
|
||||
tempPrompt = new OptionsMultiplayerPrompt(context);
|
||||
return new LevelPrompt(context);
|
||||
case 4:
|
||||
tempKey = CK.OPT_REQUIRE_SAME_QUEST;
|
||||
tempPrompt = new MultiplayerPrompt(context);
|
||||
tempPrompt = new OptionsMultiplayerPrompt(context);
|
||||
return new TrueFalsePrompt(context);
|
||||
case 5:
|
||||
tempKey = null;
|
||||
|
@ -19,14 +19,15 @@ import java.util.Locale;
|
||||
import java.util.TimeZone;
|
||||
|
||||
import me.blackvein.quests.convo.quests.QuestsEditorNumericPrompt;
|
||||
import me.blackvein.quests.convo.quests.QuestsEditorStringPrompt;
|
||||
import me.blackvein.quests.events.editor.quests.QuestsEditorPostOpenNumericPromptEvent;
|
||||
import me.blackvein.quests.events.editor.quests.QuestsEditorPostOpenStringPromptEvent;
|
||||
import me.blackvein.quests.util.CK;
|
||||
import me.blackvein.quests.util.Lang;
|
||||
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.conversations.ConversationContext;
|
||||
import org.bukkit.conversations.Prompt;
|
||||
import org.bukkit.conversations.StringPrompt;
|
||||
|
||||
public class DateTimePrompt extends QuestsEditorNumericPrompt {
|
||||
private final Prompt oldPrompt;
|
||||
@ -201,19 +202,19 @@ public class DateTimePrompt extends QuestsEditorNumericPrompt {
|
||||
context.setSessionData("tempZone", cal.getTimeZone().getID());
|
||||
return new DateTimePrompt(context, oldPrompt, source);
|
||||
case 1:
|
||||
return new DayPrompt();
|
||||
return new DayPrompt(context);
|
||||
case 2:
|
||||
return new MonthPrompt();
|
||||
return new MonthPrompt(context);
|
||||
case 3:
|
||||
return new YearPrompt();
|
||||
return new YearPrompt(context);
|
||||
case 4:
|
||||
return new HourPrompt();
|
||||
return new HourPrompt(context);
|
||||
case 5:
|
||||
return new MinutePrompt();
|
||||
return new MinutePrompt(context);
|
||||
case 6:
|
||||
return new SecondPrompt();
|
||||
return new SecondPrompt(context);
|
||||
case 7:
|
||||
return new OffsetPrompt();
|
||||
return new OffsetPrompt(context);
|
||||
case 8:
|
||||
context.setSessionData("tempDay", null);
|
||||
context.setSessionData("tempMonth", null);
|
||||
@ -266,11 +267,28 @@ public class DateTimePrompt extends QuestsEditorNumericPrompt {
|
||||
}
|
||||
}
|
||||
|
||||
private class DayPrompt extends StringPrompt {
|
||||
public class DayPrompt extends QuestsEditorStringPrompt {
|
||||
|
||||
public DayPrompt(ConversationContext context) {
|
||||
super(context);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getPromptText(ConversationContext cc) {
|
||||
return ChatColor.YELLOW + Lang.get("dateCreateEnterDay");
|
||||
public String getTitle(ConversationContext context) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getQueryText(ConversationContext context) {
|
||||
return Lang.get("dateCreateEnterDay");
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getPromptText(ConversationContext context) {
|
||||
QuestsEditorPostOpenStringPromptEvent event = new QuestsEditorPostOpenStringPromptEvent(context, this);
|
||||
context.getPlugin().getServer().getPluginManager().callEvent(event);
|
||||
|
||||
return ChatColor.YELLOW + getQueryText(context);
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -281,14 +299,14 @@ public class DateTimePrompt extends QuestsEditorNumericPrompt {
|
||||
if (amt < 1 || amt > 31) {
|
||||
context.getForWhom().sendRawMessage(ChatColor.RED + Lang.get("invalidRange")
|
||||
.replace("<least>", "1").replace("<greatest>", "31"));
|
||||
return new DayPrompt();
|
||||
return new DayPrompt(context);
|
||||
} else {
|
||||
context.setSessionData("tempDay", Integer.parseInt(input));
|
||||
return new DateTimePrompt(context, oldPrompt, source);
|
||||
}
|
||||
} catch (NumberFormatException e) {
|
||||
context.getForWhom().sendRawMessage(ChatColor.RED + Lang.get("itemCreateInvalidInput"));
|
||||
return new DayPrompt();
|
||||
return new DayPrompt(context);
|
||||
}
|
||||
} else {
|
||||
return new DateTimePrompt(context, oldPrompt, source);
|
||||
@ -296,11 +314,28 @@ public class DateTimePrompt extends QuestsEditorNumericPrompt {
|
||||
}
|
||||
}
|
||||
|
||||
private class MonthPrompt extends StringPrompt {
|
||||
public class MonthPrompt extends QuestsEditorStringPrompt {
|
||||
|
||||
public MonthPrompt(ConversationContext context) {
|
||||
super(context);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getPromptText(ConversationContext cc) {
|
||||
return ChatColor.YELLOW + Lang.get("dateCreateEnterMonth");
|
||||
public String getTitle(ConversationContext context) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getQueryText(ConversationContext context) {
|
||||
return Lang.get("dateCreateEnterYear");
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getPromptText(ConversationContext context) {
|
||||
QuestsEditorPostOpenStringPromptEvent event = new QuestsEditorPostOpenStringPromptEvent(context, this);
|
||||
context.getPlugin().getServer().getPluginManager().callEvent(event);
|
||||
|
||||
return ChatColor.YELLOW + getQueryText(context);
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -311,14 +346,14 @@ public class DateTimePrompt extends QuestsEditorNumericPrompt {
|
||||
if (amt < 1 || amt > 12) {
|
||||
context.getForWhom().sendRawMessage(ChatColor.RED + Lang.get("invalidRange")
|
||||
.replace("<least>", "1").replace("<greatest>", "12"));
|
||||
return new MonthPrompt();
|
||||
return new MonthPrompt(context);
|
||||
} else {
|
||||
context.setSessionData("tempMonth", Integer.parseInt(input) - 1);
|
||||
return new DateTimePrompt(context, oldPrompt, source);
|
||||
}
|
||||
} catch (NumberFormatException e) {
|
||||
context.getForWhom().sendRawMessage(ChatColor.RED + Lang.get("itemCreateInvalidInput"));
|
||||
return new MonthPrompt();
|
||||
return new MonthPrompt(context);
|
||||
}
|
||||
} else {
|
||||
return new DateTimePrompt(context, oldPrompt, source);
|
||||
@ -326,11 +361,28 @@ public class DateTimePrompt extends QuestsEditorNumericPrompt {
|
||||
}
|
||||
}
|
||||
|
||||
private class YearPrompt extends StringPrompt {
|
||||
public class YearPrompt extends QuestsEditorStringPrompt {
|
||||
|
||||
public YearPrompt(ConversationContext context) {
|
||||
super(context);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getPromptText(ConversationContext cc) {
|
||||
return ChatColor.YELLOW + Lang.get("dateCreateEnterYear");
|
||||
public String getTitle(ConversationContext context) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getQueryText(ConversationContext context) {
|
||||
return Lang.get("dateCreateEnterYear");
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getPromptText(ConversationContext context) {
|
||||
QuestsEditorPostOpenStringPromptEvent event = new QuestsEditorPostOpenStringPromptEvent(context, this);
|
||||
context.getPlugin().getServer().getPluginManager().callEvent(event);
|
||||
|
||||
return ChatColor.YELLOW + getQueryText(context);
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -341,14 +393,14 @@ public class DateTimePrompt extends QuestsEditorNumericPrompt {
|
||||
if (amt < 1000 || amt > 9999) {
|
||||
context.getForWhom().sendRawMessage(ChatColor.RED + Lang.get("invalidRange")
|
||||
.replace("<least>", "1000").replace("<greatest>", "9999"));
|
||||
return new YearPrompt();
|
||||
return new YearPrompt(context);
|
||||
} else {
|
||||
context.setSessionData("tempYear", Integer.parseInt(input));
|
||||
return new DateTimePrompt(context, oldPrompt, source);
|
||||
}
|
||||
} catch (NumberFormatException e) {
|
||||
context.getForWhom().sendRawMessage(ChatColor.RED + Lang.get("itemCreateInvalidInput"));
|
||||
return new YearPrompt();
|
||||
return new YearPrompt(context);
|
||||
}
|
||||
} else {
|
||||
return new DateTimePrompt(context, oldPrompt, source);
|
||||
@ -356,11 +408,28 @@ public class DateTimePrompt extends QuestsEditorNumericPrompt {
|
||||
}
|
||||
}
|
||||
|
||||
private class HourPrompt extends StringPrompt {
|
||||
public class HourPrompt extends QuestsEditorStringPrompt {
|
||||
|
||||
public HourPrompt(ConversationContext context) {
|
||||
super(context);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getPromptText(ConversationContext cc) {
|
||||
return ChatColor.YELLOW + Lang.get("dateCreateEnterHour");
|
||||
public String getTitle(ConversationContext context) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getQueryText(ConversationContext context) {
|
||||
return Lang.get("dateCreateEnterHour");
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getPromptText(ConversationContext context) {
|
||||
QuestsEditorPostOpenStringPromptEvent event = new QuestsEditorPostOpenStringPromptEvent(context, this);
|
||||
context.getPlugin().getServer().getPluginManager().callEvent(event);
|
||||
|
||||
return ChatColor.YELLOW + getQueryText(context);
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -371,14 +440,14 @@ public class DateTimePrompt extends QuestsEditorNumericPrompt {
|
||||
if (amt < 0 || amt > 23) {
|
||||
context.getForWhom().sendRawMessage(ChatColor.RED + Lang.get("invalidRange")
|
||||
.replace("<least>", "0").replace("<greatest>", "23"));
|
||||
return new HourPrompt();
|
||||
return new HourPrompt(context);
|
||||
} else {
|
||||
context.setSessionData("tempHour", Integer.parseInt(input));
|
||||
return new DateTimePrompt(context, oldPrompt, source);
|
||||
}
|
||||
} catch (NumberFormatException e) {
|
||||
context.getForWhom().sendRawMessage(ChatColor.RED + Lang.get("itemCreateInvalidInput"));
|
||||
return new HourPrompt();
|
||||
return new HourPrompt(context);
|
||||
}
|
||||
} else {
|
||||
return new DateTimePrompt(context, oldPrompt, source);
|
||||
@ -386,11 +455,28 @@ public class DateTimePrompt extends QuestsEditorNumericPrompt {
|
||||
}
|
||||
}
|
||||
|
||||
private class MinutePrompt extends StringPrompt {
|
||||
public class MinutePrompt extends QuestsEditorStringPrompt {
|
||||
|
||||
public MinutePrompt(ConversationContext context) {
|
||||
super(context);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getPromptText(ConversationContext cc) {
|
||||
return ChatColor.YELLOW + Lang.get("dateCreateEnterMinute");
|
||||
public String getTitle(ConversationContext context) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getQueryText(ConversationContext context) {
|
||||
return Lang.get("dateCreateEnterMinute");
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getPromptText(ConversationContext context) {
|
||||
QuestsEditorPostOpenStringPromptEvent event = new QuestsEditorPostOpenStringPromptEvent(context, this);
|
||||
context.getPlugin().getServer().getPluginManager().callEvent(event);
|
||||
|
||||
return ChatColor.YELLOW + getQueryText(context);
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -401,14 +487,14 @@ public class DateTimePrompt extends QuestsEditorNumericPrompt {
|
||||
if (amt < 0 || amt > 59) {
|
||||
context.getForWhom().sendRawMessage(ChatColor.RED + Lang.get("invalidRange")
|
||||
.replace("<least>", "0").replace("<greatest>", "59"));
|
||||
return new MinutePrompt();
|
||||
return new MinutePrompt(context);
|
||||
} else {
|
||||
context.setSessionData("tempMinute", Integer.parseInt(input));
|
||||
return new DateTimePrompt(context, oldPrompt, source);
|
||||
}
|
||||
} catch (NumberFormatException e) {
|
||||
context.getForWhom().sendRawMessage(ChatColor.RED + Lang.get("itemCreateInvalidInput"));
|
||||
return new MinutePrompt();
|
||||
return new MinutePrompt(context);
|
||||
}
|
||||
} else {
|
||||
return new DateTimePrompt(context, oldPrompt, source);
|
||||
@ -416,11 +502,28 @@ public class DateTimePrompt extends QuestsEditorNumericPrompt {
|
||||
}
|
||||
}
|
||||
|
||||
private class SecondPrompt extends StringPrompt {
|
||||
public class SecondPrompt extends QuestsEditorStringPrompt {
|
||||
|
||||
public SecondPrompt(ConversationContext context) {
|
||||
super(context);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getPromptText(ConversationContext cc) {
|
||||
return ChatColor.YELLOW + Lang.get("dateCreateEnterSecond");
|
||||
public String getTitle(ConversationContext context) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getQueryText(ConversationContext context) {
|
||||
return Lang.get("dateCreateEnterSecond");
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getPromptText(ConversationContext context) {
|
||||
QuestsEditorPostOpenStringPromptEvent event = new QuestsEditorPostOpenStringPromptEvent(context, this);
|
||||
context.getPlugin().getServer().getPluginManager().callEvent(event);
|
||||
|
||||
return ChatColor.YELLOW + getQueryText(context);
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -431,14 +534,14 @@ public class DateTimePrompt extends QuestsEditorNumericPrompt {
|
||||
if (amt < 0 || amt > 59) {
|
||||
context.getForWhom().sendRawMessage(ChatColor.RED + Lang.get("invalidRange")
|
||||
.replace("<least>", "0").replace("<greatest>", "59"));
|
||||
return new SecondPrompt();
|
||||
return new SecondPrompt(context);
|
||||
} else {
|
||||
context.setSessionData("tempSecond", Integer.parseInt(input));
|
||||
return new DateTimePrompt(context, oldPrompt, source);
|
||||
}
|
||||
} catch (NumberFormatException e) {
|
||||
context.getForWhom().sendRawMessage(ChatColor.RED + Lang.get("itemCreateInvalidInput"));
|
||||
return new SecondPrompt();
|
||||
return new SecondPrompt(context);
|
||||
}
|
||||
} else {
|
||||
return new DateTimePrompt(context, oldPrompt, source);
|
||||
@ -446,11 +549,28 @@ public class DateTimePrompt extends QuestsEditorNumericPrompt {
|
||||
}
|
||||
}
|
||||
|
||||
private class OffsetPrompt extends StringPrompt {
|
||||
public class OffsetPrompt extends QuestsEditorStringPrompt {
|
||||
|
||||
public OffsetPrompt(ConversationContext context) {
|
||||
super(context);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getPromptText(ConversationContext cc) {
|
||||
return ChatColor.YELLOW + Lang.get("dateCreateEnterOffset");
|
||||
public String getTitle(ConversationContext context) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getQueryText(ConversationContext context) {
|
||||
return Lang.get("dateCreateEnterOffset");
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getPromptText(ConversationContext context) {
|
||||
QuestsEditorPostOpenStringPromptEvent event = new QuestsEditorPostOpenStringPromptEvent(context, this);
|
||||
context.getPlugin().getServer().getPluginManager().callEvent(event);
|
||||
|
||||
return ChatColor.YELLOW + getQueryText(context);
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -461,11 +581,11 @@ public class DateTimePrompt extends QuestsEditorNumericPrompt {
|
||||
if (amt < -12.0 || amt > 14.0) {
|
||||
context.getForWhom().sendRawMessage(ChatColor.RED + Lang.get("invalidRange")
|
||||
.replace("<least>", "-12:00").replace("<greatest>", "14:00"));
|
||||
return new OffsetPrompt();
|
||||
return new OffsetPrompt(context);
|
||||
} else {
|
||||
String[] t = TimeZone.getAvailableIDs((int) Math.round(amt * 60.0 * 60.0 * 1000.0));
|
||||
if (t.length > 1) {
|
||||
return new ZonePrompt(t);
|
||||
return new ZonePrompt(context, t);
|
||||
} else if (t.length > 0) {
|
||||
context.setSessionData("tempZone", t[0]);
|
||||
} else {
|
||||
@ -475,7 +595,7 @@ public class DateTimePrompt extends QuestsEditorNumericPrompt {
|
||||
}
|
||||
} catch (NumberFormatException e) {
|
||||
context.getForWhom().sendRawMessage(ChatColor.RED + Lang.get("itemCreateInvalidInput"));
|
||||
return new OffsetPrompt();
|
||||
return new OffsetPrompt(context);
|
||||
}
|
||||
} else {
|
||||
return new DateTimePrompt(context, oldPrompt, source);
|
||||
@ -483,22 +603,36 @@ public class DateTimePrompt extends QuestsEditorNumericPrompt {
|
||||
}
|
||||
}
|
||||
|
||||
private class ZonePrompt extends StringPrompt {
|
||||
public class ZonePrompt extends QuestsEditorStringPrompt {
|
||||
|
||||
String[] zones;
|
||||
|
||||
public ZonePrompt(String[] timezones) {
|
||||
public ZonePrompt(ConversationContext context, String[] timezones) {
|
||||
super(context);
|
||||
zones = timezones;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTitle(ConversationContext context) {
|
||||
return Lang.get("timeZoneTitle");
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getPromptText(ConversationContext cc) {
|
||||
String text = ChatColor.LIGHT_PURPLE + Lang.get("timeZoneTitle") + "\n";
|
||||
public String getQueryText(ConversationContext context) {
|
||||
return Lang.get("dateCreateEnterZone");
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getPromptText(ConversationContext context) {
|
||||
QuestsEditorPostOpenStringPromptEvent event = new QuestsEditorPostOpenStringPromptEvent(context, this);
|
||||
context.getPlugin().getServer().getPluginManager().callEvent(event);
|
||||
|
||||
String text = ChatColor.LIGHT_PURPLE + getTitle(context) + "\n";
|
||||
for (String z : zones) {
|
||||
text += ChatColor.GREEN + z + ", ";
|
||||
}
|
||||
text = text.substring(0, text.length() - 2);
|
||||
return text + "\n" + ChatColor.YELLOW + Lang.get("dateCreateEnterZone");
|
||||
return text + "\n" + ChatColor.YELLOW + getQueryText(context);
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -511,7 +645,7 @@ public class DateTimePrompt extends QuestsEditorNumericPrompt {
|
||||
}
|
||||
}
|
||||
context.getForWhom().sendRawMessage(ChatColor.RED + Lang.get("itemCreateInvalidInput"));
|
||||
return new ZonePrompt(zones);
|
||||
return new ZonePrompt(context, zones);
|
||||
} else {
|
||||
return new DateTimePrompt(context, oldPrompt, source);
|
||||
}
|
||||
|
@ -20,7 +20,9 @@ import java.util.TimeZone;
|
||||
|
||||
import me.blackvein.quests.Quests;
|
||||
import me.blackvein.quests.convo.quests.QuestsEditorNumericPrompt;
|
||||
import me.blackvein.quests.convo.quests.QuestsEditorStringPrompt;
|
||||
import me.blackvein.quests.events.editor.quests.QuestsEditorPostOpenNumericPromptEvent;
|
||||
import me.blackvein.quests.events.editor.quests.QuestsEditorPostOpenStringPromptEvent;
|
||||
import me.blackvein.quests.util.CK;
|
||||
import me.blackvein.quests.util.Lang;
|
||||
import me.blackvein.quests.util.MiscUtil;
|
||||
@ -28,7 +30,6 @@ import me.blackvein.quests.util.MiscUtil;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.conversations.ConversationContext;
|
||||
import org.bukkit.conversations.Prompt;
|
||||
import org.bukkit.conversations.StringPrompt;
|
||||
|
||||
public class PlannerPrompt extends QuestsEditorNumericPrompt {
|
||||
|
||||
@ -156,13 +157,13 @@ public class PlannerPrompt extends QuestsEditorNumericPrompt {
|
||||
return new DateTimePrompt(context, PlannerPrompt.this, "end");
|
||||
case 3:
|
||||
if (context.getSessionData(CK.PLN_START_DATE) != null && context.getSessionData(CK.PLN_END_DATE) != null) {
|
||||
return new RepeatPrompt();
|
||||
return new PlannerRepeatPrompt(context);
|
||||
} else {
|
||||
context.getForWhom().sendRawMessage(ChatColor.RED + Lang.get("invalidOption"));
|
||||
return new PlannerPrompt(context);
|
||||
}
|
||||
case 4:
|
||||
return new CooldownPrompt();
|
||||
return new PlannerCooldownPrompt(context);
|
||||
case 5:
|
||||
return plugin.getQuestFactory().returnToMenu(context);
|
||||
default:
|
||||
@ -170,11 +171,28 @@ public class PlannerPrompt extends QuestsEditorNumericPrompt {
|
||||
}
|
||||
}
|
||||
|
||||
private class RepeatPrompt extends StringPrompt {
|
||||
public class PlannerRepeatPrompt extends QuestsEditorStringPrompt {
|
||||
|
||||
public PlannerRepeatPrompt(ConversationContext context) {
|
||||
super(context);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTitle(ConversationContext context) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getQueryText(ConversationContext context) {
|
||||
return Lang.get("timePrompt");
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getPromptText(ConversationContext context) {
|
||||
return ChatColor.YELLOW + Lang.get("timePrompt");
|
||||
QuestsEditorPostOpenStringPromptEvent event = new QuestsEditorPostOpenStringPromptEvent(context, this);
|
||||
context.getPlugin().getServer().getPluginManager().callEvent(event);
|
||||
|
||||
return ChatColor.YELLOW + getQueryText(context);
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -198,17 +216,34 @@ public class PlannerPrompt extends QuestsEditorNumericPrompt {
|
||||
} catch (NumberFormatException e) {
|
||||
context.getForWhom().sendRawMessage(ChatColor.RED + Lang.get("reqNotANumber")
|
||||
.replace("<input>", input));
|
||||
return new RepeatPrompt();
|
||||
return new PlannerRepeatPrompt(context);
|
||||
}
|
||||
return new PlannerPrompt(context);
|
||||
}
|
||||
}
|
||||
|
||||
private class CooldownPrompt extends StringPrompt {
|
||||
public class PlannerCooldownPrompt extends QuestsEditorStringPrompt {
|
||||
|
||||
public PlannerCooldownPrompt(ConversationContext context) {
|
||||
super(context);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTitle(ConversationContext context) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getQueryText(ConversationContext context) {
|
||||
return Lang.get("timePrompt");
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getPromptText(ConversationContext context) {
|
||||
return ChatColor.YELLOW + Lang.get("timePrompt");
|
||||
QuestsEditorPostOpenStringPromptEvent event = new QuestsEditorPostOpenStringPromptEvent(context, this);
|
||||
context.getPlugin().getServer().getPluginManager().callEvent(event);
|
||||
|
||||
return ChatColor.YELLOW + getQueryText(context);
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -232,7 +267,7 @@ public class PlannerPrompt extends QuestsEditorNumericPrompt {
|
||||
} catch (NumberFormatException e) {
|
||||
context.getForWhom().sendRawMessage(ChatColor.RED + Lang.get("reqNotANumber")
|
||||
.replace("<input>", input));
|
||||
return new CooldownPrompt();
|
||||
return new PlannerCooldownPrompt(context);
|
||||
}
|
||||
return new PlannerPrompt(context);
|
||||
}
|
||||
|
@ -21,7 +21,6 @@ import java.util.Map;
|
||||
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.conversations.ConversationContext;
|
||||
import org.bukkit.conversations.FixedSetPrompt;
|
||||
import org.bukkit.conversations.Prompt;
|
||||
import org.bukkit.conversations.StringPrompt;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
@ -35,7 +34,9 @@ import me.blackvein.quests.Quests;
|
||||
import me.blackvein.quests.convo.generic.ItemStackPrompt;
|
||||
import me.blackvein.quests.convo.generic.OverridePrompt;
|
||||
import me.blackvein.quests.convo.quests.QuestsEditorNumericPrompt;
|
||||
import me.blackvein.quests.convo.quests.QuestsEditorStringPrompt;
|
||||
import me.blackvein.quests.events.editor.quests.QuestsEditorPostOpenNumericPromptEvent;
|
||||
import me.blackvein.quests.events.editor.quests.QuestsEditorPostOpenStringPromptEvent;
|
||||
import me.blackvein.quests.util.CK;
|
||||
import me.blackvein.quests.util.ItemUtil;
|
||||
import me.blackvein.quests.util.Lang;
|
||||
@ -329,34 +330,34 @@ public class RequirementsPrompt extends QuestsEditorNumericPrompt {
|
||||
switch (input.intValue()) {
|
||||
case 1:
|
||||
if (plugin.getDependencies().getVaultEconomy() != null) {
|
||||
return new MoneyPrompt();
|
||||
return new RequirementsMoneyPrompt(context);
|
||||
} else {
|
||||
return new RequirementsPrompt(context);
|
||||
}
|
||||
case 2:
|
||||
return new QuestPointsPrompt();
|
||||
return new RequirementsQuestPointsPrompt(context);
|
||||
case 3:
|
||||
return new ItemListPrompt(context);
|
||||
return new RequirementsItemListPrompt(context);
|
||||
case 4:
|
||||
return new PermissionsPrompt();
|
||||
return new RequirementsPermissionsPrompt(context);
|
||||
case 5:
|
||||
return new QuestListPrompt(true);
|
||||
return new RequirementsQuestListPrompt(context, true);
|
||||
case 6:
|
||||
return new QuestListPrompt(false);
|
||||
return new RequirementsQuestListPrompt(context, false);
|
||||
case 7:
|
||||
if (plugin.getDependencies().getMcmmoClassic() != null) {
|
||||
return new mcMMOPrompt();
|
||||
return new RequirementsMcMMOListPrompt(context);
|
||||
} else {
|
||||
return new RequirementsPrompt(context);
|
||||
}
|
||||
case 8:
|
||||
if (plugin.getDependencies().getHeroes() != null) {
|
||||
return new HeroesPrompt();
|
||||
return new RequirementsHeroesListPrompt(context);
|
||||
} else {
|
||||
return new RequirementsPrompt(context);
|
||||
}
|
||||
case 9:
|
||||
return new CustomRequirementsPrompt();
|
||||
return new CustomRequirementsPrompt(context);
|
||||
case 10:
|
||||
if (hasRequirement) {
|
||||
return new OverridePrompt.Builder()
|
||||
@ -392,11 +393,28 @@ public class RequirementsPrompt extends QuestsEditorNumericPrompt {
|
||||
return false;
|
||||
}
|
||||
|
||||
private class MoneyPrompt extends StringPrompt {
|
||||
public class RequirementsMoneyPrompt extends QuestsEditorStringPrompt {
|
||||
|
||||
public RequirementsMoneyPrompt(ConversationContext context) {
|
||||
super(context);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTitle(ConversationContext context) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getQueryText(ConversationContext context) {
|
||||
return Lang.get("rewMoneyPrompt");
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getPromptText(ConversationContext context) {
|
||||
String text = Lang.get("rewMoneyPrompt");
|
||||
QuestsEditorPostOpenStringPromptEvent event = new QuestsEditorPostOpenStringPromptEvent(context, this);
|
||||
context.getPlugin().getServer().getPluginManager().callEvent(event);
|
||||
|
||||
String text = getQueryText(context);
|
||||
if (plugin.getDependencies().getVaultEconomy() != null) {
|
||||
text = text.replace("<money>", ChatColor.DARK_PURPLE+ ((plugin.getDependencies().getVaultEconomy()
|
||||
.currencyNamePlural().isEmpty() ? Lang.get("money") : plugin.getDependencies().getVaultEconomy()
|
||||
@ -417,12 +435,12 @@ public class RequirementsPrompt extends QuestsEditorNumericPrompt {
|
||||
context.setSessionData(CK.REQ_MONEY, i);
|
||||
} else {
|
||||
context.getForWhom().sendRawMessage(ChatColor.RED + Lang.get("inputPosNum"));
|
||||
return new MoneyPrompt();
|
||||
return new RequirementsMoneyPrompt(context);
|
||||
}
|
||||
} catch (NumberFormatException e) {
|
||||
context.getForWhom().sendRawMessage(ChatColor.RED + Lang.get("reqNotANumber")
|
||||
.replace("<input>", input));
|
||||
return new MoneyPrompt();
|
||||
return new RequirementsMoneyPrompt(context);
|
||||
}
|
||||
} else if (input.equalsIgnoreCase(Lang.get("cmdClear"))) {
|
||||
context.setSessionData(CK.REQ_MONEY, null);
|
||||
@ -432,11 +450,28 @@ public class RequirementsPrompt extends QuestsEditorNumericPrompt {
|
||||
}
|
||||
}
|
||||
|
||||
private class QuestPointsPrompt extends StringPrompt {
|
||||
public class RequirementsQuestPointsPrompt extends QuestsEditorStringPrompt {
|
||||
|
||||
public RequirementsQuestPointsPrompt(ConversationContext context) {
|
||||
super(context);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTitle(ConversationContext context) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getQueryText(ConversationContext context) {
|
||||
return Lang.get("rewQuestPointsPrompt").replace("<points>", Lang.get("questPoints"));
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getPromptText(ConversationContext context) {
|
||||
return ChatColor.YELLOW + Lang.get("rewQuestPointsPrompt").replace("<points>", Lang.get("questPoints"));
|
||||
QuestsEditorPostOpenStringPromptEvent event = new QuestsEditorPostOpenStringPromptEvent(context, this);
|
||||
context.getPlugin().getServer().getPluginManager().callEvent(event);
|
||||
|
||||
return ChatColor.YELLOW + getQueryText(context);
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -449,12 +484,12 @@ public class RequirementsPrompt extends QuestsEditorNumericPrompt {
|
||||
context.setSessionData(CK.REQ_QUEST_POINTS, i);
|
||||
} else {
|
||||
context.getForWhom().sendRawMessage(ChatColor.RED + Lang.get("inputPosNum"));
|
||||
return new QuestPointsPrompt();
|
||||
return new RequirementsQuestPointsPrompt(context);
|
||||
}
|
||||
} catch (NumberFormatException e) {
|
||||
context.getForWhom().sendRawMessage(ChatColor.RED + Lang.get("reqNotANumber")
|
||||
.replace("<input>", input));
|
||||
return new QuestPointsPrompt();
|
||||
return new RequirementsQuestPointsPrompt(context);
|
||||
}
|
||||
} else if (input.equalsIgnoreCase(Lang.get("cmdClear"))) {
|
||||
context.setSessionData(CK.REQ_QUEST_POINTS, null);
|
||||
@ -464,17 +499,31 @@ public class RequirementsPrompt extends QuestsEditorNumericPrompt {
|
||||
}
|
||||
}
|
||||
|
||||
private class QuestListPrompt extends StringPrompt {
|
||||
|
||||
public class RequirementsQuestListPrompt extends QuestsEditorStringPrompt {
|
||||
|
||||
private final boolean isRequiredQuest;
|
||||
|
||||
public QuestListPrompt(boolean isRequired) {
|
||||
public RequirementsQuestListPrompt(ConversationContext context, boolean isRequired) {
|
||||
super(context);
|
||||
this.isRequiredQuest = isRequired;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTitle(ConversationContext context) {
|
||||
return Lang.get("reqQuestListTitle");
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getQueryText(ConversationContext context) {
|
||||
return Lang.get("reqQuestPrompt");
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getPromptText(ConversationContext context) {
|
||||
String text = ChatColor.LIGHT_PURPLE + Lang.get("reqQuestListTitle") + "\n" + ChatColor.DARK_PURPLE;
|
||||
QuestsEditorPostOpenStringPromptEvent event = new QuestsEditorPostOpenStringPromptEvent(context, this);
|
||||
context.getPlugin().getServer().getPluginManager().callEvent(event);
|
||||
|
||||
String text = ChatColor.LIGHT_PURPLE + getTitle(context) + "\n" + ChatColor.DARK_PURPLE;
|
||||
boolean none = true;
|
||||
for (Quest q : plugin.getQuests()) {
|
||||
text += q.getName() + ", ";
|
||||
@ -486,7 +535,7 @@ public class RequirementsPrompt extends QuestsEditorNumericPrompt {
|
||||
text = text.substring(0, (text.length() - 2));
|
||||
text += "\n";
|
||||
}
|
||||
text += ChatColor.YELLOW + Lang.get("reqQuestPrompt");
|
||||
text += ChatColor.YELLOW + getQueryText(context);
|
||||
return text;
|
||||
}
|
||||
|
||||
@ -501,11 +550,11 @@ public class RequirementsPrompt extends QuestsEditorNumericPrompt {
|
||||
String text = Lang.get("reqNotAQuestName");
|
||||
text = text.replace("<quest>", ChatColor.LIGHT_PURPLE + s + ChatColor.RED);
|
||||
context.getForWhom().sendRawMessage(text);
|
||||
return new QuestListPrompt(isRequiredQuest);
|
||||
return new RequirementsQuestListPrompt(context, isRequiredQuest);
|
||||
}
|
||||
if (questNames.contains(s)) {
|
||||
context.getForWhom().sendRawMessage(ChatColor.RED + Lang.get("listDuplicate"));
|
||||
return new QuestListPrompt(isRequiredQuest);
|
||||
return new RequirementsQuestListPrompt(context, isRequiredQuest);
|
||||
}
|
||||
questNames.add(plugin.getQuest(s).getName());
|
||||
}
|
||||
@ -532,8 +581,8 @@ public class RequirementsPrompt extends QuestsEditorNumericPrompt {
|
||||
}
|
||||
}
|
||||
|
||||
public class ItemListPrompt extends QuestsEditorNumericPrompt {
|
||||
public ItemListPrompt(ConversationContext context) {
|
||||
public class RequirementsItemListPrompt extends QuestsEditorNumericPrompt {
|
||||
public RequirementsItemListPrompt(ConversationContext context) {
|
||||
super(context);
|
||||
}
|
||||
|
||||
@ -653,19 +702,19 @@ public class RequirementsPrompt extends QuestsEditorNumericPrompt {
|
||||
protected Prompt acceptValidatedInput(ConversationContext context, Number input) {
|
||||
switch (input.intValue()) {
|
||||
case 1:
|
||||
return new ItemStackPrompt(ItemListPrompt.this);
|
||||
return new ItemStackPrompt(RequirementsItemListPrompt.this);
|
||||
case 2:
|
||||
if (context.getSessionData(CK.REQ_ITEMS) == null) {
|
||||
context.getForWhom().sendRawMessage(ChatColor.RED + Lang.get("reqMustAddItem"));
|
||||
return new ItemListPrompt(context);
|
||||
return new RequirementsItemListPrompt(context);
|
||||
} else {
|
||||
return new RemoveItemsPrompt();
|
||||
return new RemoveItemsPrompt(context);
|
||||
}
|
||||
case 3:
|
||||
context.getForWhom().sendRawMessage(ChatColor.YELLOW + Lang.get("reqItemCleared"));
|
||||
context.setSessionData(CK.REQ_ITEMS, null);
|
||||
context.setSessionData(CK.REQ_ITEMS_REMOVE, null);
|
||||
return new ItemListPrompt(context);
|
||||
return new RequirementsItemListPrompt(context);
|
||||
case 4:
|
||||
int one;
|
||||
int two;
|
||||
@ -683,7 +732,7 @@ public class RequirementsPrompt extends QuestsEditorNumericPrompt {
|
||||
return new RequirementsPrompt(context);
|
||||
} else {
|
||||
context.getForWhom().sendRawMessage(ChatColor.RED + Lang.get("listsNotSameSize"));
|
||||
return new ItemListPrompt(context);
|
||||
return new RequirementsItemListPrompt(context);
|
||||
}
|
||||
default:
|
||||
return null;
|
||||
@ -701,11 +750,28 @@ public class RequirementsPrompt extends QuestsEditorNumericPrompt {
|
||||
}
|
||||
}
|
||||
|
||||
private class RemoveItemsPrompt extends StringPrompt {
|
||||
public class RemoveItemsPrompt extends QuestsEditorStringPrompt {
|
||||
|
||||
public RemoveItemsPrompt(ConversationContext context) {
|
||||
super(context);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTitle(ConversationContext context) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getQueryText(ConversationContext context) {
|
||||
return Lang.get("reqRemoveItemsPrompt");
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getPromptText(ConversationContext context) {
|
||||
return ChatColor.YELLOW + Lang.get("reqRemoveItemsPrompt");
|
||||
QuestsEditorPostOpenStringPromptEvent event = new QuestsEditorPostOpenStringPromptEvent(context, this);
|
||||
context.getPlugin().getServer().getPluginManager().callEvent(event);
|
||||
|
||||
return ChatColor.YELLOW + getQueryText(context);
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -722,20 +788,37 @@ public class RequirementsPrompt extends QuestsEditorNumericPrompt {
|
||||
booleans.add(false);
|
||||
} else {
|
||||
context.getForWhom().sendRawMessage(ChatColor.RED + Lang.get("itemCreateInvalidInput"));
|
||||
return new RemoveItemsPrompt();
|
||||
return new RemoveItemsPrompt(context);
|
||||
}
|
||||
}
|
||||
context.setSessionData(CK.REQ_ITEMS_REMOVE, booleans);
|
||||
}
|
||||
return new ItemListPrompt(context);
|
||||
return new RequirementsItemListPrompt(context);
|
||||
}
|
||||
}
|
||||
|
||||
private class PermissionsPrompt extends StringPrompt {
|
||||
public class RequirementsPermissionsPrompt extends QuestsEditorStringPrompt {
|
||||
|
||||
public RequirementsPermissionsPrompt(ConversationContext context) {
|
||||
super(context);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTitle(ConversationContext context) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getQueryText(ConversationContext context) {
|
||||
return Lang.get("reqPermissionsPrompt");
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getPromptText(ConversationContext context) {
|
||||
return ChatColor.YELLOW + Lang.get("reqPermissionsPrompt");
|
||||
QuestsEditorPostOpenStringPromptEvent event = new QuestsEditorPostOpenStringPromptEvent(context, this);
|
||||
context.getPlugin().getServer().getPluginManager().callEvent(event);
|
||||
|
||||
return ChatColor.YELLOW + getQueryText(context);
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -753,11 +836,28 @@ public class RequirementsPrompt extends QuestsEditorNumericPrompt {
|
||||
}
|
||||
}
|
||||
|
||||
private class CustomRequirementsPrompt extends StringPrompt {
|
||||
public class CustomRequirementsPrompt extends QuestsEditorStringPrompt {
|
||||
|
||||
public CustomRequirementsPrompt(ConversationContext context) {
|
||||
super(context);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTitle(ConversationContext context) {
|
||||
return Lang.get("customRequirementsTitle");
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getQueryText(ConversationContext context) {
|
||||
return Lang.get("reqCustomPrompt");
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getPromptText(ConversationContext context) {
|
||||
String text = ChatColor.LIGHT_PURPLE + Lang.get("customRequirementsTitle") + "\n";
|
||||
QuestsEditorPostOpenStringPromptEvent event = new QuestsEditorPostOpenStringPromptEvent(context, this);
|
||||
context.getPlugin().getServer().getPluginManager().callEvent(event);
|
||||
|
||||
String text = ChatColor.LIGHT_PURPLE + getTitle(context) + "\n";
|
||||
if (plugin.getCustomRequirements().isEmpty()) {
|
||||
text += ChatColor.DARK_PURPLE + "(" + Lang.get("stageEditorNoModules") + ") ";
|
||||
} else {
|
||||
@ -765,7 +865,7 @@ public class RequirementsPrompt extends QuestsEditorNumericPrompt {
|
||||
text += ChatColor.DARK_PURPLE + " - " + cr.getName() + "\n";
|
||||
}
|
||||
}
|
||||
return text + ChatColor.YELLOW + Lang.get("reqCustomPrompt");
|
||||
return text + ChatColor.YELLOW + getQueryText(context);
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
@ -805,7 +905,7 @@ public class RequirementsPrompt extends QuestsEditorNumericPrompt {
|
||||
} else {
|
||||
// Already added, so inform user
|
||||
context.getForWhom().sendRawMessage(ChatColor.YELLOW + Lang.get("reqCustomAlreadyAdded"));
|
||||
return new CustomRequirementsPrompt();
|
||||
return new CustomRequirementsPrompt(context);
|
||||
}
|
||||
} else {
|
||||
// The custom requirement hasn't been added yet, so let's do it
|
||||
@ -823,7 +923,7 @@ public class RequirementsPrompt extends QuestsEditorNumericPrompt {
|
||||
}
|
||||
} else {
|
||||
context.getForWhom().sendRawMessage(ChatColor.YELLOW + Lang.get("reqCustomNotFound"));
|
||||
return new CustomRequirementsPrompt();
|
||||
return new CustomRequirementsPrompt(context);
|
||||
}
|
||||
} else if (input.equalsIgnoreCase(Lang.get("cmdClear"))) {
|
||||
context.setSessionData(CK.REQ_CUSTOM, null);
|
||||
@ -836,7 +936,7 @@ public class RequirementsPrompt extends QuestsEditorNumericPrompt {
|
||||
}
|
||||
|
||||
private class RequirementCustomDataListPrompt extends StringPrompt {
|
||||
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
@Override
|
||||
public String getPromptText(ConversationContext context) {
|
||||
@ -932,62 +1032,127 @@ public class RequirementsPrompt extends QuestsEditorNumericPrompt {
|
||||
}
|
||||
}
|
||||
|
||||
private class mcMMOPrompt extends FixedSetPrompt {
|
||||
public class RequirementsMcMMOListPrompt extends QuestsEditorNumericPrompt {
|
||||
|
||||
public mcMMOPrompt() {
|
||||
super("1", "2", "3");
|
||||
public RequirementsMcMMOListPrompt(ConversationContext context) {
|
||||
super(context);
|
||||
}
|
||||
|
||||
|
||||
private final int size = 3;
|
||||
|
||||
public int getSize() {
|
||||
return size;
|
||||
}
|
||||
|
||||
public String getTitle(ConversationContext context) {
|
||||
return Lang.get("mcMMORequirementsTitle");
|
||||
}
|
||||
|
||||
public ChatColor getNumberColor(ConversationContext context, int number) {
|
||||
switch (number) {
|
||||
case 1:
|
||||
case 2:
|
||||
return ChatColor.BLUE;
|
||||
case 3:
|
||||
return ChatColor.GREEN;
|
||||
default:
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public String getSelectionText(ConversationContext context, int number) {
|
||||
switch(number) {
|
||||
case 1:
|
||||
return ChatColor.YELLOW + Lang.get("reqSetSkills");
|
||||
case 2:
|
||||
return ChatColor.YELLOW + Lang.get("reqSetSkillAmounts");
|
||||
case 3:
|
||||
return ChatColor.GREEN + Lang.get("done");
|
||||
default:
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
public String getAdditionalText(ConversationContext context, int number) {
|
||||
switch(number) {
|
||||
case 1:
|
||||
if (context.getSessionData(CK.REQ_MCMMO_SKILLS) == null) {
|
||||
return ChatColor.GRAY + " (" + Lang.get("noneSet") + ")";
|
||||
} else {
|
||||
String text = "\n";
|
||||
for (String skill : (LinkedList<String>) context.getSessionData(CK.REQ_MCMMO_SKILLS)) {
|
||||
text += ChatColor.GRAY + " - " + ChatColor.AQUA + skill + "\n";
|
||||
}
|
||||
return text;
|
||||
}
|
||||
case 2:
|
||||
if (context.getSessionData(CK.REQ_MCMMO_SKILL_AMOUNTS) == null) {
|
||||
return ChatColor.GRAY + " (" + Lang.get("noneSet") + ")";
|
||||
} else {
|
||||
String text = "\n";
|
||||
for (int i : (LinkedList<Integer>) context.getSessionData(CK.REQ_MCMMO_SKILL_AMOUNTS)) {
|
||||
text += ChatColor.GRAY + " - " + ChatColor.AQUA + i + "\n";
|
||||
}
|
||||
return text;
|
||||
}
|
||||
case 3:
|
||||
return "";
|
||||
default:
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getPromptText(ConversationContext cc) {
|
||||
String text = ChatColor.DARK_GREEN + Lang.get("mcMMORequirementsTitle") + "\n";
|
||||
if (cc.getSessionData(CK.REQ_MCMMO_SKILLS) == null) {
|
||||
text += ChatColor.BOLD + "" + ChatColor.GREEN + "1" + ChatColor.RESET + ChatColor.GREEN + " - "
|
||||
+ Lang.get("reqSetSkills") + "(" + Lang.get("noneSet") + ")\n";
|
||||
} else {
|
||||
text += ChatColor.BOLD + "" + ChatColor.GREEN + "1" + ChatColor.RESET + ChatColor.GREEN + " - "
|
||||
+ Lang.get("reqSetSkills") + "\n";
|
||||
@SuppressWarnings("unchecked")
|
||||
LinkedList<String> skills = (LinkedList<String>) cc.getSessionData(CK.REQ_MCMMO_SKILLS);
|
||||
for (String skill : skills) {
|
||||
text += ChatColor.GRAY + " - " + ChatColor.AQUA + skill + "\n";
|
||||
}
|
||||
public String getPromptText(ConversationContext context) {
|
||||
QuestsEditorPostOpenNumericPromptEvent event = new QuestsEditorPostOpenNumericPromptEvent(context, this);
|
||||
context.getPlugin().getServer().getPluginManager().callEvent(event);
|
||||
|
||||
String text = ChatColor.AQUA + "- " + getTitle(context) + " -\n";
|
||||
for (int i = 1; i <= size; i++) {
|
||||
text += getNumberColor(context, i) + "" + ChatColor.BOLD + i + ChatColor.RESET + " - "
|
||||
+ getSelectionText(context, i) + " " + getAdditionalText(context, i) + "\n";
|
||||
}
|
||||
if (cc.getSessionData(CK.REQ_MCMMO_SKILL_AMOUNTS) == null) {
|
||||
text += ChatColor.BOLD + "" + ChatColor.GREEN + "2" + ChatColor.RESET + ChatColor.GREEN + " - "
|
||||
+ Lang.get("reqSetSkillAmounts") + " (" + Lang.get("noneSet") + ")\n";
|
||||
} else {
|
||||
text += ChatColor.BOLD + "" + ChatColor.GREEN + "2" + ChatColor.RESET + ChatColor.GREEN + " - "
|
||||
+ Lang.get("reqSetSkillAmounts") + "\n";
|
||||
@SuppressWarnings("unchecked")
|
||||
LinkedList<Integer> amounts = (LinkedList<Integer>) cc.getSessionData(CK.REQ_MCMMO_SKILL_AMOUNTS);
|
||||
for (int i : amounts) {
|
||||
text += ChatColor.GRAY + " - " + ChatColor.AQUA + i + "\n";
|
||||
}
|
||||
}
|
||||
text += ChatColor.BOLD + "" + ChatColor.GREEN + "3" + ChatColor.RESET + ChatColor.GREEN + " - "
|
||||
+ Lang.get("done");
|
||||
return text;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
protected Prompt acceptValidatedInput(ConversationContext context, String input) {
|
||||
if (input.equalsIgnoreCase("1")) {
|
||||
return new mcMMOSkillsPrompt();
|
||||
} else if (input.equalsIgnoreCase("2")) {
|
||||
return new mcMMOAmountsPrompt();
|
||||
} else if (input.equalsIgnoreCase("3")) {
|
||||
protected Prompt acceptValidatedInput(ConversationContext context, Number input) {
|
||||
switch(input.intValue()) {
|
||||
case 1:
|
||||
return new McMMOSkillsPrompt(context);
|
||||
case 2:
|
||||
return new McMMOAmountsPrompt(context);
|
||||
case 3:
|
||||
return new RequirementsPrompt(context);
|
||||
default:
|
||||
return new RequirementsMcMMOListPrompt(context);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
private class mcMMOSkillsPrompt extends StringPrompt {
|
||||
public class McMMOSkillsPrompt extends QuestsEditorStringPrompt {
|
||||
|
||||
public McMMOSkillsPrompt(ConversationContext context) {
|
||||
super(context);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTitle(ConversationContext context) {
|
||||
return Lang.get("skillListTitle");
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getQueryText(ConversationContext context) {
|
||||
return Lang.get("rewMcMMOPrompt");
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getPromptText(ConversationContext context) {
|
||||
String skillList = ChatColor.DARK_GREEN + Lang.get("skillListTitle") + "\n";
|
||||
QuestsEditorPostOpenStringPromptEvent event = new QuestsEditorPostOpenStringPromptEvent(context, this);
|
||||
context.getPlugin().getServer().getPluginManager().callEvent(event);
|
||||
|
||||
String skillList = ChatColor.DARK_GREEN + getTitle(context) + "\n";
|
||||
SkillType[] skills = SkillType.values();
|
||||
for (int i = 0; i < skills.length; i++) {
|
||||
if (i == (skills.length - 1)) {
|
||||
@ -996,11 +1161,11 @@ public class RequirementsPrompt extends QuestsEditorNumericPrompt {
|
||||
skillList += ChatColor.GREEN + skills[i].getName() + "\n\n";
|
||||
}
|
||||
}
|
||||
return skillList + ChatColor.YELLOW + Lang.get("rewMcMMOPrompt");
|
||||
return skillList + ChatColor.YELLOW + getQueryText(context);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Prompt acceptInput(ConversationContext cc, String input) {
|
||||
public Prompt acceptInput(ConversationContext context, String input) {
|
||||
if (input.equalsIgnoreCase(Lang.get("cmdCancel")) == false
|
||||
&& input.equalsIgnoreCase(Lang.get("cmdClear")) == false) {
|
||||
LinkedList<String> skills = new LinkedList<String>();
|
||||
@ -1009,37 +1174,54 @@ public class RequirementsPrompt extends QuestsEditorNumericPrompt {
|
||||
if (Quests.getMcMMOSkill(formatted) != null) {
|
||||
skills.add(formatted);
|
||||
} else if (skills.contains(formatted)) {
|
||||
cc.getForWhom().sendRawMessage(ChatColor.YELLOW + Lang.get("listDuplicate"));
|
||||
return new mcMMOSkillsPrompt();
|
||||
context.getForWhom().sendRawMessage(ChatColor.YELLOW + Lang.get("listDuplicate"));
|
||||
return new McMMOSkillsPrompt(context);
|
||||
} else {
|
||||
String text = Lang.get("reqMcMMOError");
|
||||
text = text.replace("<input>", ChatColor.RED + s + ChatColor.YELLOW);
|
||||
cc.getForWhom().sendRawMessage(ChatColor.YELLOW + text);
|
||||
return new mcMMOSkillsPrompt();
|
||||
context.getForWhom().sendRawMessage(ChatColor.YELLOW + text);
|
||||
return new McMMOSkillsPrompt(context);
|
||||
}
|
||||
}
|
||||
cc.setSessionData(CK.REQ_MCMMO_SKILLS, skills);
|
||||
return new mcMMOPrompt();
|
||||
context.setSessionData(CK.REQ_MCMMO_SKILLS, skills);
|
||||
return new RequirementsMcMMOListPrompt(context);
|
||||
} else if (input.equalsIgnoreCase(Lang.get("cmdClear"))) {
|
||||
cc.getForWhom().sendRawMessage(ChatColor.YELLOW + Lang.get("reqMcMMOCleared"));
|
||||
cc.setSessionData(CK.REQ_MCMMO_SKILLS, null);
|
||||
return new mcMMOPrompt();
|
||||
context.getForWhom().sendRawMessage(ChatColor.YELLOW + Lang.get("reqMcMMOCleared"));
|
||||
context.setSessionData(CK.REQ_MCMMO_SKILLS, null);
|
||||
return new RequirementsMcMMOListPrompt(context);
|
||||
} else if (input.equalsIgnoreCase(Lang.get("cmdCancel"))) {
|
||||
return new mcMMOPrompt();
|
||||
return new RequirementsMcMMOListPrompt(context);
|
||||
}
|
||||
return new mcMMOSkillsPrompt();
|
||||
return new McMMOSkillsPrompt(context);
|
||||
}
|
||||
}
|
||||
|
||||
private class mcMMOAmountsPrompt extends StringPrompt {
|
||||
|
||||
@Override
|
||||
public String getPromptText(ConversationContext context) {
|
||||
return ChatColor.YELLOW + Lang.get("reqMcMMOAmountsPrompt");
|
||||
public class McMMOAmountsPrompt extends QuestsEditorStringPrompt {
|
||||
|
||||
public McMMOAmountsPrompt(ConversationContext context) {
|
||||
super(context);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Prompt acceptInput(ConversationContext cc, String input) {
|
||||
public String getTitle(ConversationContext context) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getQueryText(ConversationContext context) {
|
||||
return Lang.get("reqMcMMOAmountsPrompt");
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getPromptText(ConversationContext context) {
|
||||
QuestsEditorPostOpenStringPromptEvent event = new QuestsEditorPostOpenStringPromptEvent(context, this);
|
||||
context.getPlugin().getServer().getPluginManager().callEvent(event);
|
||||
|
||||
return ChatColor.YELLOW + getQueryText(context);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Prompt acceptInput(ConversationContext context, String input) {
|
||||
if (input.equalsIgnoreCase(Lang.get("cmdCancel")) == false
|
||||
&& input.equalsIgnoreCase(Lang.get("cmdClear")) == false) {
|
||||
LinkedList<Integer> amounts = new LinkedList<Integer>();
|
||||
@ -1050,71 +1232,136 @@ public class RequirementsPrompt extends QuestsEditorNumericPrompt {
|
||||
} catch (NumberFormatException nfe) {
|
||||
String text = Lang.get("reqNotANumber");
|
||||
text = text.replace("<input>", ChatColor.RED + s + ChatColor.YELLOW);
|
||||
cc.getForWhom().sendRawMessage(ChatColor.YELLOW + text);
|
||||
return new mcMMOAmountsPrompt();
|
||||
context.getForWhom().sendRawMessage(ChatColor.YELLOW + text);
|
||||
return new McMMOAmountsPrompt(context);
|
||||
}
|
||||
}
|
||||
cc.setSessionData(CK.REQ_MCMMO_SKILL_AMOUNTS, amounts);
|
||||
return new mcMMOPrompt();
|
||||
context.setSessionData(CK.REQ_MCMMO_SKILL_AMOUNTS, amounts);
|
||||
return new RequirementsMcMMOListPrompt(context);
|
||||
} else if (input.equalsIgnoreCase(Lang.get("cmdClear"))) {
|
||||
cc.getForWhom().sendRawMessage(ChatColor.YELLOW + Lang.get("reqMcMMOAmountsCleared"));
|
||||
cc.setSessionData(CK.REQ_MCMMO_SKILL_AMOUNTS, null);
|
||||
return new mcMMOPrompt();
|
||||
context.getForWhom().sendRawMessage(ChatColor.YELLOW + Lang.get("reqMcMMOAmountsCleared"));
|
||||
context.setSessionData(CK.REQ_MCMMO_SKILL_AMOUNTS, null);
|
||||
return new RequirementsMcMMOListPrompt(context);
|
||||
} else if (input.equalsIgnoreCase(Lang.get("cmdCancel"))) {
|
||||
return new mcMMOPrompt();
|
||||
return new RequirementsMcMMOListPrompt(context);
|
||||
}
|
||||
return new mcMMOAmountsPrompt();
|
||||
return new McMMOAmountsPrompt(context);
|
||||
}
|
||||
}
|
||||
|
||||
private class HeroesPrompt extends FixedSetPrompt {
|
||||
public class RequirementsHeroesListPrompt extends QuestsEditorNumericPrompt {
|
||||
|
||||
public HeroesPrompt() {
|
||||
super("1", "2", "3");
|
||||
public RequirementsHeroesListPrompt(ConversationContext context) {
|
||||
super(context);
|
||||
}
|
||||
|
||||
private final int size = 3;
|
||||
|
||||
public int getSize() {
|
||||
return size;
|
||||
}
|
||||
|
||||
public String getTitle(ConversationContext context) {
|
||||
return Lang.get("heroesRequirementsTitle");
|
||||
}
|
||||
|
||||
public ChatColor getNumberColor(ConversationContext context, int number) {
|
||||
switch (number) {
|
||||
case 1:
|
||||
case 2:
|
||||
return ChatColor.BLUE;
|
||||
case 3:
|
||||
return ChatColor.GREEN;
|
||||
default:
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public String getSelectionText(ConversationContext context, int number) {
|
||||
switch(number) {
|
||||
case 1:
|
||||
return ChatColor.YELLOW + Lang.get("reqHeroesSetPrimary");
|
||||
case 2:
|
||||
return ChatColor.YELLOW + Lang.get("reqHeroesSetSecondary");
|
||||
case 3:
|
||||
return ChatColor.GREEN + Lang.get("done");
|
||||
default:
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public String getAdditionalText(ConversationContext context, int number) {
|
||||
switch(number) {
|
||||
case 1:
|
||||
if (context.getSessionData(CK.REQ_HEROES_PRIMARY_CLASS) == null) {
|
||||
return ChatColor.GRAY + " (" + Lang.get("noneSet") + ")";
|
||||
} else {
|
||||
return "(" + ChatColor.AQUA + (String) context.getSessionData(CK.REQ_HEROES_PRIMARY_CLASS)
|
||||
+ ChatColor.GREEN + ")\n";
|
||||
}
|
||||
case 2:
|
||||
if (context.getSessionData(CK.REQ_HEROES_SECONDARY_CLASS) == null) {
|
||||
return ChatColor.GRAY + " (" + Lang.get("noneSet") + ")";
|
||||
} else {
|
||||
return "(" + ChatColor.AQUA + (String) context.getSessionData(CK.REQ_HEROES_SECONDARY_CLASS)
|
||||
+ ChatColor.GREEN + ")\n";
|
||||
}
|
||||
case 3:
|
||||
return "";
|
||||
default:
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getPromptText(ConversationContext cc) {
|
||||
String text = ChatColor.DARK_GREEN + Lang.get("heroesRequirementsTitle") + "\n";
|
||||
if (cc.getSessionData(CK.REQ_HEROES_PRIMARY_CLASS) == null) {
|
||||
text += ChatColor.BOLD + "" + ChatColor.GREEN + "1" + ChatColor.RESET + ChatColor.GREEN + " - "
|
||||
+ Lang.get("reqHeroesSetPrimary") + " (" + Lang.get("noneSet") + ")\n";
|
||||
} else {
|
||||
text += ChatColor.BOLD + "" + ChatColor.GREEN + "1" + ChatColor.RESET + ChatColor.GREEN + " - "
|
||||
+ Lang.get("reqHeroesSetPrimary") + " (" + ChatColor.AQUA
|
||||
+ (String) cc.getSessionData(CK.REQ_HEROES_PRIMARY_CLASS) + ChatColor.GREEN + ")\n";
|
||||
public String getPromptText(ConversationContext context) {
|
||||
QuestsEditorPostOpenNumericPromptEvent event = new QuestsEditorPostOpenNumericPromptEvent(context, this);
|
||||
context.getPlugin().getServer().getPluginManager().callEvent(event);
|
||||
|
||||
String text = ChatColor.AQUA + "- " + getTitle(context) + " -\n";
|
||||
for (int i = 1; i <= size; i++) {
|
||||
text += getNumberColor(context, i) + "" + ChatColor.BOLD + i + ChatColor.RESET + " - "
|
||||
+ getSelectionText(context, i) + " " + getAdditionalText(context, i) + "\n";
|
||||
}
|
||||
if (cc.getSessionData(CK.REQ_HEROES_SECONDARY_CLASS) == null) {
|
||||
text += ChatColor.BOLD + "" + ChatColor.GREEN + "2" + ChatColor.RESET + ChatColor.GREEN + " - "
|
||||
+ Lang.get("reqHeroesSetSecondary") + " (" + Lang.get("noneSet") + ")\n";
|
||||
} else {
|
||||
text += ChatColor.BOLD + "" + ChatColor.GREEN + "2" + ChatColor.RESET + ChatColor.GREEN + " - "
|
||||
+ Lang.get("reqHeroesSetSecondary") + " (" + ChatColor.AQUA
|
||||
+ (String) cc.getSessionData(CK.REQ_HEROES_SECONDARY_CLASS) + ChatColor.GREEN + ")\n";
|
||||
}
|
||||
text += ChatColor.BOLD + "" + ChatColor.GREEN + "3" + ChatColor.RESET + ChatColor.GREEN + " - "
|
||||
+ Lang.get("done");
|
||||
return text;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Prompt acceptValidatedInput(ConversationContext context, String input) {
|
||||
if (input.equalsIgnoreCase("1")) {
|
||||
return new HeroesPrimaryPrompt();
|
||||
} else if (input.equalsIgnoreCase("2")) {
|
||||
return new HeroesSecondaryPrompt();
|
||||
} else if (input.equalsIgnoreCase("3")) {
|
||||
protected Prompt acceptValidatedInput(ConversationContext context, Number input) {
|
||||
switch(input.intValue()) {
|
||||
case 1:
|
||||
return new HeroesPrimaryPrompt(context);
|
||||
case 2:
|
||||
return new HeroesSecondaryPrompt(context);
|
||||
case 3:
|
||||
return new RequirementsPrompt(context);
|
||||
default:
|
||||
return new RequirementsHeroesListPrompt(context);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
private class HeroesPrimaryPrompt extends StringPrompt {
|
||||
public class HeroesPrimaryPrompt extends QuestsEditorStringPrompt {
|
||||
|
||||
public HeroesPrimaryPrompt(ConversationContext context) {
|
||||
super(context);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getPromptText(ConversationContext cc) {
|
||||
String text = ChatColor.DARK_PURPLE + Lang.get("heroesPrimaryTitle") + "\n";
|
||||
public String getTitle(ConversationContext context) {
|
||||
return Lang.get("heroesPrimaryTitle");
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getQueryText(ConversationContext context) {
|
||||
return Lang.get("reqHeroesPrimaryPrompt");
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getPromptText(ConversationContext context) {
|
||||
QuestsEditorPostOpenStringPromptEvent event = new QuestsEditorPostOpenStringPromptEvent(context, this);
|
||||
context.getPlugin().getServer().getPluginManager().callEvent(event);
|
||||
|
||||
String text = ChatColor.DARK_PURPLE + getTitle(context) + "\n";
|
||||
LinkedList<String> list = new LinkedList<String>();
|
||||
for (HeroClass hc : plugin.getDependencies().getHeroes().getClassManager().getClasses()) {
|
||||
if (hc.isPrimary()) {
|
||||
@ -1129,44 +1376,61 @@ public class RequirementsPrompt extends QuestsEditorNumericPrompt {
|
||||
text += ChatColor.DARK_PURPLE + "- " + ChatColor.LIGHT_PURPLE + s + "\n";
|
||||
}
|
||||
}
|
||||
text += ChatColor.YELLOW + Lang.get("reqHeroesPrimaryPrompt");
|
||||
text += ChatColor.YELLOW + getQueryText(context);
|
||||
return text;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Prompt acceptInput(ConversationContext cc, String input) {
|
||||
public Prompt acceptInput(ConversationContext context, String input) {
|
||||
if (input.equalsIgnoreCase(Lang.get("cmdClear")) == false
|
||||
&& input.equalsIgnoreCase(Lang.get("cmdCancel")) == false) {
|
||||
HeroClass hc = plugin.getDependencies().getHeroes().getClassManager().getClass(input);
|
||||
if (hc != null) {
|
||||
if (hc.isPrimary()) {
|
||||
cc.setSessionData(CK.REQ_HEROES_PRIMARY_CLASS, hc.getName());
|
||||
return new HeroesPrompt();
|
||||
context.setSessionData(CK.REQ_HEROES_PRIMARY_CLASS, hc.getName());
|
||||
return new RequirementsHeroesListPrompt(context);
|
||||
} else {
|
||||
String text = Lang.get("reqHeroesNotPrimary");
|
||||
text = text.replace("<class>", ChatColor.LIGHT_PURPLE + hc.getName() + ChatColor.RED);
|
||||
cc.getForWhom().sendRawMessage(ChatColor.RED + text);
|
||||
return new HeroesPrimaryPrompt();
|
||||
context.getForWhom().sendRawMessage(ChatColor.RED + text);
|
||||
return new HeroesPrimaryPrompt(context);
|
||||
}
|
||||
} else {
|
||||
cc.getForWhom().sendRawMessage(ChatColor.RED + Lang.get("reqHeroesClassNotFound"));
|
||||
return new HeroesPrimaryPrompt();
|
||||
context.getForWhom().sendRawMessage(ChatColor.RED + Lang.get("reqHeroesClassNotFound"));
|
||||
return new HeroesPrimaryPrompt(context);
|
||||
}
|
||||
} else if (input.equalsIgnoreCase(Lang.get("cmdClear"))) {
|
||||
cc.setSessionData(CK.REQ_HEROES_PRIMARY_CLASS, null);
|
||||
cc.getForWhom().sendRawMessage(ChatColor.YELLOW + Lang.get("reqHeroesPrimaryCleared"));
|
||||
return new HeroesPrompt();
|
||||
context.setSessionData(CK.REQ_HEROES_PRIMARY_CLASS, null);
|
||||
context.getForWhom().sendRawMessage(ChatColor.YELLOW + Lang.get("reqHeroesPrimaryCleared"));
|
||||
return new RequirementsHeroesListPrompt(context);
|
||||
} else {
|
||||
return new HeroesPrompt();
|
||||
return new RequirementsHeroesListPrompt(context);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private class HeroesSecondaryPrompt extends StringPrompt {
|
||||
public class HeroesSecondaryPrompt extends QuestsEditorStringPrompt {
|
||||
|
||||
public HeroesSecondaryPrompt(ConversationContext context) {
|
||||
super(context);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getPromptText(ConversationContext cc) {
|
||||
String text = ChatColor.DARK_PURPLE + Lang.get("heroesSecondaryTitle") + "\n";
|
||||
public String getTitle(ConversationContext context) {
|
||||
return Lang.get("heroesSecondaryTitle");
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getQueryText(ConversationContext context) {
|
||||
return Lang.get("reqHeroesSecondaryPrompt");
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getPromptText(ConversationContext context) {
|
||||
QuestsEditorPostOpenStringPromptEvent event = new QuestsEditorPostOpenStringPromptEvent(context, this);
|
||||
context.getPlugin().getServer().getPluginManager().callEvent(event);
|
||||
|
||||
String text = ChatColor.DARK_PURPLE + getTitle(context) + "\n";
|
||||
LinkedList<String> list = new LinkedList<String>();
|
||||
for (HeroClass hc : plugin.getDependencies().getHeroes().getClassManager().getClasses()) {
|
||||
if (hc.isSecondary()) {
|
||||
@ -1181,35 +1445,35 @@ public class RequirementsPrompt extends QuestsEditorNumericPrompt {
|
||||
text += ChatColor.DARK_PURPLE + "- " + ChatColor.LIGHT_PURPLE + s + "\n";
|
||||
}
|
||||
}
|
||||
text += ChatColor.YELLOW + Lang.get("reqHeroesSecondaryPrompt");
|
||||
text += ChatColor.YELLOW + getQueryText(context);
|
||||
return text;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Prompt acceptInput(ConversationContext cc, String input) {
|
||||
public Prompt acceptInput(ConversationContext context, String input) {
|
||||
if (input.equalsIgnoreCase(Lang.get("cmdClear")) == false
|
||||
&& input.equalsIgnoreCase(Lang.get("cmdCancel")) == false) {
|
||||
HeroClass hc = plugin.getDependencies().getHeroes().getClassManager().getClass(input);
|
||||
if (hc != null) {
|
||||
if (hc.isSecondary()) {
|
||||
cc.setSessionData(CK.REQ_HEROES_SECONDARY_CLASS, hc.getName());
|
||||
return new HeroesPrompt();
|
||||
context.setSessionData(CK.REQ_HEROES_SECONDARY_CLASS, hc.getName());
|
||||
return new RequirementsHeroesListPrompt(context);
|
||||
} else {
|
||||
String text = Lang.get("reqHeroesNotSecondary");
|
||||
text = text.replace("<class>", ChatColor.LIGHT_PURPLE + hc.getName() + ChatColor.RED);
|
||||
cc.getForWhom().sendRawMessage(ChatColor.RED + text);
|
||||
return new HeroesSecondaryPrompt();
|
||||
context.getForWhom().sendRawMessage(ChatColor.RED + text);
|
||||
return new HeroesSecondaryPrompt(context);
|
||||
}
|
||||
} else {
|
||||
cc.getForWhom().sendRawMessage(ChatColor.RED + Lang.get("reqHeroesClassNotFound"));
|
||||
return new HeroesSecondaryPrompt();
|
||||
context.getForWhom().sendRawMessage(ChatColor.RED + Lang.get("reqHeroesClassNotFound"));
|
||||
return new HeroesSecondaryPrompt(context);
|
||||
}
|
||||
} else if (input.equalsIgnoreCase(Lang.get("clear"))) {
|
||||
cc.setSessionData(CK.REQ_HEROES_SECONDARY_CLASS, null);
|
||||
cc.getForWhom().sendRawMessage(ChatColor.YELLOW + Lang.get("reqHeroesSecondaryCleared"));
|
||||
return new HeroesPrompt();
|
||||
context.setSessionData(CK.REQ_HEROES_SECONDARY_CLASS, null);
|
||||
context.getForWhom().sendRawMessage(ChatColor.YELLOW + Lang.get("reqHeroesSecondaryCleared"));
|
||||
return new RequirementsHeroesListPrompt(context);
|
||||
} else {
|
||||
return new HeroesPrompt();
|
||||
return new RequirementsHeroesListPrompt(context);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue
Block a user