1
0
mirror of https://github.com/Zrips/Jobs.git synced 2025-01-02 14:29:07 +01:00

Add %jobsr_user_quests% placeholder to show available quests from jobs

Closes #989
This commit is contained in:
montlikadani 2020-11-05 16:43:59 +01:00
parent 89280f05f2
commit 94189783bc
2 changed files with 20 additions and 1 deletions

View File

@ -19,6 +19,8 @@ import com.gamingmesh.jobs.container.CurrencyType;
import com.gamingmesh.jobs.container.Job;
import com.gamingmesh.jobs.container.JobProgression;
import com.gamingmesh.jobs.container.JobsPlayer;
import com.gamingmesh.jobs.container.Quest;
import com.gamingmesh.jobs.container.QuestProgression;
import com.gamingmesh.jobs.container.Title;
import com.gamingmesh.jobs.container.TopList;
import com.gamingmesh.jobs.container.blockOwnerShip.BlockTypes;
@ -46,6 +48,7 @@ public class Placeholder {
user_dailyquests_pending,
user_dailyquests_completed,
user_dailyquests_total,
user_quests,
user_seen,
user_totallevels,
user_issaved,
@ -440,6 +443,22 @@ public class Placeholder {
JobProgression prog = l.get(ThreadLocalRandom.current().nextInt(l.size()));
return prog.getJob().getName();
case user_quests:
String q = "";
for (QuestProgression questProg : user.getQuestProgressions()) {
Quest quest = questProg.getQuest();
if (quest == null || quest.isStopped()) {
continue;
}
if (!q.isEmpty()) {
q += ", ";
}
q += quest.getQuestName();
}
return q;
default:
break;
}

View File

@ -28,7 +28,7 @@ public class Quest {
private final Set<ActionType> actions = new HashSet<>();
public Quest(String questName, Job job) {
this.questName = questName;
setQuestName(questName);
this.job = job;
}