mirror of
https://github.com/PikaMug/Quests.git
synced 2024-11-28 13:45:32 +01:00
Improve menu consistency
This commit is contained in:
parent
e996f73b10
commit
7405d4b7f4
@ -314,7 +314,7 @@ public class Event {
|
|||||||
String eventKey = "events." + name + ".";
|
String eventKey = "events." + name + ".";
|
||||||
event.name = name;
|
event.name = name;
|
||||||
if (data.contains(eventKey + "message")) {
|
if (data.contains(eventKey + "message")) {
|
||||||
event.message = data.getString(eventKey + "message");
|
event.message = Quests.parseString(data.getString(eventKey + "message"));
|
||||||
}
|
}
|
||||||
if (data.contains(eventKey + "clear-inventory")) {
|
if (data.contains(eventKey + "clear-inventory")) {
|
||||||
if (data.isBoolean(eventKey + "clear-inventory")) {
|
if (data.isBoolean(eventKey + "clear-inventory")) {
|
||||||
|
@ -290,7 +290,7 @@ public class EventFactory implements ConversationAbandonedListener {
|
|||||||
public Prompt acceptInput(ConversationContext context, String input) {
|
public Prompt acceptInput(ConversationContext context, String input) {
|
||||||
if (input.equalsIgnoreCase(Lang.get("cmdCancel")) == false) {
|
if (input.equalsIgnoreCase(Lang.get("cmdCancel")) == false) {
|
||||||
for (Event evt : quests.events) {
|
for (Event evt : quests.events) {
|
||||||
if (evt.name.equalsIgnoreCase(input)) {
|
if (evt.name.toLowerCase().startsWith(input.toLowerCase())) {
|
||||||
context.setSessionData(CK.E_OLD_EVENT, evt.name);
|
context.setSessionData(CK.E_OLD_EVENT, evt.name);
|
||||||
context.setSessionData(CK.E_NAME, evt.name);
|
context.setSessionData(CK.E_NAME, evt.name);
|
||||||
loadData(evt, context);
|
loadData(evt, context);
|
||||||
@ -389,7 +389,7 @@ public class EventFactory implements ConversationAbandonedListener {
|
|||||||
if (context.getSessionData(CK.E_MESSAGE) == null) {
|
if (context.getSessionData(CK.E_MESSAGE) == null) {
|
||||||
text += ChatColor.BLUE + "" + ChatColor.BOLD + "2" + ChatColor.RESET + ChatColor.YELLOW + " - " + Lang.get("eventEditorSetMessage") + ChatColor.GRAY + " (" + Lang.get("noneSet") + ")\n";
|
text += ChatColor.BLUE + "" + ChatColor.BOLD + "2" + ChatColor.RESET + ChatColor.YELLOW + " - " + Lang.get("eventEditorSetMessage") + ChatColor.GRAY + " (" + Lang.get("noneSet") + ")\n";
|
||||||
} else {
|
} else {
|
||||||
text += ChatColor.BLUE + "" + ChatColor.BOLD + "2" + ChatColor.RESET + ChatColor.YELLOW + " - " + Lang.get("eventEditorSetMessage") + "(" + ChatColor.AQUA + "\"" + context.getSessionData(CK.E_MESSAGE) + "\"" + ChatColor.YELLOW + ")\n";
|
text += ChatColor.BLUE + "" + ChatColor.BOLD + "2" + ChatColor.RESET + ChatColor.YELLOW + " - " + Lang.get("eventEditorSetMessage") + " (" + ChatColor.AQUA + context.getSessionData(CK.E_MESSAGE) + ChatColor.RESET + ChatColor.YELLOW + ")\n";
|
||||||
}
|
}
|
||||||
if (context.getSessionData(CK.E_CLEAR_INVENTORY) == null) {
|
if (context.getSessionData(CK.E_CLEAR_INVENTORY) == null) {
|
||||||
context.setSessionData(CK.E_CLEAR_INVENTORY, "No");
|
context.setSessionData(CK.E_CLEAR_INVENTORY, "No");
|
||||||
|
@ -148,12 +148,12 @@ public class QuestFactory implements ConversationAbandonedListener {
|
|||||||
if (context.getSessionData(CK.Q_ASK_MESSAGE) == null) {
|
if (context.getSessionData(CK.Q_ASK_MESSAGE) == null) {
|
||||||
text += ChatColor.BLUE + "" + ChatColor.BOLD + "2" + ChatColor.RESET + ChatColor.RED + " - " + Lang.get("questEditorAskMessage") + " " + ChatColor.DARK_RED + "(" + Lang.get("questRequiredNoneSet") + ")\n";
|
text += ChatColor.BLUE + "" + ChatColor.BOLD + "2" + ChatColor.RESET + ChatColor.RED + " - " + Lang.get("questEditorAskMessage") + " " + ChatColor.DARK_RED + "(" + Lang.get("questRequiredNoneSet") + ")\n";
|
||||||
} else {
|
} else {
|
||||||
text += ChatColor.BLUE + "" + ChatColor.BOLD + "2" + ChatColor.RESET + ChatColor.YELLOW + " - " + Lang.get("questEditorAskMessage") + " (\"" + context.getSessionData(CK.Q_ASK_MESSAGE) + "\")\n";
|
text += ChatColor.BLUE + "" + ChatColor.BOLD + "2" + ChatColor.RESET + ChatColor.YELLOW + " - " + Lang.get("questEditorAskMessage") + " (" + context.getSessionData(CK.Q_ASK_MESSAGE) + ChatColor.RESET + ChatColor.YELLOW + ")\n";
|
||||||
}
|
}
|
||||||
if (context.getSessionData(CK.Q_FINISH_MESSAGE) == null) {
|
if (context.getSessionData(CK.Q_FINISH_MESSAGE) == null) {
|
||||||
text += ChatColor.BLUE + "" + ChatColor.BOLD + "3" + ChatColor.RESET + ChatColor.RED + " - " + Lang.get("questEditorFinishMessage") + " " + ChatColor.DARK_RED + "(" + Lang.get("questRequiredNoneSet") + ")\n";
|
text += ChatColor.BLUE + "" + ChatColor.BOLD + "3" + ChatColor.RESET + ChatColor.RED + " - " + Lang.get("questEditorFinishMessage") + " " + ChatColor.DARK_RED + "(" + Lang.get("questRequiredNoneSet") + ")\n";
|
||||||
} else {
|
} else {
|
||||||
text += ChatColor.BLUE + "" + ChatColor.BOLD + "3" + ChatColor.RESET + ChatColor.YELLOW + " - " + Lang.get("questEditorFinishMessage") + " (\"" + context.getSessionData(CK.Q_FINISH_MESSAGE) + "\")\n";
|
text += ChatColor.BLUE + "" + ChatColor.BOLD + "3" + ChatColor.RESET + ChatColor.YELLOW + " - " + Lang.get("questEditorFinishMessage") + " (" + context.getSessionData(CK.Q_FINISH_MESSAGE) + ChatColor.RESET + ChatColor.YELLOW + ")\n";
|
||||||
}
|
}
|
||||||
if (context.getSessionData(CK.Q_START_NPC) == null && Quests.citizens != null) {
|
if (context.getSessionData(CK.Q_START_NPC) == null && Quests.citizens != null) {
|
||||||
text += ChatColor.BLUE + "" + ChatColor.BOLD + "4" + ChatColor.RESET + ChatColor.YELLOW + " - " + Lang.get("questEditorNPCStart") + " (" + Lang.get("noneSet") + ")\n";
|
text += ChatColor.BLUE + "" + ChatColor.BOLD + "4" + ChatColor.RESET + ChatColor.YELLOW + " - " + Lang.get("questEditorNPCStart") + " (" + Lang.get("noneSet") + ")\n";
|
||||||
@ -193,7 +193,7 @@ public class QuestFactory implements ConversationAbandonedListener {
|
|||||||
text += ChatColor.GRAY + "8 - " + Lang.get("questEditorSetGUI") + " (" + Lang.get("questCitNotInstalled") + ")\n";
|
text += ChatColor.GRAY + "8 - " + Lang.get("questEditorSetGUI") + " (" + Lang.get("questCitNotInstalled") + ")\n";
|
||||||
}
|
}
|
||||||
text += ChatColor.BLUE + "" + ChatColor.BOLD + "9" + ChatColor.RESET + ChatColor.DARK_AQUA + " - " + Lang.get("questEditorReqs") + "\n";
|
text += ChatColor.BLUE + "" + ChatColor.BOLD + "9" + ChatColor.RESET + ChatColor.DARK_AQUA + " - " + Lang.get("questEditorReqs") + "\n";
|
||||||
text += ChatColor.BLUE + "" + ChatColor.BOLD + "10" + ChatColor.RESET + ChatColor.DARK_PURPLE + " - " + Lang.get("questEditorPln") + " **WIP**" + "\n";
|
text += ChatColor.BLUE + "" + ChatColor.BOLD + "10" + ChatColor.RESET + ChatColor.AQUA + " - " + Lang.get("questEditorPln") + " **WIP**" + "\n";
|
||||||
text += ChatColor.BLUE + "" + ChatColor.BOLD + "11" + ChatColor.RESET + ChatColor.LIGHT_PURPLE + " - " + Lang.get("questEditorStages") + "\n";
|
text += ChatColor.BLUE + "" + ChatColor.BOLD + "11" + ChatColor.RESET + ChatColor.LIGHT_PURPLE + " - " + Lang.get("questEditorStages") + "\n";
|
||||||
text += ChatColor.BLUE + "" + ChatColor.BOLD + "12" + ChatColor.RESET + ChatColor.GREEN + " - " + Lang.get("questEditorRews") + "\n";
|
text += ChatColor.BLUE + "" + ChatColor.BOLD + "12" + ChatColor.RESET + ChatColor.GREEN + " - " + Lang.get("questEditorRews") + "\n";
|
||||||
text += ChatColor.BLUE + "" + ChatColor.BOLD + "13" + ChatColor.RESET + ChatColor.GOLD + " - " + Lang.get("save") + "\n";
|
text += ChatColor.BLUE + "" + ChatColor.BOLD + "13" + ChatColor.RESET + ChatColor.GOLD + " - " + Lang.get("save") + "\n";
|
||||||
|
@ -1,5 +1,8 @@
|
|||||||
package me.blackvein.quests.prompts;
|
package me.blackvein.quests.prompts;
|
||||||
|
|
||||||
|
import java.util.Locale;
|
||||||
|
import java.util.TimeZone;
|
||||||
|
|
||||||
import me.blackvein.quests.util.Lang;
|
import me.blackvein.quests.util.Lang;
|
||||||
|
|
||||||
import org.bukkit.ChatColor;
|
import org.bukkit.ChatColor;
|
||||||
@ -20,6 +23,34 @@ public class DateTimePrompt extends FixedSetPrompt {
|
|||||||
@Override
|
@Override
|
||||||
public String getPromptText(ConversationContext cc) {
|
public String getPromptText(ConversationContext cc) {
|
||||||
String menu = ChatColor.YELLOW + Lang.get("dateTimeTitle") + "\n";
|
String menu = ChatColor.YELLOW + Lang.get("dateTimeTitle") + "\n";
|
||||||
|
String dateData = "";
|
||||||
|
if (cc.getSessionData("tempDay") != null) {
|
||||||
|
dateData += (String) cc.getSessionData("tempDay") + "/";
|
||||||
|
}
|
||||||
|
if (cc.getSessionData("tempMonth") != null) {
|
||||||
|
dateData += (String) cc.getSessionData("tempMonth") + "/";
|
||||||
|
}
|
||||||
|
if (cc.getSessionData("tempYear") != null) {
|
||||||
|
dateData += (String) cc.getSessionData("tempYear") + " ";
|
||||||
|
}
|
||||||
|
if (cc.getSessionData("tempHour") != null) {
|
||||||
|
dateData += (String) cc.getSessionData("tempHour") + ":";
|
||||||
|
}
|
||||||
|
if (cc.getSessionData("tempMinute") != null) {
|
||||||
|
dateData += (String) cc.getSessionData("tempMinute") + ":";
|
||||||
|
}
|
||||||
|
if (cc.getSessionData("tempSecond") != null) {
|
||||||
|
dateData += (String) cc.getSessionData("tempSecond") + " ";
|
||||||
|
}
|
||||||
|
if (cc.getSessionData("tempZone") == null) {
|
||||||
|
cc.setSessionData("tempZone", TimeZone.getDefault().getID());
|
||||||
|
}
|
||||||
|
TimeZone tz = TimeZone.getTimeZone((String) cc.getSessionData("tempZone"));
|
||||||
|
//TODO - CHANGE CURRENT SYSTEM TIME TO USER-SPECIFIED DATE
|
||||||
|
dateData += tz.getOffset(System.currentTimeMillis() / 1000 / 60) + " (" + tz.getID() + ")" + " test - " + tz.getDisplayName(Locale.FRENCH);
|
||||||
|
if (dateData != null) {
|
||||||
|
menu += dateData + "\n";
|
||||||
|
}
|
||||||
menu += ChatColor.YELLOW + "" + ChatColor.BOLD + "1. " + ChatColor.RESET + "" + ChatColor.GOLD + Lang.get("timeDay") + "\n";
|
menu += ChatColor.YELLOW + "" + ChatColor.BOLD + "1. " + ChatColor.RESET + "" + ChatColor.GOLD + Lang.get("timeDay") + "\n";
|
||||||
menu += ChatColor.YELLOW + "" + ChatColor.BOLD + "2. " + ChatColor.RESET + "" + ChatColor.GOLD + Lang.get("timeMonth") + "\n";
|
menu += ChatColor.YELLOW + "" + ChatColor.BOLD + "2. " + ChatColor.RESET + "" + ChatColor.GOLD + Lang.get("timeMonth") + "\n";
|
||||||
menu += ChatColor.YELLOW + "" + ChatColor.BOLD + "3. " + ChatColor.RESET + "" + ChatColor.GOLD + Lang.get("timeYear") + "\n";
|
menu += ChatColor.YELLOW + "" + ChatColor.BOLD + "3. " + ChatColor.RESET + "" + ChatColor.GOLD + Lang.get("timeYear") + "\n";
|
||||||
@ -63,7 +94,7 @@ public class DateTimePrompt extends FixedSetPrompt {
|
|||||||
int hour = (Integer) cc.getSessionData("tempHour");
|
int hour = (Integer) cc.getSessionData("tempHour");
|
||||||
int minute = (Integer) cc.getSessionData("tempMinute");
|
int minute = (Integer) cc.getSessionData("tempMinute");
|
||||||
int second = (Integer) cc.getSessionData("tempSecond");
|
int second = (Integer) cc.getSessionData("tempSecond");
|
||||||
int zone = (Integer) 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;
|
||||||
cc.setSessionData("tempDate", date);
|
cc.setSessionData("tempDate", date);
|
||||||
@ -94,7 +125,7 @@ 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 ItemStackPrompt(oldPrompt);
|
return new DateTimePrompt(oldPrompt);
|
||||||
}
|
}
|
||||||
} catch (NumberFormatException e) {
|
} catch (NumberFormatException e) {
|
||||||
cc.getForWhom().sendRawMessage(ChatColor.RED + Lang.get("itemCreateInvalidInput"));
|
cc.getForWhom().sendRawMessage(ChatColor.RED + Lang.get("itemCreateInvalidInput"));
|
||||||
|
@ -67,9 +67,11 @@ public class PlannerPrompt extends FixedSetPrompt {
|
|||||||
@Override
|
@Override
|
||||||
protected Prompt acceptValidatedInput(ConversationContext context, String input) {
|
protected Prompt acceptValidatedInput(ConversationContext context, String input) {
|
||||||
if (input.equalsIgnoreCase("1")) {
|
if (input.equalsIgnoreCase("1")) {
|
||||||
return new StartPrompt();
|
//return new StartPrompt();
|
||||||
|
return new DateTimePrompt(PlannerPrompt.this);
|
||||||
} else if (input.equalsIgnoreCase("2")) {
|
} else if (input.equalsIgnoreCase("2")) {
|
||||||
return new EndPrompt();
|
//return new EndPrompt();
|
||||||
|
return new DateTimePrompt(PlannerPrompt.this);
|
||||||
} else if (input.equalsIgnoreCase("3")) {
|
} else if (input.equalsIgnoreCase("3")) {
|
||||||
return new RepeatPrompt();
|
return new RepeatPrompt();
|
||||||
} else if (input.equalsIgnoreCase("4")) {
|
} else if (input.equalsIgnoreCase("4")) {
|
||||||
@ -80,7 +82,7 @@ public class PlannerPrompt extends FixedSetPrompt {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
private class StartPrompt extends StringPrompt {
|
/*private class StartPrompt extends StringPrompt {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getPromptText(ConversationContext context) {
|
public String getPromptText(ConversationContext context) {
|
||||||
@ -146,7 +148,7 @@ public class PlannerPrompt extends FixedSetPrompt {
|
|||||||
}
|
}
|
||||||
return new PlannerPrompt(quests, factory);
|
return new PlannerPrompt(quests, factory);
|
||||||
}
|
}
|
||||||
}
|
}*/
|
||||||
|
|
||||||
private class RepeatPrompt extends StringPrompt {
|
private class RepeatPrompt extends StringPrompt {
|
||||||
|
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
quests:
|
quests:
|
||||||
Miner:
|
Miner:
|
||||||
name: 'Stone Miner'
|
name: 'Stone Miner'
|
||||||
ask-message: '<yellow>Mine <purple>10<yellow> blocks of <purple>Stone<yellow> and gather the <purple>10 pieces of <purple>Cobblestone<yellow>.'
|
ask-message: '<yellow>Mine <pink>10<yellow> blocks of <pink>Stone<yellow> and gather the <pink>10 pieces of <pink>Cobblestone<yellow>.'
|
||||||
finish-message: '<yellow>Well done. Here is your reward.'
|
finish-message: '<yellow>Well done. Here is your reward.'
|
||||||
redo-delay: 1800
|
redo-delay: 1800
|
||||||
requirements:
|
requirements:
|
||||||
@ -10,7 +10,7 @@ quests:
|
|||||||
- name-wood_pickaxe:amount-1
|
- name-wood_pickaxe:amount-1
|
||||||
remove-items:
|
remove-items:
|
||||||
- false
|
- false
|
||||||
fail-requirement-message: '<red>You must have a <purple>Wooden Pickaxe<red> first.'
|
fail-requirement-message: '<red>You must have a <pink>Wooden Pickaxe<red> first.'
|
||||||
stages:
|
stages:
|
||||||
ordered:
|
ordered:
|
||||||
1:
|
1:
|
||||||
@ -26,11 +26,11 @@ quests:
|
|||||||
Hunter:
|
Hunter:
|
||||||
name: 'Mob Hunter'
|
name: 'Mob Hunter'
|
||||||
ask-message: '<yellow>Kill an assortment of Mobs.'
|
ask-message: '<yellow>Kill an assortment of Mobs.'
|
||||||
finish-message: '<yellow>Excellent. Here is a <purple>Diamond Sword<yellow>.'
|
finish-message: '<yellow>Excellent. Here is a <pink>Diamond Sword<yellow>.'
|
||||||
requirements:
|
requirements:
|
||||||
quests:
|
quests:
|
||||||
- Stone Miner
|
- Stone Miner
|
||||||
fail-requirement-message: '<red>Complete <purple>Stone Miner<red> first.'
|
fail-requirement-message: '<red>Complete <pink>Stone Miner<red> first.'
|
||||||
stages:
|
stages:
|
||||||
ordered:
|
ordered:
|
||||||
1:
|
1:
|
||||||
@ -65,7 +65,7 @@ quests:
|
|||||||
requirements:
|
requirements:
|
||||||
quests:
|
quests:
|
||||||
- Stone Miner
|
- Stone Miner
|
||||||
fail-requirement-message: '<red>Complete <purple>Stone Miner<red> first.'
|
fail-requirement-message: '<red>Complete <pink>Stone Miner<red> first.'
|
||||||
stages:
|
stages:
|
||||||
ordered:
|
ordered:
|
||||||
1:
|
1:
|
||||||
@ -80,8 +80,8 @@ quests:
|
|||||||
exp: 250
|
exp: 250
|
||||||
TimedQuest:
|
TimedQuest:
|
||||||
name: 'Timed Quest'
|
name: 'Timed Quest'
|
||||||
ask-message: '<yellow>Dig up <purple>10<yellow> blocks of <purple>Dirt<yellow> before time runs out!'
|
ask-message: '<yellow>Dig up <pink>10<yellow> blocks of <pink>Dirt<yellow> before time runs out!'
|
||||||
finish-message: '<yellow>You did it in time! Have an <purple>Iron Shovel<yellow> and some <green>experience<yellow>.'
|
finish-message: '<yellow>You did it in time! Have an <pink>Iron Shovel<yellow> and some <green>experience<yellow>.'
|
||||||
stages:
|
stages:
|
||||||
ordered:
|
ordered:
|
||||||
'1':
|
'1':
|
||||||
|
Loading…
Reference in New Issue
Block a user