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
2b0ce0a4
Commit
2b0ce0a4
authored
Apr 18, 2022
by
Melledy
Committed by
GitHub
Apr 18, 2022
Browse files
Merge pull request #5 from lilmayofuksu/main
Add support for specifying a Public IP
parents
dd2d4b9f
f769ef18
Changes
3
Show whitespace changes
Inline
Side-by-side
src/main/java/emu/grasscutter/Config.java
View file @
2b0ce0a4
...
@@ -2,12 +2,14 @@ package emu.grasscutter;
...
@@ -2,12 +2,14 @@ package emu.grasscutter;
public
final
class
Config
{
public
final
class
Config
{
public
String
DispatchServerIp
=
"127.0.0.1"
;
public
String
DispatchServerIp
=
"127.0.0.1"
;
public
String
DispatchServerPublicIp
=
""
;
public
int
DispatchServerPort
=
443
;
public
int
DispatchServerPort
=
443
;
public
String
DispatchServerKeystorePath
=
"./keystore.p12"
;
public
String
DispatchServerKeystorePath
=
"./keystore.p12"
;
public
String
DispatchServerKeystorePassword
=
""
;
public
String
DispatchServerKeystorePassword
=
""
;
public
String
GameServerName
=
"Test"
;
public
String
GameServerName
=
"Test"
;
public
String
GameServerIp
=
"127.0.0.1"
;
public
String
GameServerIp
=
"127.0.0.1"
;
public
String
GameServerPublicIp
=
""
;
public
int
GameServerPort
=
22102
;
public
int
GameServerPort
=
22102
;
public
String
DatabaseUrl
=
"mongodb://localhost:27017"
;
public
String
DatabaseUrl
=
"mongodb://localhost:27017"
;
...
...
src/main/java/emu/grasscutter/game/gacha/GachaBanner.java
View file @
2b0ce0a4
...
@@ -92,7 +92,7 @@ public class GachaBanner {
...
@@ -92,7 +92,7 @@ public class GachaBanner {
}
}
public
GachaInfo
toProto
()
{
public
GachaInfo
toProto
()
{
String
record
=
"http://"
+
Grasscutter
.
getConfig
().
DispatchServerIp
+
"/gacha"
;
String
record
=
"http://"
+
(
Grasscutter
.
getConfig
().
DispatchServerPublicIp
.
isEmpty
()
?
Grasscutter
.
getConfig
().
DispatchServerIp
:
Grasscutter
.
getConfig
().
DispatchServerPublicIp
)
+
"/gacha"
;
GachaInfo
.
Builder
info
=
GachaInfo
.
newBuilder
()
GachaInfo
.
Builder
info
=
GachaInfo
.
newBuilder
()
.
setGachaType
(
this
.
getGachaType
())
.
setGachaType
(
this
.
getGachaType
())
...
...
src/main/java/emu/grasscutter/server/dispatch/DispatchServer.java
View file @
2b0ce0a4
...
@@ -104,14 +104,14 @@ public final class DispatchServer {
...
@@ -104,14 +104,14 @@ public final class DispatchServer {
.
setName
(
"os_usa"
)
.
setName
(
"os_usa"
)
.
setTitle
(
Grasscutter
.
getConfig
().
GameServerName
)
.
setTitle
(
Grasscutter
.
getConfig
().
GameServerName
)
.
setType
(
"DEV_PUBLIC"
)
.
setType
(
"DEV_PUBLIC"
)
.
setDispatchUrl
(
"https://"
+
Grasscutter
.
getConfig
().
DispatchServerIp
+
":"
+
getAddress
().
getPort
()
+
"/query_cur_region"
)
.
setDispatchUrl
(
"https://"
+
(
Grasscutter
.
getConfig
().
DispatchServerPublicIp
.
isEmpty
()
?
Grasscutter
.
getConfig
().
DispatchServerIp
:
Grasscutter
.
getConfig
().
DispatchServerPublicIp
)
+
":"
+
getAddress
().
getPort
()
+
"/query_cur_region"
)
.
build
();
.
build
();
RegionSimpleInfo
serverTest2
=
RegionSimpleInfo
.
newBuilder
()
RegionSimpleInfo
serverTest2
=
RegionSimpleInfo
.
newBuilder
()
.
setName
(
"os_euro"
)
.
setName
(
"os_euro"
)
.
setTitle
(
"Grasscutter"
)
.
setTitle
(
"Grasscutter"
)
.
setType
(
"DEV_PUBLIC"
)
.
setType
(
"DEV_PUBLIC"
)
.
setDispatchUrl
(
"https://"
+
Grasscutter
.
getConfig
().
DispatchServerIp
+
":"
+
getAddress
().
getPort
()
+
"/query_cur_region"
)
.
setDispatchUrl
(
"https://"
+
(
Grasscutter
.
getConfig
().
DispatchServerPublicIp
.
isEmpty
()
?
Grasscutter
.
getConfig
().
DispatchServerIp
:
Grasscutter
.
getConfig
().
DispatchServerPublicIp
)
+
":"
+
getAddress
().
getPort
()
+
"/query_cur_region"
)
.
build
();
.
build
();
QueryRegionListHttpRsp
regionList
=
QueryRegionListHttpRsp
.
newBuilder
()
QueryRegionListHttpRsp
regionList
=
QueryRegionListHttpRsp
.
newBuilder
()
...
@@ -123,7 +123,7 @@ public final class DispatchServer {
...
@@ -123,7 +123,7 @@ public final class DispatchServer {
.
build
();
.
build
();
RegionInfo
currentRegion
=
regionQuery
.
getRegionInfo
().
toBuilder
()
RegionInfo
currentRegion
=
regionQuery
.
getRegionInfo
().
toBuilder
()
.
setIp
(
Grasscutter
.
getConfig
().
GameServerIp
)
.
setIp
(
(
Grasscutter
.
getConfig
().
GameServerPublicIp
.
isEmpty
()
?
Grasscutter
.
getConfig
().
GameServerIp
:
Grasscutter
.
getConfig
().
GameServerPublicIp
)
)
.
setPort
(
Grasscutter
.
getConfig
().
GameServerPort
)
.
setPort
(
Grasscutter
.
getConfig
().
GameServerPort
)
.
setSecretKey
(
ByteString
.
copyFrom
(
FileUtils
.
read
(
Grasscutter
.
getConfig
().
KEY_FOLDER
+
"dispatchSeed.bin"
)))
.
setSecretKey
(
ByteString
.
copyFrom
(
FileUtils
.
read
(
Grasscutter
.
getConfig
().
KEY_FOLDER
+
"dispatchSeed.bin"
)))
.
build
();
.
build
();
...
...
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