Support both types of progress sharing w/o overriding quest option

This commit is contained in:
PikaMug 2019-09-14 22:43:12 -04:00
parent c268dca82f
commit 17ac3b9430
2 changed files with 9 additions and 10 deletions

View File

@ -3282,9 +3282,12 @@ public class Quester {
List<Quester> mq = getMultiplayerQuesters(quest); List<Quester> mq = getMultiplayerQuesters(quest);
for (Quester q : mq) { for (Quester q : mq) {
if (q.containsObjective(quest, objectiveType)) { if (q.containsObjective(quest, objectiveType)) {
fun.apply(q); if (quest.getOptions().getRequireSameQuest() && this.containsObjective(quest, objectiveType)) {
fun.apply(q);
} else if (!quest.getOptions().getRequireSameQuest()) {
fun.apply(q);
}
} }
} }
} }
} }

View File

@ -729,18 +729,14 @@ public class PlayerListener implements Listener {
Quester quester = plugin.getQuester(damager.getUniqueId()); Quester quester = plugin.getQuester(damager.getUniqueId());
LinkedList<Quest> allQuests = plugin.getQuests(); LinkedList<Quest> allQuests = plugin.getQuests();
for (Quest quest : allQuests) { for (Quest quest : allQuests) {
boolean multiplayer = !quest.getOptions().getRequireSameQuest();
if (quester.getCurrentQuests().containsKey(quest) && quester.containsObjective(quest, "killMob")) { if (quester.getCurrentQuests().containsKey(quest) && quester.containsObjective(quest, "killMob")) {
quester.killMob(quest, target.getLocation(), target.getType()); quester.killMob(quest, target.getLocation(), target.getType());
multiplayer = true;
} }
if (multiplayer) { quester.dispatchMultiplayerEverything(quest, "killMob", (Quester q) -> {
quester.dispatchMultiplayerEverything(quest, "killMob", (Quester q) -> { q.killMob(quest, target.getLocation(), target.getType());
q.killMob(quest, target.getLocation(), target.getType()); return null;
return null; });
});
}
} }
} }
} }