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
7fb26c38
Commit
7fb26c38
authored
May 19, 2022
by
xtaodada
Committed by
Melledy
May 18, 2022
Browse files
Autogenerate document files
parent
e3ed3968
Changes
7
Hide whitespace changes
Inline
Side-by-side
src/main/java/emu/grasscutter/Configuration.java
View file @
7fb26c38
...
@@ -26,6 +26,7 @@ public final class Configuration extends ConfigContainer {
...
@@ -26,6 +26,7 @@ public final class Configuration extends ConfigContainer {
public
static
final
Locale
LANGUAGE
=
config
.
language
.
language
;
public
static
final
Locale
LANGUAGE
=
config
.
language
.
language
;
public
static
final
Locale
FALLBACK_LANGUAGE
=
config
.
language
.
fallback
;
public
static
final
Locale
FALLBACK_LANGUAGE
=
config
.
language
.
fallback
;
public
static
final
String
DOCUMENT_LANGUAGE
=
config
.
language
.
document
;
private
static
final
String
DATA_FOLDER
=
config
.
folderStructure
.
data
;
private
static
final
String
DATA_FOLDER
=
config
.
folderStructure
.
data
;
private
static
final
String
RESOURCES_FOLDER
=
config
.
folderStructure
.
resources
;
private
static
final
String
RESOURCES_FOLDER
=
config
.
folderStructure
.
resources
;
private
static
final
String
PLUGINS_FOLDER
=
config
.
folderStructure
.
plugins
;
private
static
final
String
PLUGINS_FOLDER
=
config
.
folderStructure
.
plugins
;
...
...
src/main/java/emu/grasscutter/server/http/documentation/GachaMappingRequestHandler.java
View file @
7fb26c38
...
@@ -5,11 +5,10 @@ import static emu.grasscutter.Configuration.RESOURCE;
...
@@ -5,11 +5,10 @@ import static emu.grasscutter.Configuration.RESOURCE;
import
com.google.gson.reflect.TypeToken
;
import
com.google.gson.reflect.TypeToken
;
import
emu.grasscutter.Grasscutter
;
import
emu.grasscutter.Grasscutter
;
import
emu.grasscutter.data.GameData
;
import
emu.grasscutter.data.GameData
;
import
emu.grasscutter.data.ResourceLoader
;
import
emu.grasscutter.data.def.AvatarData
;
import
emu.grasscutter.data.def.AvatarData
;
import
emu.grasscutter.data.def.ItemData
;
import
emu.grasscutter.data.def.ItemData
;
import
emu.grasscutter.tools.Tools
;
import
emu.grasscutter.utils.Utils
;
import
emu.grasscutter.utils.Utils
;
import
static
emu
.
grasscutter
.
Configuration
.
DOCUMENT_LANGUAGE
;
import
express.http.Request
;
import
express.http.Request
;
import
express.http.Response
;
import
express.http.Response
;
import
java.io.FileInputStream
;
import
java.io.FileInputStream
;
...
@@ -27,8 +26,7 @@ final class GachaMappingRequestHandler implements DocumentationHandler {
...
@@ -27,8 +26,7 @@ final class GachaMappingRequestHandler implements DocumentationHandler {
private
Map
<
Long
,
String
>
map
;
private
Map
<
Long
,
String
>
map
;
GachaMappingRequestHandler
()
{
GachaMappingRequestHandler
()
{
ResourceLoader
.
loadResources
();
final
String
textMapFile
=
"TextMap/TextMap"
+
DOCUMENT_LANGUAGE
+
".json"
;
final
String
textMapFile
=
"TextMap/TextMap"
+
Tools
.
getLanguageOption
()
+
".json"
;
try
(
InputStreamReader
fileReader
=
new
InputStreamReader
(
new
FileInputStream
(
try
(
InputStreamReader
fileReader
=
new
InputStreamReader
(
new
FileInputStream
(
Utils
.
toFilePath
(
RESOURCE
(
textMapFile
))),
StandardCharsets
.
UTF_8
))
{
Utils
.
toFilePath
(
RESOURCE
(
textMapFile
))),
StandardCharsets
.
UTF_8
))
{
map
=
Grasscutter
.
getGsonFactory
().
fromJson
(
fileReader
,
map
=
Grasscutter
.
getGsonFactory
().
fromJson
(
fileReader
,
...
...
src/main/java/emu/grasscutter/server/http/documentation/HandbookRequestHandler.java
View file @
7fb26c38
package
emu.grasscutter.server.http.documentation
;
package
emu.grasscutter.server.http.documentation
;
import
static
emu
.
grasscutter
.
Configuration
.
DATA
;
import
static
emu
.
grasscutter
.
Configuration
.*;
import
static
emu
.
grasscutter
.
Configuration
.
RESOURCE
;
import
static
emu
.
grasscutter
.
utils
.
Language
.
translate
;
import
static
emu
.
grasscutter
.
utils
.
Language
.
translate
;
import
com.google.gson.reflect.TypeToken
;
import
com.google.gson.reflect.TypeToken
;
import
emu.grasscutter.Grasscutter
;
import
emu.grasscutter.Grasscutter
;
import
emu.grasscutter.command.CommandMap
;
import
emu.grasscutter.command.CommandMap
;
import
emu.grasscutter.data.GameData
;
import
emu.grasscutter.data.GameData
;
import
emu.grasscutter.data.ResourceLoader
;
import
emu.grasscutter.data.def.AvatarData
;
import
emu.grasscutter.data.def.AvatarData
;
import
emu.grasscutter.data.def.ItemData
;
import
emu.grasscutter.data.def.ItemData
;
import
emu.grasscutter.data.def.MonsterData
;
import
emu.grasscutter.data.def.MonsterData
;
import
emu.grasscutter.data.def.SceneData
;
import
emu.grasscutter.data.def.SceneData
;
import
emu.grasscutter.tools.Tools
;
import
emu.grasscutter.utils.FileUtils
;
import
emu.grasscutter.utils.FileUtils
;
import
emu.grasscutter.utils.Utils
;
import
emu.grasscutter.utils.Utils
;
import
express.http.Request
;
import
express.http.Request
;
...
@@ -35,7 +32,6 @@ final class HandbookRequestHandler implements DocumentationHandler {
...
@@ -35,7 +32,6 @@ final class HandbookRequestHandler implements DocumentationHandler {
public
HandbookRequestHandler
()
{
public
HandbookRequestHandler
()
{
ResourceLoader
.
loadResources
();
final
File
templateFile
=
new
File
(
Utils
.
toFilePath
(
DATA
(
"documentation/handbook.html"
)));
final
File
templateFile
=
new
File
(
Utils
.
toFilePath
(
DATA
(
"documentation/handbook.html"
)));
if
(
templateFile
.
exists
())
{
if
(
templateFile
.
exists
())
{
template
=
new
String
(
FileUtils
.
read
(
templateFile
),
StandardCharsets
.
UTF_8
);
template
=
new
String
(
FileUtils
.
read
(
templateFile
),
StandardCharsets
.
UTF_8
);
...
@@ -44,7 +40,7 @@ final class HandbookRequestHandler implements DocumentationHandler {
...
@@ -44,7 +40,7 @@ final class HandbookRequestHandler implements DocumentationHandler {
template
=
null
;
template
=
null
;
}
}
final
String
textMapFile
=
"TextMap/TextMap"
+
Tools
.
getLanguageOption
()
+
".json"
;
final
String
textMapFile
=
"TextMap/TextMap"
+
DOCUMENT_LANGUAGE
+
".json"
;
try
(
InputStreamReader
fileReader
=
new
InputStreamReader
(
new
FileInputStream
(
try
(
InputStreamReader
fileReader
=
new
InputStreamReader
(
new
FileInputStream
(
Utils
.
toFilePath
(
RESOURCE
(
textMapFile
))),
StandardCharsets
.
UTF_8
))
{
Utils
.
toFilePath
(
RESOURCE
(
textMapFile
))),
StandardCharsets
.
UTF_8
))
{
map
=
Grasscutter
.
getGsonFactory
()
map
=
Grasscutter
.
getGsonFactory
()
...
...
src/main/java/emu/grasscutter/server/http/documentation/RootRequestHandler.java
View file @
7fb26c38
...
@@ -17,7 +17,6 @@ final class RootRequestHandler implements DocumentationHandler {
...
@@ -17,7 +17,6 @@ final class RootRequestHandler implements DocumentationHandler {
private
final
String
template
;
private
final
String
template
;
public
RootRequestHandler
()
{
public
RootRequestHandler
()
{
ResourceLoader
.
loadResources
();
final
File
templateFile
=
new
File
(
Utils
.
toFilePath
(
DATA
(
"documentation/index.html"
)));
final
File
templateFile
=
new
File
(
Utils
.
toFilePath
(
DATA
(
"documentation/index.html"
)));
if
(
templateFile
.
exists
())
{
if
(
templateFile
.
exists
())
{
template
=
new
String
(
FileUtils
.
read
(
templateFile
),
StandardCharsets
.
UTF_8
);
template
=
new
String
(
FileUtils
.
read
(
templateFile
),
StandardCharsets
.
UTF_8
);
...
...
src/main/java/emu/grasscutter/utils/ConfigContainer.java
View file @
7fb26c38
...
@@ -104,6 +104,7 @@ public class ConfigContainer {
...
@@ -104,6 +104,7 @@ public class ConfigContainer {
public
static
class
Language
{
public
static
class
Language
{
public
Locale
language
=
Locale
.
getDefault
();
public
Locale
language
=
Locale
.
getDefault
();
public
Locale
fallback
=
Locale
.
US
;
public
Locale
fallback
=
Locale
.
US
;
public
String
document
=
"EN"
;
}
}
public
static
class
Account
{
public
static
class
Account
{
...
...
data/documentation/handbook.html
→
src/main/resources/defaults/
data/documentation/handbook.html
View file @
7fb26c38
File moved
data/documentation/index.html
→
src/main/resources/defaults/
data/documentation/index.html
View file @
7fb26c38
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