-
Notifications
You must be signed in to change notification settings - Fork 33
API – Get player quest status
First, you have to get a fr.skytasul.quests.players.PlayerAccount
instance for the player you want to get the status from. For this, use fr.skytasul.quests.players.PlayersManager#getPlayerAccount(Player player)
.
Now, you will need to get the fr.skytasul.quests.structure.Quest
instance of the quest you want to get the status of.
- If you know the ID of the quest, you can use
fr.skytasul.quests.api.QuestsAPI#getQuestFromID(int id)
. - If you want a list of all available quests, use
QuestsAPI#getQuests()
. - If you want a list of quests from a single Citizens NPC, use
QuestsAPI#getQuestsAssigneds(NPC npc)
. - You can use
QuestsAPI#getQuestsStarteds(PlayerAccount account)
,QuestsAPI#getQuestsUnstarted(PlayerAccount account)
andQuestsAPI#getQuestsFinished(PlayerAccount account)
if you want lists of quests specific for a player.
Now you have the PlayerAccount
and Quest
instances, let's head to the real part of the problem.
There are three cases:
This means that Quest#hasStarted(PlayerAccount)
returns true
.
To get the description of the quests, use quest.getBranchesManager().getPlayerBranch(account).getDescriptionLine(account, Source.SCOREBOARD)
. (you can replace Source.SCOREBOARD
by whichever source you'd like among: SCOREBOARD, MENU, PLACEHOLDER, FORCESPLIT, FORCELINE
)
WARNING: Quest#hasFinished(PlayerAccount)
may return true
as some quests can be done multiple times.
This means that Quest#hasStarted(PlayerAccount)
returns false
.
This means that Quest#hasStarted(PlayerAccount)
and Quest#hasFinished(PlayerAccount)
returns false
.
🚧 Wiki is Work In Progress
Please note that the Wiki pages are currently under rewriting and are, for most of them, outdated.
❓ Questions, issues, or ideas?
Join the official Plugin Support Discord server by SkytAsul: https://discord.gg/H8fXrkD