mirror of
https://github.com/Grasscutters/Grasscutter.git
synced 2025-12-16 17:05:20 +01:00
Delete quests from the player if there are errors loading them from the db
This commit is contained in:
@@ -313,16 +313,27 @@ public class QuestManager extends BasePlayerManager {
|
||||
}
|
||||
public void loadFromDatabase() {
|
||||
List<GameMainQuest> quests = DatabaseHelper.getAllQuests(getPlayer());
|
||||
|
||||
|
||||
for (GameMainQuest mainQuest : quests) {
|
||||
boolean cancelAdd = false;
|
||||
mainQuest.setOwner(this.getPlayer());
|
||||
|
||||
for (GameQuest quest : mainQuest.getChildQuests().values()) {
|
||||
QuestData questConfig = GameData.getQuestDataMap().get(quest.getSubQuestId());
|
||||
|
||||
if (questConfig == null) {
|
||||
mainQuest.delete();
|
||||
cancelAdd = true;
|
||||
break;
|
||||
}
|
||||
|
||||
quest.setMainQuest(mainQuest);
|
||||
quest.setConfig(GameData.getQuestDataMap().get(quest.getSubQuestId()));
|
||||
quest.setConfig(questConfig);
|
||||
}
|
||||
|
||||
this.getMainQuests().put(mainQuest.getParentQuestId(), mainQuest);
|
||||
if (!cancelAdd) {
|
||||
this.getMainQuests().put(mainQuest.getParentQuestId(), mainQuest);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user