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
1c820750
Commit
1c820750
authored
May 09, 2022
by
ImmuState
Committed by
Melledy
May 09, 2022
Browse files
Remove commented method and unused import.
parent
19e798a2
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/main/java/emu/grasscutter/database/DatabaseHelper.java
View file @
1c820750
...
@@ -4,7 +4,6 @@ import java.util.List;
...
@@ -4,7 +4,6 @@ import java.util.List;
import
com.mongodb.client.result.DeleteResult
;
import
com.mongodb.client.result.DeleteResult
;
import
dev.morphia.experimental.MorphiaSession
;
import
dev.morphia.query.FindOptions
;
import
dev.morphia.query.FindOptions
;
import
dev.morphia.query.Sort
;
import
dev.morphia.query.Sort
;
import
dev.morphia.query.experimental.filters.Filters
;
import
dev.morphia.query.experimental.filters.Filters
;
...
@@ -97,14 +96,11 @@ public final class DatabaseHelper {
...
@@ -97,14 +96,11 @@ public final class DatabaseHelper {
return
DatabaseManager
.
getDatastore
().
find
(
Account
.
class
).
filter
(
Filters
.
eq
(
"playerId"
,
playerId
)).
first
();
return
DatabaseManager
.
getDatastore
().
find
(
Account
.
class
).
filter
(
Filters
.
eq
(
"playerId"
,
playerId
)).
first
();
}
}
//public static boolean deleteAccount(String username) {
// return DatabaseManager.getDatastore().find(Account.class).filter(Filters.eq("username", username)).delete().getDeletedCount() > 0;
//}
public
static
void
deleteAccount
(
Account
target
)
{
public
static
void
deleteAccount
(
Account
target
)
{
// To delete an account, we need to also delete all the other documents in the database that reference the account.
// To delete an account, we need to also delete all the other documents in the database that reference the account.
// This should optimally be wrapped inside a transaction, to make sure an error thrown mid-way does not leave the
// This should optimally be wrapped inside a transaction, to make sure an error thrown mid-way does not leave the
// database in an inconsistent state, but unfortunately Mongo only supports that when we have a replica set ...
// database in an inconsistent state, but unfortunately Mongo only supports that when we have a replica set ...
// Delete mails, gacha records, items and avatars.
// Delete mails, gacha records, items and avatars.
DatabaseManager
.
getDatastore
().
find
(
Mail
.
class
).
filter
(
Filters
.
eq
(
"ownerUid"
,
target
.
getPlayerUid
())).
delete
();
DatabaseManager
.
getDatastore
().
find
(
Mail
.
class
).
filter
(
Filters
.
eq
(
"ownerUid"
,
target
.
getPlayerUid
())).
delete
();
DatabaseManager
.
getDatastore
().
find
(
GachaRecord
.
class
).
filter
(
Filters
.
eq
(
"ownerId"
,
target
.
getPlayerUid
())).
delete
();
DatabaseManager
.
getDatastore
().
find
(
GachaRecord
.
class
).
filter
(
Filters
.
eq
(
"ownerId"
,
target
.
getPlayerUid
())).
delete
();
...
...
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