mirror of
https://github.com/Zrips/Jobs.git
synced 2024-12-02 07:23:29 +01:00
Fix NPE when getting quest
This commit is contained in:
parent
ab3ea2e77d
commit
f8d9862a8b
@ -446,10 +446,15 @@ public class Job {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public Quest getQuest(String name) {
|
public Quest getQuest(String name) {
|
||||||
|
if (name == null || name.trim().isEmpty()) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
for (Quest one : quests) {
|
for (Quest one : quests) {
|
||||||
if (one.getConfigName().equalsIgnoreCase(name))
|
if (one.getConfigName().equalsIgnoreCase(name))
|
||||||
return one;
|
return one;
|
||||||
}
|
}
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -12,8 +12,8 @@ import com.gamingmesh.jobs.Jobs;
|
|||||||
|
|
||||||
public class Quest {
|
public class Quest {
|
||||||
|
|
||||||
private String configName;
|
private String configName = "";
|
||||||
private String questName;
|
private String questName = "";
|
||||||
private Job job;
|
private Job job;
|
||||||
private Long validUntil = 0L;
|
private Long validUntil = 0L;
|
||||||
|
|
||||||
|
@ -11,17 +11,21 @@ import com.gamingmesh.jobs.Jobs;
|
|||||||
public class QuestProgression {
|
public class QuestProgression {
|
||||||
|
|
||||||
private Quest quest;
|
private Quest quest;
|
||||||
|
|
||||||
private long validUntil;
|
private long validUntil;
|
||||||
private boolean givenReward = false;
|
private boolean givenReward = false;
|
||||||
|
|
||||||
private HashMap<QuestObjective, Integer> done = new HashMap<>();
|
private HashMap<QuestObjective, Integer> done = new HashMap<>();
|
||||||
|
|
||||||
public QuestProgression(Quest quest) {
|
public QuestProgression(Quest quest) {
|
||||||
this.quest = quest;
|
this.quest = quest;
|
||||||
|
|
||||||
validUntil = quest.getValidUntil();
|
validUntil = quest.getValidUntil();
|
||||||
}
|
}
|
||||||
|
|
||||||
public Quest getQuest() {
|
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) {
|
public void setQuest(Quest quest) {
|
||||||
|
Loading…
Reference in New Issue
Block a user