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
8a3d6e3d
Commit
8a3d6e3d
authored
Jun 15, 2022
by
yuyuko
Committed by
Melledy
Jun 14, 2022
Browse files
Fix multi server function
parent
ebab89d4
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/main/java/emu/grasscutter/database/DatabaseHelper.java
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
()
{
...
...
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