mirror of
https://github.com/PikaMug/Quests.git
synced 2024-11-12 13:43:57 +01:00
NEW date/time Planner section, part 5, #93
This commit is contained in:
parent
a5729b4ba0
commit
b178734233
@ -70,8 +70,8 @@ public class Quest {
|
||||
Map<String, Map<String, Object>> customRewards = new HashMap<String, Map<String, Object>>();
|
||||
public String failRequirements = null;
|
||||
//Planner
|
||||
public long startPlanner = -1;
|
||||
public long endPlanner = -1;
|
||||
public String startPlanner = null;
|
||||
public String endPlanner = null;
|
||||
public long repeatPlanner = -1;
|
||||
public long cooldownPlanner = -1;
|
||||
// Rewards
|
||||
@ -678,8 +678,8 @@ public class Quest {
|
||||
hash = 53 * hash + (this.name != null ? this.name.hashCode() : 0);
|
||||
hash = 53 * hash + (this.description != null ? this.description.hashCode() : 0);
|
||||
hash = 53 * hash + (this.finished != null ? this.finished.hashCode() : 0);
|
||||
hash = 53 * hash + (int) (this.startPlanner ^ (this.startPlanner >>> 32));
|
||||
hash = 53 * hash + (int) (this.endPlanner ^ (this.endPlanner >>> 32));
|
||||
hash = 53 * hash + (this.startPlanner != null ? this.startPlanner.hashCode() : 0);
|
||||
hash = 53 * hash + (this.endPlanner != null ? this.endPlanner.hashCode() : 0);
|
||||
hash = 53 * hash + (int) (this.repeatPlanner ^ (this.repeatPlanner >>> 32));
|
||||
hash = 53 * hash + (int) (this.cooldownPlanner ^ (this.cooldownPlanner >>> 32));
|
||||
hash = 53 * hash + (this.region != null ? this.region.hashCode() : 0);
|
||||
|
@ -764,8 +764,8 @@ public class QuestFactory implements ConversationAbandonedListener {
|
||||
LinkedList<String> phatLootRews = null;
|
||||
LinkedList<String> customRews = null;
|
||||
LinkedList<Map<String, Object>> customRewsData = null;
|
||||
Long startDatePln = null;
|
||||
Long endDatePln = null;
|
||||
String startDatePln = null;
|
||||
String endDatePln = null;
|
||||
Long repeatCyclePln = null;
|
||||
Long cooldownPln = null;
|
||||
if (cc.getSessionData(CK.Q_START_NPC) != null) {
|
||||
@ -857,10 +857,10 @@ public class QuestFactory implements ConversationAbandonedListener {
|
||||
customRewsData = (LinkedList<Map<String, Object>>) cc.getSessionData(CK.REW_CUSTOM_DATA);
|
||||
}
|
||||
if (cc.getSessionData(CK.PLN_START_DATE) != null) {
|
||||
startDatePln = (Long) cc.getSessionData(CK.PLN_START_DATE);
|
||||
startDatePln = (String) cc.getSessionData(CK.PLN_START_DATE);
|
||||
}
|
||||
if (cc.getSessionData(CK.PLN_END_DATE) != null) {
|
||||
endDatePln = (Long) cc.getSessionData(CK.PLN_END_DATE);
|
||||
endDatePln = (String) cc.getSessionData(CK.PLN_END_DATE);
|
||||
}
|
||||
if (cc.getSessionData(CK.PLN_REPEAT_CYCLE) != null) {
|
||||
repeatCyclePln = (Long) cc.getSessionData(CK.PLN_REPEAT_CYCLE);
|
||||
@ -1275,10 +1275,10 @@ public class QuestFactory implements ConversationAbandonedListener {
|
||||
if (startDatePln != null || endDatePln != null || repeatCyclePln != null || cooldownPln != null) {
|
||||
ConfigurationSection sch = cs.createSection("planner");
|
||||
if (startDatePln != null) {
|
||||
sch.set("start", startDatePln.intValue() / 1000);
|
||||
sch.set("start", startDatePln);
|
||||
}
|
||||
if (endDatePln != null) {
|
||||
sch.set("end", endDatePln.intValue() / 1000);
|
||||
sch.set("end", endDatePln);
|
||||
}
|
||||
if (repeatCyclePln != null) {
|
||||
sch.set("repeat", repeatCyclePln.intValue() / 1000);
|
||||
@ -1397,10 +1397,10 @@ public class QuestFactory implements ConversationAbandonedListener {
|
||||
}
|
||||
//
|
||||
//Planner
|
||||
if (q.startPlanner != -1) {
|
||||
if (q.startPlanner != null) {
|
||||
cc.setSessionData(CK.PLN_START_DATE, q.startPlanner);
|
||||
}
|
||||
if (q.endPlanner != -1) {
|
||||
if (q.endPlanner != null) {
|
||||
cc.setSessionData(CK.PLN_END_DATE, q.endPlanner);
|
||||
}
|
||||
if (q.repeatPlanner != -1) {
|
||||
|
@ -2572,25 +2572,29 @@ public class Quests extends JavaPlugin implements ConversationAbandonedListener
|
||||
|
||||
private void loadQuestPlanner(FileConfiguration config, ConfigurationSection questsSection) throws SkipQuest {
|
||||
if (config.contains("quests." + questName + ".planner.start")) {
|
||||
quest.startPlanner = config.getLong("quests." + questName + ".planner.start");
|
||||
quest.startPlanner = config.getString("quests." + questName + ".planner.start");
|
||||
} /*else {
|
||||
skipQuestProcess("Planner for Quest " + quest.name + " is missing start:");
|
||||
}*/
|
||||
if (config.contains("quests." + questName + ".planner.end")) {
|
||||
quest.endPlanner = config.getLong("quests." + questName + ".planner.end");
|
||||
quest.endPlanner = config.getString("quests." + questName + ".planner.end");
|
||||
} /*else {
|
||||
skipQuestProcess("Planner for Quest " + quest.name + " is missing end:");
|
||||
}*/
|
||||
if (config.contains("quests." + questName + ".planner.repeat")) {
|
||||
quest.repeatPlanner = config.getLong("quests." + questName + ".planner.repeat");
|
||||
} /*else {
|
||||
skipQuestProcess("Planner for Quest " + quest.name + " is missing repeat:");
|
||||
}*/
|
||||
if (config.getInt("quests." + questName + ".planner.repeat", -999) != -999) {
|
||||
quest.repeatPlanner = config.getInt("quests." + questName + ".planner.repeat") * 1000;
|
||||
} else {
|
||||
skipQuestProcess("repeat: for Quest " + quest.name + " is not a number!");
|
||||
}
|
||||
}
|
||||
if (config.contains("quests." + questName + ".planner.cooldown")) {
|
||||
quest.cooldownPlanner = config.getLong("quests." + questName + ".planner.cooldown");
|
||||
} /*else {
|
||||
skipQuestProcess("Planner for Quest " + quest.name + " is missing cooldown:");
|
||||
}*/
|
||||
if (config.getInt("quests." + questName + ".planner.cooldown", -999) != -999) {
|
||||
quest.cooldownPlanner = config.getInt("quests." + questName + ".planner.cooldown") * 1000;
|
||||
} else {
|
||||
skipQuestProcess("cooldown: for Quest " + quest.name + " is not a number!");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void skipQuestProcess(String[] msgs) throws SkipQuest {
|
||||
|
Loading…
Reference in New Issue
Block a user