Avoid NullPointer on NPCRightClickEvent, fixes #220

This commit is contained in:
HappyPikachu 2018-01-02 22:50:22 -05:00
parent bcd1d7ecb0
commit 004edf5637

View File

@ -606,7 +606,8 @@ public class Quester {
}
}
for (String s : getCurrentStage(quest).passwordDisplays) {
if (getQuestData(quest).passwordsSaid.get(s) == false) {
Boolean b = getQuestData(quest).passwordsSaid.get(s);
if (b != null && !b) {
unfinishedObjectives.add(ChatColor.GREEN + s);
} else {
finishedObjectives.add(ChatColor.GRAY + s);
@ -902,17 +903,15 @@ public class Quester {
public void interactWithNPC(Quest quest, NPC n) {
try {
if (getQuestData(quest).citizensInteracted.containsKey(n.getId())) {
if (getQuestData(quest).citizensInteracted.get(n.getId()) == false) {
getQuestData(quest).citizensInteracted.put(n.getId(), true);
finishObjective(quest, "talkToNPC", null, null, null, null, null, n, null, null, null, null);
}
Boolean b = getQuestData(quest).citizensInteracted.containsKey(n.getId());
if (b != null && !b) {
getQuestData(quest).citizensInteracted.put(n.getId(), true);
finishObjective(quest, "talkToNPC", null, null, null, null, null, n, null, null, null, null);
}
} catch (NullPointerException e) {
//Github ticket #155
//TODO Github ticket #220
plugin.getLogger().severe("An error has occurred with Quests. Please report on Github. Include the info below");
plugin.getLogger().severe("npc + id = " + n.getName() + " + " + n.getId());
plugin.getLogger().severe("citizensInteracted = " + getQuestData(quest).citizensInteracted.toString());
e.printStackTrace();
}
}