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
c331a7f2
Unverified
Commit
c331a7f2
authored
Oct 21, 2022
by
iTruth
Committed by
GitHub
Oct 21, 2022
Browse files
Fix IllegalStateException when execute toMap (#1879)
parent
be8fbcbc
Changes
4
Hide whitespace changes
Inline
Side-by-side
src/main/java/emu/grasscutter/game/props/ItemUseAction/ItemUseOpenRandomChest.java
View file @
c331a7f2
...
...
@@ -16,10 +16,13 @@ public class ItemUseOpenRandomChest extends ItemUseInt {
@Override
public
boolean
useItem
(
UseItemParams
params
)
{
// cash shop material bundles
var
rewardItems
=
params
.
player
.
getServer
().
getShopSystem
().
getShopChestData
(
this
.
i
).
stream
().
map
(
GameItem:
:
new
).
toList
();
var
data
=
params
.
player
.
getServer
().
getShopSystem
().
getShopChestData
(
this
.
i
);
if
(
data
==
null
)
return
false
;
var
rewardItems
=
data
.
stream
().
map
(
GameItem:
:
new
).
toList
();
if
(!
rewardItems
.
isEmpty
())
{
params
.
player
.
getInventory
().
addItems
(
rewardItems
,
ActionReason
.
Shop
);
}
return
fals
e
;
return
tru
e
;
}
}
src/main/java/emu/grasscutter/scripts/data/SceneBlock.java
View file @
c331a7f2
...
...
@@ -62,7 +62,7 @@ public class SceneBlock {
// Set groups
this
.
groups
=
ScriptLoader
.
getSerializer
().
toList
(
SceneGroup
.
class
,
bindings
.
get
(
"groups"
)).
stream
()
.
collect
(
Collectors
.
toMap
(
x
->
x
.
id
,
y
->
y
));
.
collect
(
Collectors
.
toMap
(
x
->
x
.
id
,
y
->
y
,
(
a
,
b
)
->
a
));
this
.
groups
.
values
().
forEach
(
g
->
g
.
block_id
=
this
.
id
);
this
.
sceneGroupIndex
=
SceneIndexManager
.
buildIndex
(
3
,
this
.
groups
.
values
(),
g
->
g
.
pos
.
toPoint
());
...
...
src/main/java/emu/grasscutter/scripts/data/SceneGroup.java
View file @
c331a7f2
...
...
@@ -96,20 +96,20 @@ public class SceneGroup {
// Set
this
.
monsters
=
ScriptLoader
.
getSerializer
().
toList
(
SceneMonster
.
class
,
this
.
bindings
.
get
(
"monsters"
)).
stream
()
.
collect
(
Collectors
.
toMap
(
x
->
x
.
config_id
,
y
->
y
));
.
collect
(
Collectors
.
toMap
(
x
->
x
.
config_id
,
y
->
y
,
(
a
,
b
)
->
a
));
this
.
monsters
.
values
().
forEach
(
m
->
m
.
group
=
this
);
this
.
gadgets
=
ScriptLoader
.
getSerializer
().
toList
(
SceneGadget
.
class
,
this
.
bindings
.
get
(
"gadgets"
)).
stream
()
.
collect
(
Collectors
.
toMap
(
x
->
x
.
config_id
,
y
->
y
));
.
collect
(
Collectors
.
toMap
(
x
->
x
.
config_id
,
y
->
y
,
(
a
,
b
)
->
a
));
this
.
gadgets
.
values
().
forEach
(
m
->
m
.
group
=
this
);
this
.
triggers
=
ScriptLoader
.
getSerializer
().
toList
(
SceneTrigger
.
class
,
this
.
bindings
.
get
(
"triggers"
)).
stream
()
.
collect
(
Collectors
.
toMap
(
x
->
x
.
name
,
y
->
y
));
.
collect
(
Collectors
.
toMap
(
x
->
x
.
name
,
y
->
y
,
(
a
,
b
)
->
a
));
this
.
triggers
.
values
().
forEach
(
t
->
t
.
currentGroup
=
this
);
this
.
suites
=
ScriptLoader
.
getSerializer
().
toList
(
SceneSuite
.
class
,
this
.
bindings
.
get
(
"suites"
));
this
.
regions
=
ScriptLoader
.
getSerializer
().
toList
(
SceneRegion
.
class
,
this
.
bindings
.
get
(
"regions"
)).
stream
()
.
collect
(
Collectors
.
toMap
(
x
->
x
.
config_id
,
y
->
y
));
.
collect
(
Collectors
.
toMap
(
x
->
x
.
config_id
,
y
->
y
,
(
a
,
b
)
->
a
));
this
.
regions
.
values
().
forEach
(
m
->
m
.
group
=
this
);
this
.
init_config
=
ScriptLoader
.
getSerializer
().
toObject
(
SceneInitConfig
.
class
,
this
.
bindings
.
get
(
"init_config"
));
...
...
src/main/java/emu/grasscutter/scripts/data/SceneMeta.java
View file @
c331a7f2
...
...
@@ -60,7 +60,7 @@ public class SceneMeta {
}
this
.
blocks
=
blocks
.
stream
().
collect
(
Collectors
.
toMap
(
b
->
b
.
id
,
b
->
b
));
this
.
blocks
=
blocks
.
stream
().
collect
(
Collectors
.
toMap
(
b
->
b
.
id
,
b
->
b
,
(
a
,
b
)
->
a
));
this
.
sceneBlockIndex
=
SceneIndexManager
.
buildIndex
(
2
,
blocks
,
SceneBlock:
:
toRectangle
);
}
catch
(
ScriptException
exception
)
{
...
...
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