1
0
mirror of https://github.com/lucko/LuckPerms.git synced 2025-09-01 02:21:43 +02:00

Set mongodb uuid representation (#3324)

This commit is contained in:
Luck
2022-02-27 13:17:12 +00:00
parent 4bdcca6566
commit 8ed63159ce

View File

@@ -68,6 +68,7 @@ import net.luckperms.api.node.Node;
import net.luckperms.api.node.NodeBuilder;
import org.bson.Document;
import org.bson.UuidRepresentation;
import java.time.Instant;
import java.util.ArrayList;
@@ -111,8 +112,11 @@ public class MongoStorage implements StorageImplementation {
@Override
public void init() {
MongoClientOptions.Builder options = MongoClientOptions.builder()
.uuidRepresentation(UuidRepresentation.JAVA_LEGACY);
if (!Strings.isNullOrEmpty(this.connectionUri)) {
this.mongoClient = new MongoClient(new MongoClientURI(this.connectionUri));
this.mongoClient = new MongoClient(new MongoClientURI(this.connectionUri, options));
} else {
MongoCredential credential = null;
if (!Strings.isNullOrEmpty(this.configuration.getUsername())) {
@@ -129,9 +133,9 @@ public class MongoStorage implements StorageImplementation {
ServerAddress address = new ServerAddress(host, port);
if (credential == null) {
this.mongoClient = new MongoClient(address);
this.mongoClient = new MongoClient(address, options.build());
} else {
this.mongoClient = new MongoClient(address, credential, MongoClientOptions.builder().build());
this.mongoClient = new MongoClient(address, credential, options.build());
}
}