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
8a3d6e3d
Commit
8a3d6e3d
authored
3 years ago
by
yuyuko
Committed by
Melledy
3 years ago
Browse files
Options
Downloads
Patches
Plain Diff
Fix multi server function
parent
ebab89d4
Branches
Branches containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/main/java/emu/grasscutter/database/DatabaseHelper.java
+8
-8
8 additions, 8 deletions
src/main/java/emu/grasscutter/database/DatabaseHelper.java
with
8 additions
and
8 deletions
src/main/java/emu/grasscutter/database/DatabaseHelper.java
+
8
−
8
View file @
8a3d6e3d
...
@@ -83,33 +83,33 @@ public final class DatabaseHelper {
...
@@ -83,33 +83,33 @@ public final class DatabaseHelper {
}
}
public
static
Account
getAccountByName
(
String
username
)
{
public
static
Account
getAccountByName
(
String
username
)
{
return
DatabaseManager
.
get
Game
Datastore
().
find
(
Account
.
class
).
filter
(
Filters
.
eq
(
"username"
,
username
)).
first
();
return
DatabaseManager
.
get
Account
Datastore
().
find
(
Account
.
class
).
filter
(
Filters
.
eq
(
"username"
,
username
)).
first
();
}
}
public
static
Account
getAccountByToken
(
String
token
)
{
public
static
Account
getAccountByToken
(
String
token
)
{
if
(
token
==
null
)
return
null
;
if
(
token
==
null
)
return
null
;
return
DatabaseManager
.
get
Game
Datastore
().
find
(
Account
.
class
).
filter
(
Filters
.
eq
(
"token"
,
token
)).
first
();
return
DatabaseManager
.
get
Account
Datastore
().
find
(
Account
.
class
).
filter
(
Filters
.
eq
(
"token"
,
token
)).
first
();
}
}
public
static
Account
getAccountBySessionKey
(
String
sessionKey
)
{
public
static
Account
getAccountBySessionKey
(
String
sessionKey
)
{
if
(
sessionKey
==
null
)
return
null
;
if
(
sessionKey
==
null
)
return
null
;
return
DatabaseManager
.
get
Game
Datastore
().
find
(
Account
.
class
).
filter
(
Filters
.
eq
(
"sessionKey"
,
sessionKey
)).
first
();
return
DatabaseManager
.
get
Account
Datastore
().
find
(
Account
.
class
).
filter
(
Filters
.
eq
(
"sessionKey"
,
sessionKey
)).
first
();
}
}
public
static
Account
getAccountById
(
String
uid
)
{
public
static
Account
getAccountById
(
String
uid
)
{
return
DatabaseManager
.
get
Game
Datastore
().
find
(
Account
.
class
).
filter
(
Filters
.
eq
(
"_id"
,
uid
)).
first
();
return
DatabaseManager
.
get
Account
Datastore
().
find
(
Account
.
class
).
filter
(
Filters
.
eq
(
"_id"
,
uid
)).
first
();
}
}
public
static
Account
getAccountByPlayerId
(
int
playerId
)
{
public
static
Account
getAccountByPlayerId
(
int
playerId
)
{
return
DatabaseManager
.
get
Game
Datastore
().
find
(
Account
.
class
).
filter
(
Filters
.
eq
(
"reservedPlayerId"
,
playerId
)).
first
();
return
DatabaseManager
.
get
Account
Datastore
().
find
(
Account
.
class
).
filter
(
Filters
.
eq
(
"reservedPlayerId"
,
playerId
)).
first
();
}
}
public
static
boolean
checkIfAccountExists
(
String
name
)
{
public
static
boolean
checkIfAccountExists
(
String
name
)
{
return
DatabaseManager
.
get
Game
Datastore
().
find
(
Account
.
class
).
filter
(
Filters
.
eq
(
"username"
,
name
)).
count
()
>
0
;
return
DatabaseManager
.
get
Account
Datastore
().
find
(
Account
.
class
).
filter
(
Filters
.
eq
(
"username"
,
name
)).
count
()
>
0
;
}
}
public
static
boolean
checkIfAccountExists
(
int
reservedUid
)
{
public
static
boolean
checkIfAccountExists
(
int
reservedUid
)
{
return
DatabaseManager
.
get
Game
Datastore
().
find
(
Account
.
class
).
filter
(
Filters
.
eq
(
"reservedPlayerId"
,
reservedUid
)).
count
()
>
0
;
return
DatabaseManager
.
get
Account
Datastore
().
find
(
Account
.
class
).
filter
(
Filters
.
eq
(
"reservedPlayerId"
,
reservedUid
)).
count
()
>
0
;
}
}
public
static
void
deleteAccount
(
Account
target
)
{
public
static
void
deleteAccount
(
Account
target
)
{
...
@@ -141,7 +141,7 @@ public final class DatabaseHelper {
...
@@ -141,7 +141,7 @@ public final class DatabaseHelper {
}
}
// Finally, delete the account itself.
// Finally, delete the account itself.
DatabaseManager
.
get
Game
Datastore
().
find
(
Account
.
class
).
filter
(
Filters
.
eq
(
"id"
,
target
.
getId
())).
delete
();
DatabaseManager
.
get
Account
Datastore
().
find
(
Account
.
class
).
filter
(
Filters
.
eq
(
"id"
,
target
.
getId
())).
delete
();
}
}
public
static
List
<
Player
>
getAllPlayers
()
{
public
static
List
<
Player
>
getAllPlayers
()
{
...
...
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