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
f58c590a
Commit
f58c590a
authored
Apr 20, 2022
by
KingRainbow44
Browse files
Add config option
parent
dd826abb
Changes
2
Show whitespace changes
Inline
Side-by-side
src/main/java/emu/grasscutter/Config.java
View file @
f58c590a
...
@@ -53,5 +53,6 @@ public final class Config {
...
@@ -53,5 +53,6 @@ public final class Config {
public
int
MaxEntityLimit
=
1000
;
// Max entity limit per world. // TODO: Enforce later.
public
int
MaxEntityLimit
=
1000
;
// Max entity limit per world. // TODO: Enforce later.
public
int
[]
WelcomeEmotes
=
{
2007
,
1002
,
4010
};
public
int
[]
WelcomeEmotes
=
{
2007
,
1002
,
4010
};
public
String
WelcomeMotd
=
"Welcome to Grasscutter emu"
;
public
String
WelcomeMotd
=
"Welcome to Grasscutter emu"
;
public
boolean
AutomaticallyCreateAccounts
=
false
;
}
}
}
}
src/main/java/emu/grasscutter/server/dispatch/DispatchServer.java
View file @
f58c590a
...
@@ -226,15 +226,23 @@ public final class DispatchServer {
...
@@ -226,15 +226,23 @@ public final class DispatchServer {
Account
account
=
DatabaseHelper
.
getAccountByName
(
requestData
.
account
);
Account
account
=
DatabaseHelper
.
getAccountByName
(
requestData
.
account
);
// Check if account exists, else create a new one.
// Check if account exists, else create a new one.
if
(
account
==
null
)
{
if
(
account
==
null
&&
Grasscutter
.
getConfig
().
ServerOptions
.
AutomaticallyCreateAccounts
)
{
account
=
DatabaseHelper
.
createAccountWithId
(
requestData
.
account
,
0
);
// This account has been created AUTOMATICALLY. There will be no permissions added.
// This account has been created AUTOMATICALLY. There will be no permissions added.
}
account
=
DatabaseHelper
.
createAccountWithId
(
requestData
.
account
,
0
);
responseData
.
message
=
"OK"
;
responseData
.
message
=
"OK"
;
responseData
.
data
.
account
.
uid
=
account
.
getId
();
responseData
.
data
.
account
.
uid
=
account
.
getId
();
responseData
.
data
.
account
.
token
=
account
.
generateSessionKey
();
responseData
.
data
.
account
.
token
=
account
.
generateSessionKey
();
responseData
.
data
.
account
.
email
=
account
.
getEmail
();
responseData
.
data
.
account
.
email
=
account
.
getEmail
();
}
else
if
(!
Grasscutter
.
getConfig
().
ServerOptions
.
AutomaticallyCreateAccounts
)
{
responseData
.
retcode
=
-
201
;
responseData
.
message
=
"Username not found."
;
}
else
{
responseData
.
message
=
"OK"
;
responseData
.
data
.
account
.
uid
=
account
.
getId
();
responseData
.
data
.
account
.
token
=
account
.
generateSessionKey
();
responseData
.
data
.
account
.
email
=
account
.
getEmail
();
}
// Create a response
// Create a response
String
response
=
getGsonFactory
().
toJson
(
responseData
);
String
response
=
getGsonFactory
().
toJson
(
responseData
);
...
...
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