mirror of
https://github.com/LuckPerms/LuckPerms.git
synced 2025-01-01 14:07:56 +01:00
Set mongodb uuid representation (#3324)
This commit is contained in:
parent
4bdcca6566
commit
8ed63159ce
@ -68,6 +68,7 @@ import net.luckperms.api.node.Node;
|
|||||||
import net.luckperms.api.node.NodeBuilder;
|
import net.luckperms.api.node.NodeBuilder;
|
||||||
|
|
||||||
import org.bson.Document;
|
import org.bson.Document;
|
||||||
|
import org.bson.UuidRepresentation;
|
||||||
|
|
||||||
import java.time.Instant;
|
import java.time.Instant;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
@ -111,8 +112,11 @@ public class MongoStorage implements StorageImplementation {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void init() {
|
public void init() {
|
||||||
|
MongoClientOptions.Builder options = MongoClientOptions.builder()
|
||||||
|
.uuidRepresentation(UuidRepresentation.JAVA_LEGACY);
|
||||||
|
|
||||||
if (!Strings.isNullOrEmpty(this.connectionUri)) {
|
if (!Strings.isNullOrEmpty(this.connectionUri)) {
|
||||||
this.mongoClient = new MongoClient(new MongoClientURI(this.connectionUri));
|
this.mongoClient = new MongoClient(new MongoClientURI(this.connectionUri, options));
|
||||||
} else {
|
} else {
|
||||||
MongoCredential credential = null;
|
MongoCredential credential = null;
|
||||||
if (!Strings.isNullOrEmpty(this.configuration.getUsername())) {
|
if (!Strings.isNullOrEmpty(this.configuration.getUsername())) {
|
||||||
@ -129,9 +133,9 @@ public class MongoStorage implements StorageImplementation {
|
|||||||
ServerAddress address = new ServerAddress(host, port);
|
ServerAddress address = new ServerAddress(host, port);
|
||||||
|
|
||||||
if (credential == null) {
|
if (credential == null) {
|
||||||
this.mongoClient = new MongoClient(address);
|
this.mongoClient = new MongoClient(address, options.build());
|
||||||
} else {
|
} else {
|
||||||
this.mongoClient = new MongoClient(address, credential, MongoClientOptions.builder().build());
|
this.mongoClient = new MongoClient(address, credential, options.build());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user