Remedy reach-location objectives spamming chat, fixes #922

This commit is contained in:
PikaMug 2019-11-08 01:03:40 -05:00
parent 7c22b24595
commit be3248eeea

View File

@ -1914,24 +1914,30 @@ public class Quester {
// TODO - Find proper cause of Github issues #646 and #825
if (index >= getQuestData(quest).hasReached.size()) {
getQuestData(quest).hasReached.add(true);
} else {
getQuestData(quest).hasReached.set(index, true);
}
finishObjective(quest, "reachLocation", new ItemStack(Material.AIR, 1),
new ItemStack(Material.AIR, 1), null, null, null, null, location, null, null,
null);
} else if (getQuestData(quest).hasReached.get(index) == false) {
getQuestData(quest).hasReached.set(index, true);
finishObjective(quest, "reachLocation", new ItemStack(Material.AIR, 1),
new ItemStack(Material.AIR, 1), null, null, null, null, location, null, null,
null);
}
// Multiplayer
final int finalIndex = index;
dispatchMultiplayerObjectives(quest, getCurrentStage(quest), (Quester q) -> {
if (finalIndex >= getQuestData(quest).hasReached.size()) {
q.getQuestData(quest).hasReached.add(true);
} else {
q.getQuestData(quest).hasReached.set(finalIndex, true);
}
q.finishObjective(quest, "reachLocation", new ItemStack(Material.AIR, 1),
new ItemStack(Material.AIR, 1), null, null, null, null, location, null,
null, null);
} else {
q.getQuestData(quest).hasReached.set(finalIndex, true);
q.finishObjective(quest, "reachLocation", new ItemStack(Material.AIR, 1),
new ItemStack(Material.AIR, 1), null, null, null, null, location, null,
null, null);
}
return null;
});
}