Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
G
Grasscutter
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Wiki
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
ziqian zhang
Grasscutter
Commits
f58c590a
Commit
f58c590a
authored
3 years ago
by
KingRainbow44
Browse files
Options
Downloads
Patches
Plain Diff
Add config option
parent
dd826abb
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/main/java/emu/grasscutter/Config.java
+1
-0
1 addition, 0 deletions
src/main/java/emu/grasscutter/Config.java
src/main/java/emu/grasscutter/server/dispatch/DispatchServer.java
+15
-7
15 additions, 7 deletions
.../java/emu/grasscutter/server/dispatch/DispatchServer.java
with
16 additions
and
7 deletions
src/main/java/emu/grasscutter/Config.java
+
1
−
0
View file @
f58c590a
...
...
@@ -53,5 +53,6 @@ public final class Config {
public
int
MaxEntityLimit
=
1000
;
// Max entity limit per world. // TODO: Enforce later.
public
int
[]
WelcomeEmotes
=
{
2007
,
1002
,
4010
};
public
String
WelcomeMotd
=
"Welcome to Grasscutter emu"
;
public
boolean
AutomaticallyCreateAccounts
=
false
;
}
}
This diff is collapsed.
Click to expand it.
src/main/java/emu/grasscutter/server/dispatch/DispatchServer.java
+
15
−
7
View file @
f58c590a
...
...
@@ -226,15 +226,23 @@ public final class DispatchServer {
Account
account
=
DatabaseHelper
.
getAccountByName
(
requestData
.
account
);
// Check if account exists, else create a new one.
if
(
account
==
null
)
{
account
=
DatabaseHelper
.
createAccountWithId
(
requestData
.
account
,
0
);
if
(
account
==
null
&&
Grasscutter
.
getConfig
().
ServerOptions
.
AutomaticallyCreateAccounts
)
{
// This account has been created AUTOMATICALLY. There will be no permissions added.
}
account
=
DatabaseHelper
.
createAccountWithId
(
requestData
.
account
,
0
);
responseData
.
message
=
"OK"
;
responseData
.
data
.
account
.
uid
=
account
.
getId
();
responseData
.
data
.
account
.
token
=
account
.
generateSessionKey
();
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
String
response
=
getGsonFactory
().
toJson
(
responseData
);
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment