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 // TODO - Find proper cause of Github issues #646 and #825
if (index >= getQuestData(quest).hasReached.size()) { if (index >= getQuestData(quest).hasReached.size()) {
getQuestData(quest).hasReached.add(true); getQuestData(quest).hasReached.add(true);
} else {
getQuestData(quest).hasReached.set(index, true);
}
finishObjective(quest, "reachLocation", new ItemStack(Material.AIR, 1), finishObjective(quest, "reachLocation", new ItemStack(Material.AIR, 1),
new ItemStack(Material.AIR, 1), null, null, null, null, location, null, null, new ItemStack(Material.AIR, 1), null, null, null, null, location, null, 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 // Multiplayer
final int finalIndex = index; final int finalIndex = index;
dispatchMultiplayerObjectives(quest, getCurrentStage(quest), (Quester q) -> { dispatchMultiplayerObjectives(quest, getCurrentStage(quest), (Quester q) -> {
if (finalIndex >= getQuestData(quest).hasReached.size()) { if (finalIndex >= getQuestData(quest).hasReached.size()) {
q.getQuestData(quest).hasReached.add(true); q.getQuestData(quest).hasReached.add(true);
} else {
q.getQuestData(quest).hasReached.set(finalIndex, true);
}
q.finishObjective(quest, "reachLocation", new ItemStack(Material.AIR, 1), q.finishObjective(quest, "reachLocation", new ItemStack(Material.AIR, 1),
new ItemStack(Material.AIR, 1), null, null, null, null, location, null, new ItemStack(Material.AIR, 1), null, null, null, null, location, null,
null, 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; return null;
}); });
} }