mirror of
https://github.com/PikaMug/Quests.git
synced 2024-11-23 19:15:49 +01:00
Properly display custom objectives, reparation. See #625
This commit is contained in:
parent
55352f6a66
commit
0e9be2cf20
@ -176,9 +176,11 @@ public abstract class CustomObjective implements Listener {
|
||||
tempIndex++;
|
||||
}
|
||||
if (index > -1) {
|
||||
Entry<String, Object> e = currentStage.customObjectiveData.get(index);
|
||||
Map<String, Object> m = new HashMap<String, Object>();
|
||||
m.put(e.getKey(), e.getValue());
|
||||
for (int i = index; i < index + data.size(); i++) {
|
||||
Entry<String, Object> e = currentStage.customObjectiveData.get(index);
|
||||
m.put(e.getKey(), e.getValue());
|
||||
}
|
||||
return m;
|
||||
}
|
||||
}
|
||||
|
@ -784,12 +784,15 @@ public class Quester {
|
||||
for (CustomObjective co : getCurrentStage(quest).customObjectives) {
|
||||
int index = 0;
|
||||
String display = co.getDisplay();
|
||||
boolean addUnfinished = false;
|
||||
boolean addFinished = false;
|
||||
for (Entry<String, Integer> entry : getQuestData(quest).customObjectiveCounts.entrySet()) {
|
||||
if (co.getName().equals(entry.getKey())) {
|
||||
Entry<String, Object> datamap = getCurrentStage(quest).customObjectiveData.get(index);
|
||||
for (Entry<String,Object> prompt : co.getData()) {
|
||||
String replacement = "%" + prompt.getKey() + "%";
|
||||
try {
|
||||
display = display.replace("%" + prompt.getKey() + "%", ((String) datamap.getValue()));
|
||||
if (display.contains(replacement))
|
||||
display = display.replace(replacement, ((String) getCurrentStage(quest).customObjectiveData.get(index).getValue()));
|
||||
} catch (NullPointerException ne) {
|
||||
plugin.getLogger().severe("Unable to fetch display for " + co.getName() + " on " + quest.getName());
|
||||
ne.printStackTrace();
|
||||
@ -799,16 +802,22 @@ public class Quester {
|
||||
if (co.canShowCount()) {
|
||||
display = display.replace("%count%", entry.getValue() + "/" + getCurrentStage(quest).customObjectiveCounts.get(index));
|
||||
}
|
||||
unfinishedObjectives.add(ChatColor.GREEN + display);
|
||||
addUnfinished = true;
|
||||
} else {
|
||||
if (co.canShowCount()) {
|
||||
display = display.replace("%count%", getCurrentStage(quest).customObjectiveCounts.get(index) + "/" + getCurrentStage(quest).customObjectiveCounts.get(index));
|
||||
}
|
||||
finishedObjectives.add(ChatColor.GRAY + display);
|
||||
addFinished = true;
|
||||
}
|
||||
}
|
||||
index++;
|
||||
}
|
||||
if (addUnfinished) {
|
||||
unfinishedObjectives.add(ChatColor.GREEN + display);
|
||||
}
|
||||
if (addFinished) {
|
||||
finishedObjectives.add(ChatColor.GRAY + display);
|
||||
}
|
||||
}
|
||||
objectives.addAll(unfinishedObjectives);
|
||||
objectives.addAll(finishedObjectives);
|
||||
|
Loading…
Reference in New Issue
Block a user