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
a90455a7
Unverified
Commit
a90455a7
authored
Sep 18, 2022
by
Melledy
Browse files
Add `-game` and `-dispatch` startup arguments that override the run mode in the config
parent
0d64e2e8
Changes
2
Hide whitespace changes
Inline
Side-by-side
src/main/java/emu/grasscutter/Grasscutter.java
View file @
a90455a7
...
...
@@ -56,6 +56,7 @@ public final class Grasscutter {
private
static
Language
language
;
public
static
final
File
configFile
=
new
File
(
"./config.json"
);
@Setter
private
static
ServerRunMode
runModeOverride
=
null
;
// Config override for run mode
private
static
int
day
;
// Current day of week.
@Getter
@Setter
private
static
String
preferredLanguage
;
...
...
@@ -141,7 +142,7 @@ public final class Grasscutter {
httpServer
.
addRouter
(
DocumentationServerHandler
.
class
);
// Start servers.
var
runMode
=
SERVER
.
r
unMode
;
var
runMode
=
Grasscutter
.
getR
unMode
()
;
if
(
runMode
==
ServerRunMode
.
HYBRID
)
{
httpServer
.
start
();
gameServer
.
start
();
...
...
@@ -245,6 +246,10 @@ public final class Grasscutter {
public
static
Language
getLanguage
(
String
langCode
)
{
return
Language
.
getLanguage
(
langCode
);
}
public
static
ServerRunMode
getRunMode
()
{
return
Grasscutter
.
runModeOverride
!=
null
?
Grasscutter
.
runModeOverride
:
SERVER
.
runMode
;
}
public
static
Logger
getLogger
()
{
return
log
;
...
...
src/main/java/emu/grasscutter/utils/StartupArguments.java
View file @
a90455a7
...
...
@@ -4,6 +4,7 @@ import ch.qos.logback.classic.Level;
import
ch.qos.logback.classic.Logger
;
import
emu.grasscutter.BuildConfig
;
import
emu.grasscutter.Grasscutter
;
import
emu.grasscutter.Grasscutter.ServerRunMode
;
import
emu.grasscutter.net.packet.PacketOpcodesUtils
;
import
io.javalin.core.util.JavalinLogger
;
import
org.slf4j.LoggerFactory
;
...
...
@@ -28,6 +29,10 @@ public final class StartupArguments {
"-debug"
,
StartupArguments:
:
enableDebug
,
"-lang"
,
parameter
->
{
Grasscutter
.
setPreferredLanguage
(
parameter
);
return
false
;
},
"-game"
,
parameter
->
{
Grasscutter
.
setRunModeOverride
(
ServerRunMode
.
GAME_ONLY
);
return
false
;
},
"-dispatch"
,
parameter
->
{
Grasscutter
.
setRunModeOverride
(
ServerRunMode
.
DISPATCH_ONLY
);
return
false
;
},
// Aliases.
...
...
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