Fix /quests stats for redo-quests, per #92

This commit is contained in:
HappyPikachu 2017-08-28 01:17:24 -04:00
parent 56517599a2
commit 3b394dfad7
2 changed files with 11 additions and 2 deletions

View File

@ -258,7 +258,9 @@ public class Quest {
public void completeQuest(Quester q) { public void completeQuest(Quester q) {
final Player player = plugin.getServer().getPlayer(q.id); final Player player = plugin.getServer().getPlayer(q.id);
q.hardQuit(this); q.hardQuit(this);
if (!q.completedQuests.contains(name)) {
q.completedQuests.add(name); q.completedQuests.add(name);
}
String none = ChatColor.GRAY + "- (" + Lang.get("none") + ")"; String none = ChatColor.GRAY + "- (" + Lang.get("none") + ")";
final String ps = Quests.parseString(finished, this); final String ps = Quests.parseString(finished, this);
for (Map.Entry<Integer, Quest> entry : q.timers.entrySet()) { for (Map.Entry<Integer, Quest> entry : q.timers.entrySet()) {
@ -282,6 +284,11 @@ public class Quest {
} }
if (redoDelay > -1) { if (redoDelay > -1) {
q.completedTimes.put(this.name, System.currentTimeMillis()); q.completedTimes.put(this.name, System.currentTimeMillis());
if (q.amountsCompleted.containsKey(this.name)) {
q.amountsCompleted.put(this.name, q.amountsCompleted.get(this.name) + 1);
} else {
q.amountsCompleted.put(this.name, 1);
}
} }
for (ItemStack i : itemRewards) { for (ItemStack i : itemRewards) {
Quests.addItem(player, i); Quests.addItem(player, i);

View File

@ -1930,7 +1930,9 @@ public class Quester {
for (String s : data.getStringList("completed-Quests")) { for (String s : data.getStringList("completed-Quests")) {
for (Quest q : plugin.quests) { for (Quest q : plugin.quests) {
if (q.name.equalsIgnoreCase(s)) { if (q.name.equalsIgnoreCase(s)) {
if (!completedQuests.contains(q.name)) {
completedQuests.add(q.name); completedQuests.add(q.name);
}
break; break;
} }
} }