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
57777283
Commit
57777283
authored
Oct 18, 2022
by
AnimeGitB
Browse files
Avoid NPE on CookingCompoundManager init
parent
2b087380
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/main/java/emu/grasscutter/game/managers/cooking/CookingCompoundManager.java
View file @
57777283
...
...
@@ -34,18 +34,16 @@ public class CookingCompoundManager extends BasePlayerManager {
public
static
void
initialize
()
{
defaultUnlockedCompounds
=
new
HashSet
<>();
compoundGroups
=
new
HashMap
<>();
for
(
var
compound
:
GameData
.
getCompoundDataMap
().
values
())
{
GameData
.
getCompoundDataMap
().
forEach
((
id
,
compound
)
->
{
if
(
compound
.
isDefaultUnlocked
())
{
defaultUnlockedCompounds
.
add
(
compound
.
getId
()
);
defaultUnlockedCompounds
.
add
(
id
);
}
if
(!
compoundGroups
.
containsKey
(
compound
.
getGroupId
()))
{
compoundGroups
.
put
(
compound
.
getGroupId
(),
new
HashSet
<>());
}
compoundGroups
.
get
(
compound
.
getGroupId
()).
add
(
compound
.
getId
());
}
compoundGroups
.
computeIfAbsent
(
compound
.
getGroupId
(),
gid
->
new
HashSet
<>()).
add
(
id
);
});
//TODO:Because we haven't implemented fishing feature,unlock all compounds related to fish.Besides,it should be bound to player rather than manager.
unlocked
=
new
HashSet
<>(
defaultUnlockedCompounds
);
unlocked
.
addAll
(
compoundGroups
.
get
(
3
));
if
(
compoundGroups
.
containsKey
(
3
))
// Avoid NPE from Resources error
unlocked
.
addAll
(
compoundGroups
.
get
(
3
));
}
private
synchronized
List
<
CompoundQueueData
>
getCompoundQueueData
()
{
...
...
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