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
a8f38ad9
Commit
a8f38ad9
authored
May 18, 2022
by
Melledy
Browse files
Move chest rewards to new data format
parent
fe4e5990
Changes
2
Hide whitespace changes
Inline
Side-by-side
src/main/java/emu/grasscutter/game/world/WorldDataManager.java
View file @
a8f38ad9
...
@@ -2,8 +2,11 @@ package emu.grasscutter.game.world;
...
@@ -2,8 +2,11 @@ package emu.grasscutter.game.world;
import
com.google.gson.reflect.TypeToken
;
import
com.google.gson.reflect.TypeToken
;
import
emu.grasscutter.Grasscutter
;
import
emu.grasscutter.Grasscutter
;
import
emu.grasscutter.data.DataLoader
;
import
emu.grasscutter.server.game.GameServer
;
import
emu.grasscutter.server.game.GameServer
;
import
java.io.InputStream
;
import
java.io.InputStreamReader
;
import
java.nio.file.Files
;
import
java.nio.file.Files
;
import
java.nio.file.Path
;
import
java.nio.file.Path
;
import
java.util.HashMap
;
import
java.util.HashMap
;
...
@@ -23,13 +26,13 @@ public class WorldDataManager {
...
@@ -23,13 +26,13 @@ public class WorldDataManager {
}
}
public
synchronized
void
load
(){
public
synchronized
void
load
(){
try
{
try
(
InputStream
is
=
DataLoader
.
load
(
"ChestReward.json"
,
false
);
InputStreamReader
isr
=
new
InputStreamReader
(
is
))
{
List
<
ChestReward
>
chestReward
=
Grasscutter
.
getGsonFactory
().
fromJson
(
List
<
ChestReward
>
chestReward
=
Grasscutter
.
getGsonFactory
().
fromJson
(
Files
.
readString
(
Path
.
of
(
DATA
(
"ChestReward.json"
)))
,
isr
,
TypeToken
.
getParameterized
(
List
.
class
,
ChestReward
.
class
).
getType
());
TypeToken
.
getParameterized
(
List
.
class
,
ChestReward
.
class
).
getType
());
chestReward
.
forEach
(
reward
->
chestReward
.
forEach
(
reward
->
reward
.
getObjNames
().
forEach
(
name
->
chestRewardMap
.
put
(
name
,
reward
)));
reward
.
getObjNames
().
forEach
(
name
->
chestRewardMap
.
put
(
name
,
reward
)));
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
Grasscutter
.
getLogger
().
error
(
"Unable to load chest reward config."
,
e
);
Grasscutter
.
getLogger
().
error
(
"Unable to load chest reward config."
,
e
);
}
}
...
...
data/ChestReward.json
→
src/main/resources/defaults/
data/ChestReward.json
View file @
a8f38ad9
File moved
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