Potentially fix custom objective displays, see #625

This commit is contained in:
BuildTools 2019-01-22 16:21:49 -05:00
parent 4f8cc34c0a
commit a92ff51231

View File

@ -783,9 +783,11 @@ public class Quester {
} }
int index = 0; int index = 0;
for (CustomObjective co : getCurrentStage(quest).customObjectives) { for (CustomObjective co : getCurrentStage(quest).customObjectives) {
String display = co.getDisplay();
boolean addUnfinished = false;
boolean addFinished = false;
for (Entry<String, Integer> entry : getQuestData(quest).customObjectiveCounts.entrySet()) { for (Entry<String, Integer> entry : getQuestData(quest).customObjectiveCounts.entrySet()) {
if (co.getName().equals(entry.getKey())) { if (co.getName().equals(entry.getKey())) {
String display = co.getDisplay();
Entry<String, Object> datamap = getCurrentStage(quest).customObjectiveData.get(index); Entry<String, Object> datamap = getCurrentStage(quest).customObjectiveData.get(index);
for (Entry<String,Object> prompt : co.getData()) { for (Entry<String,Object> prompt : co.getData()) {
try { try {
@ -799,15 +801,21 @@ public class Quester {
if (co.canShowCount()) { if (co.canShowCount()) {
display = display.replace("%count%", entry.getValue() + "/" + getCurrentStage(quest).customObjectiveCounts.get(index)); display = display.replace("%count%", entry.getValue() + "/" + getCurrentStage(quest).customObjectiveCounts.get(index));
} }
unfinishedObjectives.add(ChatColor.GREEN + display); addUnfinished = true;
} else { } else {
if (co.canShowCount()) { if (co.canShowCount()) {
display = display.replace("%count%", getCurrentStage(quest).customObjectiveCounts.get(index) + "/" + getCurrentStage(quest).customObjectiveCounts.get(index)); display = display.replace("%count%", getCurrentStage(quest).customObjectiveCounts.get(index) + "/" + getCurrentStage(quest).customObjectiveCounts.get(index));
} }
addFinished = true;
}
}
}
if (addUnfinished) {
unfinishedObjectives.add(ChatColor.GREEN + display);
}
if (addFinished) {
finishedObjectives.add(ChatColor.GRAY + display); finishedObjectives.add(ChatColor.GRAY + display);
} }
}
}
index++; index++;
} }
objectives.addAll(unfinishedObjectives); objectives.addAll(unfinishedObjectives);