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
668461a6
Unverified
Commit
668461a6
authored
Dec 30, 2022
by
KingRainbow44
Browse files
Clean-Up Startup Sequence
hey i like it clean ok.. dont judge..
parent
fe80290b
Changes
4
Show whitespace changes
Inline
Side-by-side
src/main/java/emu/grasscutter/Grasscutter.java
View file @
668461a6
...
...
@@ -112,7 +112,7 @@ public final class Grasscutter {
ScriptLoader
.
init
();
// Generate handbooks.
Tools
.
createGmHandbooks
();
Tools
.
createGmHandbooks
(
false
);
// Initialize database.
DatabaseManager
.
initialize
();
...
...
src/main/java/emu/grasscutter/data/DataLoader.java
View file @
668461a6
...
...
@@ -92,7 +92,7 @@ public class DataLoader {
public
static
<
T
>
List
<
T
>
loadTableToList
(
String
resourcePath
,
Class
<
T
>
classType
)
throws
IOException
{
val
path
=
FileUtils
.
getDataPathTsjJsonTsv
(
resourcePath
);
Grasscutter
.
getLogger
().
info
(
"Loading data table from: "
+
path
);
Grasscutter
.
getLogger
().
debug
(
"Loading data table from: "
+
path
);
return
switch
(
FileUtils
.
getFileExtension
(
path
))
{
case
"json"
->
JsonUtils
.
loadToList
(
path
,
classType
);
case
"tsj"
->
TsvUtils
.
loadTsjToListSetField
(
path
,
classType
);
...
...
src/main/java/emu/grasscutter/tools/Tools.java
View file @
668461a6
...
...
@@ -30,12 +30,24 @@ import it.unimi.dsi.fastutil.ints.Int2IntRBTreeMap;
import
it.unimi.dsi.fastutil.ints.Int2ObjectRBTreeMap
;
import
lombok.val
;
import
static
emu
.
grasscutter
.
config
.
Configuration
.*;
import
static
emu
.
grasscutter
.
utils
.
FileUtils
.
getResourcePath
;
import
static
emu
.
grasscutter
.
utils
.
Language
.
getTextMapKey
;
public
final
class
Tools
{
/**
* This generates the GM handbooks with a message by default.
* @throws Exception If an error occurs while generating the handbooks.
*/
public
static
void
createGmHandbooks
()
throws
Exception
{
Tools
.
createGmHandbooks
(
true
);
}
/**
* Generates a GM handbook for each language.
* @param message Should a message be printed to the console?
* @throws Exception If an error occurs while generating the handbooks.
*/
public
static
void
createGmHandbooks
(
boolean
message
)
throws
Exception
{
val
languages
=
Language
.
TextStrings
.
getLanguages
();
ResourceLoader
.
loadAll
();
...
...
@@ -48,7 +60,7 @@ public final class Tools {
val
sceneDataMap
=
new
Int2ObjectRBTreeMap
<>(
GameData
.
getSceneDataMap
());
val
questDataMap
=
new
Int2ObjectRBTreeMap
<>(
GameData
.
getQuestDataMap
());
Function
<
SortedMap
,
String
>
getPad
=
m
->
"%"
+
m
.
lastKey
().
toString
().
length
()
+
"s : "
;
Function
<
SortedMap
<?,
?>
,
String
>
getPad
=
m
->
"%"
+
m
.
lastKey
().
toString
().
length
()
+
"s : "
;
// Create builders and helper functions
val
handbookBuilders
=
IntStream
.
range
(
0
,
TextStrings
.
NUM_LANGUAGES
).
mapToObj
(
i
->
new
StringBuilder
()).
toList
();
...
...
@@ -143,7 +155,8 @@ public final class Tools {
writer
.
write
(
handbookBuilders
.
get
(
i
).
toString
());
}
}
Grasscutter
.
getLogger
().
info
(
"GM Handbooks generated!"
);
if
(
message
)
Grasscutter
.
getLogger
().
info
(
"GM Handbooks generated!"
);
}
public
static
List
<
String
>
createGachaMappingJsons
()
{
...
...
src/main/java/emu/grasscutter/utils/Language.java
View file @
668461a6
...
...
@@ -417,7 +417,7 @@ public final class Language {
Grasscutter
.
getLogger
().
debug
(
"Cache modified %d, textmap modified %d"
.
formatted
(
cacheModified
,
textmapsModified
));
if
(
textmapsModified
<
cacheModified
)
{
// Try loading from cache
Grasscutter
.
getLogger
().
info
(
"Loading cached TextMaps"
);
Grasscutter
.
getLogger
().
info
(
"Loading cached
'
TextMaps
'...
"
);
textMapStrings
=
loadTextMapsCache
();
return
;
}
...
...
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