From 94189783bc7bba48f15e23fdee099438216830dc Mon Sep 17 00:00:00 2001 From: montlikadani Date: Thu, 5 Nov 2020 16:43:59 +0100 Subject: [PATCH] Add %jobsr_user_quests% placeholder to show available quests from jobs Closes #989 --- .../jobs/Placeholders/Placeholder.java | 19 +++++++++++++++++++ .../com/gamingmesh/jobs/container/Quest.java | 2 +- 2 files changed, 20 insertions(+), 1 deletion(-) diff --git a/src/main/java/com/gamingmesh/jobs/Placeholders/Placeholder.java b/src/main/java/com/gamingmesh/jobs/Placeholders/Placeholder.java index 085610c5..d046fb3e 100644 --- a/src/main/java/com/gamingmesh/jobs/Placeholders/Placeholder.java +++ b/src/main/java/com/gamingmesh/jobs/Placeholders/Placeholder.java @@ -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; } diff --git a/src/main/java/com/gamingmesh/jobs/container/Quest.java b/src/main/java/com/gamingmesh/jobs/container/Quest.java index caf70bea..8a750bd4 100644 --- a/src/main/java/com/gamingmesh/jobs/container/Quest.java +++ b/src/main/java/com/gamingmesh/jobs/container/Quest.java @@ -28,7 +28,7 @@ public class Quest { private final Set actions = new HashSet<>(); public Quest(String questName, Job job) { - this.questName = questName; + setQuestName(questName); this.job = job; }