Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
ziqian zhang
Grasscutter
Commits
1e649cd8
Unverified
Commit
1e649cd8
authored
Aug 21, 2022
by
Melledy
Browse files
Delete quests from the player if there are errors loading them from the db
parent
c53697da
Changes
3
Show whitespace changes
Inline
Side-by-side
src/main/java/emu/grasscutter/game/quest/GameMainQuest.java
View file @
1e649cd8
...
...
@@ -347,6 +347,10 @@ public class GameMainQuest {
DatabaseHelper
.
saveQuest
(
this
);
}
public
void
delete
()
{
DatabaseHelper
.
deleteQuest
(
this
);
}
public
ParentQuest
toProto
()
{
ParentQuest
.
Builder
proto
=
ParentQuest
.
newBuilder
()
.
setParentQuestId
(
getParentQuestId
())
...
...
src/main/java/emu/grasscutter/game/quest/GameQuest.java
View file @
1e649cd8
...
...
@@ -181,6 +181,7 @@ public class GameQuest {
}
return
false
;
}
public
void
save
()
{
getMainQuest
().
save
();
}
...
...
src/main/java/emu/grasscutter/game/quest/QuestManager.java
View file @
1e649cd8
...
...
@@ -315,16 +315,27 @@ public class QuestManager extends BasePlayerManager {
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
);
}
if
(!
cancelAdd
)
{
this
.
getMainQuests
().
put
(
mainQuest
.
getParentQuestId
(),
mainQuest
);
}
}
}
public
List
<
GameMainQuest
>
getActiveMainQuests
()
{
return
getMainQuests
().
values
().
stream
().
filter
(
p
->
!
p
.
isFinished
()).
toList
();
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment