1
0
mirror of https://github.com/Zrips/Jobs.git synced 2024-12-01 23:13:48 +01:00

Fix NPE when getting quest

This commit is contained in:
montlikadani 2020-03-03 19:47:53 +01:00
parent ab3ea2e77d
commit f8d9862a8b
3 changed files with 12 additions and 3 deletions

View File

@ -446,10 +446,15 @@ public class Job {
}
public Quest getQuest(String name) {
if (name == null || name.trim().isEmpty()) {
return null;
}
for (Quest one : quests) {
if (one.getConfigName().equalsIgnoreCase(name))
return one;
}
return null;
}

View File

@ -12,8 +12,8 @@ import com.gamingmesh.jobs.Jobs;
public class Quest {
private String configName;
private String questName;
private String configName = "";
private String questName = "";
private Job job;
private Long validUntil = 0L;

View File

@ -11,17 +11,21 @@ import com.gamingmesh.jobs.Jobs;
public class QuestProgression {
private Quest quest;
private long validUntil;
private boolean givenReward = false;
private HashMap<QuestObjective, Integer> done = new HashMap<>();
public QuestProgression(Quest quest) {
this.quest = quest;
validUntil = quest.getValidUntil();
}
public Quest getQuest() {
return quest == null ? null : quest.getJob().getQuest(quest.getConfigName());
Quest q = quest == null ? null : (quest.getJob() == null ? null : quest.getJob().getQuest(quest.getConfigName()));
return q;
}
public void setQuest(Quest quest) {