NEW date/time Planner section, part 4, #93

This commit is contained in:
HappyPikachu 2018-03-29 03:25:35 -04:00
parent e793661a3a
commit a5729b4ba0
4 changed files with 125 additions and 129 deletions

View File

@ -7,6 +7,7 @@ import java.util.Locale;
import java.util.TimeZone; import java.util.TimeZone;
import me.blackvein.quests.Quests; import me.blackvein.quests.Quests;
import me.blackvein.quests.util.CK;
import me.blackvein.quests.util.Lang; import me.blackvein.quests.util.Lang;
import org.bukkit.ChatColor; import org.bukkit.ChatColor;
@ -19,11 +20,13 @@ public class DateTimePrompt extends FixedSetPrompt {
Quests quests; Quests quests;
final Prompt oldPrompt; final Prompt oldPrompt;
String source = "";
public DateTimePrompt(Quests plugin, Prompt old) { public DateTimePrompt(Quests plugin, Prompt old, String origin) {
super("0", "1", "2", "3", "4", "5", "6", "7", "8"); super("0", "1", "2", "3", "4", "5", "6", "7", "8", "9");
quests = plugin; quests = plugin;
oldPrompt = old; oldPrompt = old;
source = origin;
} }
@Override @Override
@ -68,7 +71,7 @@ public class DateTimePrompt extends FixedSetPrompt {
String[] sep = String.valueOf(hour).replace("-", "").split("\\."); String[] sep = String.valueOf(hour).replace("-", "").split("\\.");
DecimalFormat zoneFormat = new DecimalFormat("00"); DecimalFormat zoneFormat = new DecimalFormat("00");
dateData += ChatColor.LIGHT_PURPLE + "UTC" + (hour < 0 ? "-":"+") + zoneFormat.format(Integer.valueOf(sep[0])) + ":" + zoneFormat.format(Integer.valueOf(sep[1])) dateData += ChatColor.LIGHT_PURPLE + "UTC" + (hour < 0 ? "-":"+") + zoneFormat.format(Integer.valueOf(sep[0])) + ":" + zoneFormat.format(Integer.valueOf(sep[1]))
+ ChatColor.RED + " (" + cal.getTimeZone().getDisplayName(loc) + ")"; + ChatColor.GREEN + " (" + cal.getTimeZone().getDisplayName(loc) + ")";
if (dateData != null) { if (dateData != null) {
menu += dateData + "\n"; menu += dateData + "\n";
} }
@ -100,7 +103,7 @@ public class DateTimePrompt extends FixedSetPrompt {
} else if (input.equalsIgnoreCase("6")) { } else if (input.equalsIgnoreCase("6")) {
return new SecondPrompt(); return new SecondPrompt();
} else if (input.equalsIgnoreCase("7")) { } else if (input.equalsIgnoreCase("7")) {
return new ZonePrompt(); return new OffsetPrompt();
} else if (input.equalsIgnoreCase("8")) { } else if (input.equalsIgnoreCase("8")) {
cc.setSessionData("tempDay", null); cc.setSessionData("tempDay", null);
cc.setSessionData("tempMonth", null); cc.setSessionData("tempMonth", null);
@ -119,7 +122,11 @@ public class DateTimePrompt extends FixedSetPrompt {
String zone = (String) cc.getSessionData("tempZone"); String zone = (String) cc.getSessionData("tempZone");
String date = day + ":" + month + ":" + year + ":" String date = day + ":" + month + ":" + year + ":"
+ hour + ":" + minute + ":" + second + ":" + zone; + hour + ":" + minute + ":" + second + ":" + zone;
cc.setSessionData("tempDate", date); if (source.equals("start")) {
cc.setSessionData(CK.PLN_START_DATE, date);
} else if (source.equals("end")) {
cc.setSessionData(CK.PLN_END_DATE, date);
}
} }
try { try {
return oldPrompt; return oldPrompt;
@ -147,14 +154,14 @@ public class DateTimePrompt extends FixedSetPrompt {
return new DayPrompt(); return new DayPrompt();
} else { } else {
cc.setSessionData("tempDay", Integer.parseInt(input)); cc.setSessionData("tempDay", Integer.parseInt(input));
return new DateTimePrompt(quests, oldPrompt); return new DateTimePrompt(quests, oldPrompt, source);
} }
} catch (NumberFormatException e) { } catch (NumberFormatException e) {
cc.getForWhom().sendRawMessage(ChatColor.RED + Lang.get("itemCreateInvalidInput")); cc.getForWhom().sendRawMessage(ChatColor.RED + Lang.get("itemCreateInvalidInput"));
return new DayPrompt(); return new DayPrompt();
} }
} else { } else {
return new DateTimePrompt(quests, oldPrompt); return new DateTimePrompt(quests, oldPrompt, source);
} }
} }
} }
@ -177,14 +184,14 @@ public class DateTimePrompt extends FixedSetPrompt {
return new MonthPrompt(); return new MonthPrompt();
} else { } else {
cc.setSessionData("tempMonth", Integer.parseInt(input) - 1); cc.setSessionData("tempMonth", Integer.parseInt(input) - 1);
return new DateTimePrompt(quests, oldPrompt); return new DateTimePrompt(quests, oldPrompt, source);
} }
} catch (NumberFormatException e) { } catch (NumberFormatException e) {
cc.getForWhom().sendRawMessage(ChatColor.RED + Lang.get("itemCreateInvalidInput")); cc.getForWhom().sendRawMessage(ChatColor.RED + Lang.get("itemCreateInvalidInput"));
return new MonthPrompt(); return new MonthPrompt();
} }
} else { } else {
return new DateTimePrompt(quests, oldPrompt); return new DateTimePrompt(quests, oldPrompt, source);
} }
} }
} }
@ -207,14 +214,14 @@ public class DateTimePrompt extends FixedSetPrompt {
return new YearPrompt(); return new YearPrompt();
} else { } else {
cc.setSessionData("tempYear", Integer.parseInt(input)); cc.setSessionData("tempYear", Integer.parseInt(input));
return new DateTimePrompt(quests, oldPrompt); return new DateTimePrompt(quests, oldPrompt, source);
} }
} catch (NumberFormatException e) { } catch (NumberFormatException e) {
cc.getForWhom().sendRawMessage(ChatColor.RED + Lang.get("itemCreateInvalidInput")); cc.getForWhom().sendRawMessage(ChatColor.RED + Lang.get("itemCreateInvalidInput"));
return new YearPrompt(); return new YearPrompt();
} }
} else { } else {
return new DateTimePrompt(quests, oldPrompt); return new DateTimePrompt(quests, oldPrompt, source);
} }
} }
} }
@ -237,14 +244,14 @@ public class DateTimePrompt extends FixedSetPrompt {
return new HourPrompt(); return new HourPrompt();
} else { } else {
cc.setSessionData("tempHour", Integer.parseInt(input)); cc.setSessionData("tempHour", Integer.parseInt(input));
return new DateTimePrompt(quests, oldPrompt); return new DateTimePrompt(quests, oldPrompt, source);
} }
} catch (NumberFormatException e) { } catch (NumberFormatException e) {
cc.getForWhom().sendRawMessage(ChatColor.RED + Lang.get("itemCreateInvalidInput")); cc.getForWhom().sendRawMessage(ChatColor.RED + Lang.get("itemCreateInvalidInput"));
return new HourPrompt(); return new HourPrompt();
} }
} else { } else {
return new DateTimePrompt(quests, oldPrompt); return new DateTimePrompt(quests, oldPrompt, source);
} }
} }
} }
@ -267,14 +274,14 @@ public class DateTimePrompt extends FixedSetPrompt {
return new MinutePrompt(); return new MinutePrompt();
} else { } else {
cc.setSessionData("tempMinute", Integer.parseInt(input)); cc.setSessionData("tempMinute", Integer.parseInt(input));
return new DateTimePrompt(quests, oldPrompt); return new DateTimePrompt(quests, oldPrompt, source);
} }
} catch (NumberFormatException e) { } catch (NumberFormatException e) {
cc.getForWhom().sendRawMessage(ChatColor.RED + Lang.get("itemCreateInvalidInput")); cc.getForWhom().sendRawMessage(ChatColor.RED + Lang.get("itemCreateInvalidInput"));
return new MinutePrompt(); return new MinutePrompt();
} }
} else { } else {
return new DateTimePrompt(quests, oldPrompt); return new DateTimePrompt(quests, oldPrompt, source);
} }
} }
} }
@ -297,23 +304,23 @@ public class DateTimePrompt extends FixedSetPrompt {
return new SecondPrompt(); return new SecondPrompt();
} else { } else {
cc.setSessionData("tempSecond", Integer.parseInt(input)); cc.setSessionData("tempSecond", Integer.parseInt(input));
return new DateTimePrompt(quests, oldPrompt); return new DateTimePrompt(quests, oldPrompt, source);
} }
} catch (NumberFormatException e) { } catch (NumberFormatException e) {
cc.getForWhom().sendRawMessage(ChatColor.RED + Lang.get("itemCreateInvalidInput")); cc.getForWhom().sendRawMessage(ChatColor.RED + Lang.get("itemCreateInvalidInput"));
return new SecondPrompt(); return new SecondPrompt();
} }
} else { } else {
return new DateTimePrompt(quests, oldPrompt); return new DateTimePrompt(quests, oldPrompt, source);
} }
} }
} }
private class ZonePrompt extends StringPrompt { private class OffsetPrompt extends StringPrompt {
@Override @Override
public String getPromptText(ConversationContext cc) { public String getPromptText(ConversationContext cc) {
return ChatColor.YELLOW + Lang.get("dateCreateEnterZone"); return ChatColor.YELLOW + Lang.get("dateCreateEnterOffset");
} }
@Override @Override
@ -324,27 +331,60 @@ public class DateTimePrompt extends FixedSetPrompt {
if (amt < -12.0 || amt > 14.0) { if (amt < -12.0 || amt > 14.0) {
cc.getForWhom().sendRawMessage(ChatColor.RED + Lang.get("invalidRange") cc.getForWhom().sendRawMessage(ChatColor.RED + Lang.get("invalidRange")
.replace("<least>", "-12:00").replace("<greatest>", "14:00")); .replace("<least>", "-12:00").replace("<greatest>", "14:00"));
return new ZonePrompt(); return new OffsetPrompt();
} else { } else {
String[] t = TimeZone.getAvailableIDs((int) Math.round(amt * 60.0 * 60.0 * 1000.0)); String[] t = TimeZone.getAvailableIDs((int) Math.round(amt * 60.0 * 60.0 * 1000.0));
//TODO - let user choose if (t.length > 1) {
for (String output : t) { return new ZonePrompt(t);
System.out.println("zone id= " + output); } else if (t.length > 0) {
}
if (t.length > 0) {
cc.setSessionData("tempZone", t[0]); cc.setSessionData("tempZone", t[0]);
} else { } else {
cc.getForWhom().sendRawMessage(ChatColor.RED + Lang.get("itemCreateInvalidInput")); cc.getForWhom().sendRawMessage(ChatColor.RED + Lang.get("itemCreateInvalidInput"));
quests.getLogger().severe("Unable to get time zone for converted offset " + input); quests.getLogger().severe("Unable to get time zone for converted offset " + input);
} }
return new DateTimePrompt(quests, oldPrompt); return new DateTimePrompt(quests, oldPrompt, source);
} }
} catch (NumberFormatException e) { } catch (NumberFormatException e) {
cc.getForWhom().sendRawMessage(ChatColor.RED + Lang.get("itemCreateInvalidInput")); cc.getForWhom().sendRawMessage(ChatColor.RED + Lang.get("itemCreateInvalidInput"));
return new ZonePrompt(); return new OffsetPrompt();
} }
} else { } else {
return new DateTimePrompt(quests, oldPrompt); return new DateTimePrompt(quests, oldPrompt, source);
}
}
}
private class ZonePrompt extends StringPrompt {
String[] zones;
public ZonePrompt(String[] timezones) {
zones = timezones;
}
@Override
public String getPromptText(ConversationContext cc) {
String text = ChatColor.LIGHT_PURPLE + Lang.get("timeZoneTitle") + "\n";
for (String z : zones) {
text += ChatColor.GREEN + z + ", ";
}
text = text.substring(0, text.length() - 2);
return text + "\n" + ChatColor.YELLOW + Lang.get("dateCreateEnterZone");
}
@Override
public Prompt acceptInput(ConversationContext cc, String input) {
if (input.equalsIgnoreCase(Lang.get("cmdCancel")) == false) {
for (String z : zones) {
if (z.toLowerCase().startsWith(input.toLowerCase())) {
cc.setSessionData("tempZone", z);
return new DateTimePrompt(quests, oldPrompt, source);
}
}
cc.getForWhom().sendRawMessage(ChatColor.RED + Lang.get("itemCreateInvalidInput"));
return new ZonePrompt(zones);
} else {
return new DateTimePrompt(quests, oldPrompt, source);
} }
} }
} }

