Improve menu consistency

This commit is contained in:
HappyPikachu 2018-03-23 01:07:53 -04:00
parent e996f73b10
commit 7405d4b7f4
6 changed files with 52 additions and 19 deletions

View File

@ -314,7 +314,7 @@ public class Event {
String eventKey = "events." + name + ".";
event.name = name;
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.isBoolean(eventKey + "clear-inventory")) {

View File

@ -290,7 +290,7 @@ public class EventFactory implements ConversationAbandonedListener {
public Prompt acceptInput(ConversationContext context, String input) {
if (input.equalsIgnoreCase(Lang.get("cmdCancel")) == false) {
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_NAME, evt.name);
loadData(evt, context);
@ -389,7 +389,7 @@ public class EventFactory implements ConversationAbandonedListener {
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";
} 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) {
context.setSessionData(CK.E_CLEAR_INVENTORY, "No");

View File

@ -148,12 +148,12 @@ public class QuestFactory implements ConversationAbandonedListener {
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";
} 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) {
text += ChatColor.BLUE + "" + ChatColor.BOLD + "3" + ChatColor.RESET + ChatColor.RED + " - " + Lang.get("questEditorFinishMessage") + " " + ChatColor.DARK_RED + "(" + Lang.get("questRequiredNoneSet") + ")\n";
} 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) {
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.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 + "12" + ChatColor.RESET + ChatColor.GREEN + " - " + Lang.get("questEditorRews") + "\n";
text += ChatColor.BLUE + "" + ChatColor.BOLD + "13" + ChatColor.RESET + ChatColor.GOLD + " - " + Lang.get("save") + "\n";

View File

@ -1,5 +1,8 @@
package me.blackvein.quests.prompts;
import java.util.Locale;
import java.util.TimeZone;
import me.blackvein.quests.util.Lang;
import org.bukkit.ChatColor;
@ -20,6 +23,34 @@ public class DateTimePrompt extends FixedSetPrompt {
@Override
public String getPromptText(ConversationContext cc) {
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 + "2. " + ChatColor.RESET + "" + ChatColor.GOLD + Lang.get("timeMonth") + "\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 minute = (Integer) cc.getSessionData("tempMinute");
int second = (Integer) cc.getSessionData("tempSecond");
int zone = (Integer) cc.getSessionData("tempZone");
String zone = (String) cc.getSessionData("tempZone");
String date = day + ":" + month + ":" + year + ":"
+ hour + ":" + minute + ":" + second + ":" + zone;
cc.setSessionData("tempDate", date);
@ -94,7 +125,7 @@ public class DateTimePrompt extends FixedSetPrompt {
return new DayPrompt();
} else {
cc.setSessionData("tempDay", Integer.parseInt(input));
return new ItemStackPrompt(oldPrompt);
return new DateTimePrompt(oldPrompt);
}
} catch (NumberFormatException e) {
cc.getForWhom().sendRawMessage(ChatColor.RED + Lang.get("itemCreateInvalidInput"));

View File

@ -67,9 +67,11 @@ public class PlannerPrompt extends FixedSetPrompt {
@Override
protected Prompt acceptValidatedInput(ConversationContext context, String input) {
if (input.equalsIgnoreCase("1")) {
return new StartPrompt();
//return new StartPrompt();
return new DateTimePrompt(PlannerPrompt.this);
} else if (input.equalsIgnoreCase("2")) {
return new EndPrompt();
//return new EndPrompt();
return new DateTimePrompt(PlannerPrompt.this);
} else if (input.equalsIgnoreCase("3")) {
return new RepeatPrompt();
} else if (input.equalsIgnoreCase("4")) {
@ -80,7 +82,7 @@ public class PlannerPrompt extends FixedSetPrompt {
return null;
}
private class StartPrompt extends StringPrompt {
/*private class StartPrompt extends StringPrompt {
@Override
public String getPromptText(ConversationContext context) {
@ -146,7 +148,7 @@ public class PlannerPrompt extends FixedSetPrompt {
}
return new PlannerPrompt(quests, factory);
}
}
}*/
private class RepeatPrompt extends StringPrompt {

View File

@ -2,7 +2,7 @@
quests:
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.'
redo-delay: 1800
requirements:
@ -10,7 +10,7 @@ quests:
- name-wood_pickaxe:amount-1
remove-items:
- 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:
ordered:
1:
@ -26,11 +26,11 @@ quests:
Hunter:
name: 'Mob Hunter'
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:
quests:
- Stone Miner
fail-requirement-message: '<red>Complete <purple>Stone Miner<red> first.'
fail-requirement-message: '<red>Complete <pink>Stone Miner<red> first.'
stages:
ordered:
1:
@ -65,7 +65,7 @@ quests:
requirements:
quests:
- Stone Miner
fail-requirement-message: '<red>Complete <purple>Stone Miner<red> first.'
fail-requirement-message: '<red>Complete <pink>Stone Miner<red> first.'
stages:
ordered:
1:
@ -80,8 +80,8 @@ quests:
exp: 250
TimedQuest:
name: 'Timed Quest'
ask-message: '<yellow>Dig up <purple>10<yellow> blocks of <purple>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>.'
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 <pink>Iron Shovel<yellow> and some <green>experience<yellow>.'
stages:
ordered:
'1':