Translations:Implementation and Events/142/en
From DragonMineZ Wiki
- Objective classes extend
QuestObjectiveand call theQuestObjective(String customType, int required)constructor; reward classes extendQuestReward, callQuestReward(String customType)and implementgiveReward(ServerPlayer)andgetDescription(). Objectives must also implementcheckProgress(Object... params). - In quest JSON, use your key as the
"type"(for example{"type": "MEDITATE", "seconds": 60}). Type keys are case-insensitive (stored in upper case). Treat them like registry names: don't rename them once quests use them. - The sync writer must write every field your factory reads, because the client parses the synced JSON again with your factory.
- Unknown types are reported in the JSON load report (see Finding JSON mistakes) and the objective or reward is skipped.
- Progress is server-authoritative and event-driven: listen to your own game events on the server and store progress with
PlayerQuestData.setObjectiveProgress(questKey, objectiveIndex, progress), then sync withProgressionSyncS2C. UseDMZEvent.QuestObjectiveProgressEventandQuestCompletedEventto react to built-in quests.