View File

@ -12,6 +12,12 @@
package me.blackvein.quests.prompts; package me.blackvein.quests.prompts;
import java.text.DecimalFormat;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Locale;
import java.util.TimeZone;
import me.blackvein.quests.QuestFactory; import me.blackvein.quests.QuestFactory;
import me.blackvein.quests.Quests; import me.blackvein.quests.Quests;
import me.blackvein.quests.util.CK; import me.blackvein.quests.util.CK;
@ -41,24 +47,32 @@ public class PlannerPrompt extends FixedSetPrompt {
lang = lang.replaceAll("<quest>", ChatColor.BLUE + (String) context.getSessionData(CK.Q_NAME)); lang = lang.replaceAll("<quest>", ChatColor.BLUE + (String) context.getSessionData(CK.Q_NAME));
text = ChatColor.AQUA + lang + "\n"; text = ChatColor.AQUA + lang + "\n";
if (context.getSessionData(CK.PLN_START_DATE) == null) { if (context.getSessionData(CK.PLN_START_DATE) == null) {
text += ChatColor.BLUE + "" + ChatColor.BOLD + "1" + ChatColor.RESET + ChatColor.YELLOW + " - " + Lang.get("plnStart") + " " + ChatColor.GRAY + "(" + Lang.get("noneSet") + ")\n"; text += ChatColor.BLUE + "" + ChatColor.BOLD + "1" + ChatColor.RESET + ChatColor.YELLOW + " - " + Lang.get("plnStart") + " "
+ ChatColor.GRAY + "(" + Lang.get("noneSet") + ")\n";
} else { } else {
text += ChatColor.BLUE + "" + ChatColor.BOLD + "1" + ChatColor.RESET + ChatColor.YELLOW + " - " + Lang.get("plnStart") + " (" + getDate((String) context.getSessionData(CK.PLN_START_DATE)) + ")\n"; text += ChatColor.BLUE + "" + ChatColor.BOLD + "1" + ChatColor.RESET + ChatColor.YELLOW + " - " + Lang.get("plnStart") + "\n";
text += " - " + getDate((String) context.getSessionData(CK.PLN_START_DATE)) + "\n";
} }
if (context.getSessionData(CK.PLN_END_DATE) == null) { if (context.getSessionData(CK.PLN_END_DATE) == null) {
text += ChatColor.BLUE + "" + ChatColor.BOLD + "2" + ChatColor.RESET + ChatColor.YELLOW + " - " + Lang.get("plnEnd") + " " + ChatColor.GRAY + "(" + Lang.get("noneSet") + ")\n"; text += ChatColor.BLUE + "" + ChatColor.BOLD + "2" + ChatColor.RESET + ChatColor.YELLOW + " - " + Lang.get("plnEnd") + " "
+ ChatColor.GRAY + "(" + Lang.get("noneSet") + ")\n";
} else { } else {
text += ChatColor.BLUE + "" + ChatColor.BOLD + "2" + ChatColor.RESET + ChatColor.YELLOW + " - " + Lang.get("plnEnd") + " (" + getDate((String) context.getSessionData(CK.PLN_END_DATE)) + ")\n"; text += ChatColor.BLUE + "" + ChatColor.BOLD + "2" + ChatColor.RESET + ChatColor.YELLOW + " - " + Lang.get("plnEnd") + "\n";
text += " - " + getDate((String) context.getSessionData(CK.PLN_END_DATE)) + "\n";
} }
if (context.getSessionData(CK.PLN_REPEAT_CYCLE) == null) { if (context.getSessionData(CK.PLN_REPEAT_CYCLE) == null) {
text += ChatColor.BLUE + "" + ChatColor.BOLD + "3" + ChatColor.RESET + ChatColor.YELLOW + " - " + Lang.get("plnRepeat") + " " + ChatColor.GRAY + "(" + Lang.get("noneSet") + ")\n"; text += ChatColor.BLUE + "" + ChatColor.BOLD + "3" + ChatColor.RESET + ChatColor.YELLOW + " - " + Lang.get("plnRepeat") + " "
+ ChatColor.GRAY + "(" + Lang.get("noneSet") + ")\n";
} else { } else {
text += ChatColor.BLUE + "" + ChatColor.BOLD + "3" + ChatColor.RESET + ChatColor.YELLOW + " - " + Lang.get("plnRepeat") + " (" + Quests.getTime((Long) context.getSessionData(CK.PLN_REPEAT_CYCLE)) + ")\n"; text += ChatColor.BLUE + "" + ChatColor.BOLD + "3" + ChatColor.RESET + ChatColor.YELLOW + " - " + Lang.get("plnRepeat") + " ("
+ Quests.getTime((Long) context.getSessionData(CK.PLN_REPEAT_CYCLE)) + ChatColor.RESET + ChatColor.YELLOW + ")\n";
} }
if (context.getSessionData(CK.PLN_COOLDOWN) == null) { if (context.getSessionData(CK.PLN_COOLDOWN) == null) {
text += ChatColor.BLUE + "" + ChatColor.BOLD + "4" + ChatColor.RESET + ChatColor.YELLOW + " - " + Lang.get("plnCooldown") + " " + ChatColor.GRAY + "(" + Lang.get("noneSet") + ")\n"; text += ChatColor.BLUE + "" + ChatColor.BOLD + "4" + ChatColor.RESET + ChatColor.YELLOW + " - " + Lang.get("plnCooldown") + " "
+ ChatColor.GRAY + "(" + Lang.get("noneSet") + ")\n";
} else { } else {
text += ChatColor.BLUE + "" + ChatColor.BOLD + "4" + ChatColor.RESET + ChatColor.YELLOW + " - " + Lang.get("plnCooldown") + " (" + Quests.getTime((Long) context.getSessionData(CK.PLN_COOLDOWN)) + ")\n"; text += ChatColor.BLUE + "" + ChatColor.BOLD + "4" + ChatColor.RESET + ChatColor.YELLOW + " - " + Lang.get("plnCooldown") + " ("
+ Quests.getTime((Long) context.getSessionData(CK.PLN_COOLDOWN)) + ChatColor.RESET + ChatColor.YELLOW + ")\n";
} }
text += ChatColor.GREEN + "" + ChatColor.BOLD + "5" + ChatColor.RESET + ChatColor.YELLOW + " - " + Lang.get("done"); text += ChatColor.GREEN + "" + ChatColor.BOLD + "5" + ChatColor.RESET + ChatColor.YELLOW + " - " + Lang.get("done");
return text; return text;
@ -67,11 +81,9 @@ 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 DateTimePrompt(quests, PlannerPrompt.this, "start");
return new DateTimePrompt(quests, PlannerPrompt.this);
} else if (input.equalsIgnoreCase("2")) { } else if (input.equalsIgnoreCase("2")) {
//return new EndPrompt(); return new DateTimePrompt(quests, PlannerPrompt.this, "end");
return new DateTimePrompt(quests, 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")) {
@ -82,74 +94,6 @@ public class PlannerPrompt extends FixedSetPrompt {
return null; return null;
} }
/*private class StartPrompt extends StringPrompt {
@Override
public String getPromptText(ConversationContext context) {
return ChatColor.YELLOW + Lang.get("plnStartPrompt");
}
@Override
public Prompt acceptInput(ConversationContext context, String input) {
if (input.equalsIgnoreCase(Lang.get("cmdCancel"))) {
return new PlannerPrompt(quests, factory);
}
if (input.equalsIgnoreCase(Lang.get("cmdClear"))) {
context.setSessionData(CK.PLN_START_DATE, null);
}
long delay;
try {
int i = Integer.parseInt(input);
delay = i * 1000;
} catch (NumberFormatException e) {
context.getForWhom().sendRawMessage(ChatColor.ITALIC + "" + ChatColor.RED + input + ChatColor.RESET + ChatColor.RED + " " + Lang.get("stageEditorInvalidNumber"));
return new StartPrompt();
}
if (delay < -1) {
context.getForWhom().sendRawMessage(ChatColor.RED + Lang.get("questEditorPositiveAmount"));
} else if (delay == 0) {
context.setSessionData(CK.PLN_START_DATE, null);
} else if (delay != -1) {
context.setSessionData(CK.PLN_START_DATE, delay);
}
return new PlannerPrompt(quests, factory);
}
}
private class EndPrompt extends StringPrompt {
@Override
public String getPromptText(ConversationContext context) {
return ChatColor.YELLOW + Lang.get("plnEndPrompt");
}
@Override
public Prompt acceptInput(ConversationContext context, String input) {
if (input.equalsIgnoreCase(Lang.get("cmdCancel"))) {
return new PlannerPrompt(quests, factory);
}
if (input.equalsIgnoreCase(Lang.get("cmdClear"))) {
context.setSessionData(CK.PLN_END_DATE, null);
}
long delay;
try {
int i = Integer.parseInt(input);
delay = i * 1000;
} catch (NumberFormatException e) {
context.getForWhom().sendRawMessage(ChatColor.ITALIC + "" + ChatColor.RED + input + ChatColor.RESET + ChatColor.RED + " " + Lang.get("stageEditorInvalidNumber"));
return new EndPrompt();
}
if (delay < -1) {
context.getForWhom().sendRawMessage(ChatColor.RED + Lang.get("questEditorPositiveAmount"));
} else if (delay == 0) {
context.setSessionData(CK.PLN_END_DATE, null);
} else if (delay != -1) {
context.setSessionData(CK.PLN_END_DATE, delay);
}
return new PlannerPrompt(quests, factory);
}
}*/
private class RepeatPrompt extends StringPrompt { private class RepeatPrompt extends StringPrompt {
@Override @Override
@ -170,7 +114,8 @@ public class PlannerPrompt extends FixedSetPrompt {
int i = Integer.parseInt(input); int i = Integer.parseInt(input);
delay = i * 1000; delay = i * 1000;
} catch (NumberFormatException e) { } catch (NumberFormatException e) {
context.getForWhom().sendRawMessage(ChatColor.ITALIC + "" + ChatColor.RED + input + ChatColor.RESET + ChatColor.RED + " " + Lang.get("stageEditorInvalidNumber")); context.getForWhom().sendRawMessage(ChatColor.ITALIC + "" + ChatColor.RED + input + ChatColor.RESET + ChatColor.RED + " "
+ Lang.get("stageEditorInvalidNumber"));
return new RepeatPrompt(); return new RepeatPrompt();
} }
if (delay < -1) { if (delay < -1) {
@ -204,7 +149,8 @@ public class PlannerPrompt extends FixedSetPrompt {
int i = Integer.parseInt(input); int i = Integer.parseInt(input);
delay = i * 1000; delay = i * 1000;
} catch (NumberFormatException e) { } catch (NumberFormatException e) {
context.getForWhom().sendRawMessage(ChatColor.ITALIC + "" + ChatColor.RED + input + ChatColor.RESET + ChatColor.RED + " " + Lang.get("stageEditorInvalidNumber")); context.getForWhom().sendRawMessage(ChatColor.ITALIC + "" + ChatColor.RED + input + ChatColor.RESET + ChatColor.RED + " "
+ Lang.get("stageEditorInvalidNumber"));
return new CooldownPrompt(); return new CooldownPrompt();
} }
if (delay < -1) { if (delay < -1) {
@ -219,22 +165,30 @@ public class PlannerPrompt extends FixedSetPrompt {
} }
private String getDate(String formattedDate) { private String getDate(String formattedDate) {
Calendar cal = Calendar.getInstance();
SimpleDateFormat dateFormat = new SimpleDateFormat("dd/MM/yyyy");
SimpleDateFormat timeFormat = new SimpleDateFormat("hh:mm:ss");
String[] date = formattedDate.split(":"); String[] date = formattedDate.split(":");
String day = date[0]; int day = Integer.valueOf(date[0]);
String month = date[1]; int month = Integer.valueOf(date[1]);
String year = date[2]; int year = Integer.valueOf(date[2]);
String hour = date[3]; int hour = Integer.valueOf(date[3]);
String minute = date[4]; int minute = Integer.valueOf(date[4]);
String second = date[5]; int second = Integer.valueOf(date[5]);
String zone = date[6];
String output = day + "-" + month + "-" + year + " " cal.set(year, month, day, hour, minute, second);
+ hour + ":" + minute + ":" + second + " UTC"; String output = ChatColor.DARK_AQUA + dateFormat.format(cal.getTime());
if (Integer.parseInt(date[6]) < 0) { output += ChatColor.AQUA + " " + timeFormat.format(cal.getTime());
output += "-";
} else { TimeZone tz = TimeZone.getTimeZone(date[6]);
output += "+"; cal.setTimeZone(tz);
} String[] iso = quests.lang.iso.split("-");
output += zone; Locale loc = new Locale(iso[0], iso[1]);
Double zhour = (double) (cal.getTimeZone().getRawOffset() / 60 / 60 / 1000);
String[] sep = String.valueOf(zhour).replace("-", "").split("\\.");
DecimalFormat zoneFormat = new DecimalFormat("00");
output += ChatColor.LIGHT_PURPLE + " UTC" + (zhour < 0 ? "-":"+") + zoneFormat.format(Integer.valueOf(sep[0])) + ":"
+ zoneFormat.format(Integer.valueOf(sep[1])) + ChatColor.GREEN + " (" + cal.getTimeZone().getDisplayName(loc) + ")";
return output; return output;
} }
} }

View File

@ -121,7 +121,7 @@ public class CK {
public static final String REW_CUSTOM_DATA = "customRewData"; public static final String REW_CUSTOM_DATA = "customRewData";
public static final String REW_CUSTOM_DATA_DESCRIPTIONS = "customRewDataDesc"; public static final String REW_CUSTOM_DATA_DESCRIPTIONS = "customRewDataDesc";
public static final String REW_CUSTOM_DATA_TEMP = "customRewDataTemp"; public static final String REW_CUSTOM_DATA_TEMP = "customRewDataTemp";
//Planner // Planner
public static final String PLN_START_DATE = "startDatePln"; public static final String PLN_START_DATE = "startDatePln";
public static final String PLN_END_DATE = "endDatePln"; public static final String PLN_END_DATE = "endDatePln";
public static final String PLN_REPEAT_CYCLE = "repeatCyclePln"; public static final String PLN_REPEAT_CYCLE = "repeatCyclePln";

View File

@ -580,7 +580,8 @@ dateCreateEnterYear: "Enter a year (max. 9999), <cancel>"
dateCreateEnterHour: "Enter an hour (max. 23), <cancel>" dateCreateEnterHour: "Enter an hour (max. 23), <cancel>"
dateCreateEnterMinute: "Enter a minute (max. 59), <cancel>" dateCreateEnterMinute: "Enter a minute (max. 59), <cancel>"
dateCreateEnterSecond: "Enter a second (max. 59), <cancel>" dateCreateEnterSecond: "Enter a second (max. 59), <cancel>"
dateCreateEnterZone: "Enter a UTC time offset (max. 14), <cancel>" dateCreateEnterOffset: "Enter a UTC time offset (max. 14), <cancel>"
dateCreateEnterZone: "Enter a UTC time zone, <cancel>"
dateCreateNoYearAmount: "You must set a year first!" dateCreateNoYearAmount: "You must set a year first!"
questTitle: "-- <quest> --" questTitle: "-- <quest> --"
questObjectivesTitle: "---(<quest>)---" questObjectivesTitle: "---(<quest>)---"
@ -626,6 +627,7 @@ completedQuestsTitle: "- Completed Quests -"
topQuestersTitle: "- Top <number> Questers -" topQuestersTitle: "- Top <number> Questers -"
createItemTitle: "- Create Item -" createItemTitle: "- Create Item -"
dateTimeTitle: "- Date & Time -" dateTimeTitle: "- Date & Time -"
timeZoneTitle: "- Time Zones -"
enchantmentsTitle: "- Enchantments -" enchantmentsTitle: "- Enchantments -"
questGUITitle: "- GUI Item Display -" questGUITitle: "- GUI Item Display -"
questRegionTitle: "- Quest Region -" questRegionTitle: "- Quest Region -"