summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKeuin <[email protected]>2021-09-06 20:48:23 +0800
committerKeuin <[email protected]>2021-09-06 20:48:23 +0800
commitd96d4ecac8e905108295c9ed98f945b9119fa2dc (patch)
tree26d808273451fc6b8fb5ac4e0d2b1936fb373843
parent8e8e43a248e25dd9bea5cc4fc7d84c9cfcf1b2b0 (diff)
Update dependency. Now supports Mongodb 5.x.
-rw-r--r--build.gradle8
-rw-r--r--gradle.properties2
-rw-r--r--src/main/java/com/keuin/blame/util/DatabaseUtil.java4
3 files changed, 9 insertions, 5 deletions
diff --git a/build.gradle b/build.gradle
index 596eef1..ee15def 100644
--- a/build.gradle
+++ b/build.gradle
@@ -11,6 +11,8 @@ version = project.mod_version
group = project.maven_group
repositories {
+ mavenCentral()
+
// Add repositories to retrieve artifacts from in here.
// You should only use this when depending on other mods because
// Loom adds the essential maven repositories to download Minecraft and libraries from automatically.
@@ -29,9 +31,9 @@ dependencies {
// PSA: Some older mods, compiled on Loom 0.2.1, might have outdated Maven POMs.
// You may need to force-disable transitiveness on them.
- implementation 'junit:junit:4.12'
- implementation 'org.mongodb:mongo-java-driver:3.12.7'
- include 'org.mongodb:mongo-java-driver:3.12.7'
+ implementation 'junit:junit:4.13.2'
+ implementation 'org.mongodb:mongodb-driver-sync:4.3.1'
+ implementation 'org.mongodb:bson:4.3.1'
}
processResources {
diff --git a/gradle.properties b/gradle.properties
index 78e3997..cd768f9 100644
--- a/gradle.properties
+++ b/gradle.properties
@@ -6,7 +6,7 @@ minecraft_version=1.16.5
yarn_mappings=1.16.5+build.10
loader_version=0.11.6
# Mod Properties
-mod_version=1.5.0
+mod_version=1.5.1
maven_group=com.keuin.blame
archives_base_name=blame-fabric
# Dependencies
diff --git a/src/main/java/com/keuin/blame/util/DatabaseUtil.java b/src/main/java/com/keuin/blame/util/DatabaseUtil.java
index 5ffbedf..8d8b2ad 100644
--- a/src/main/java/com/keuin/blame/util/DatabaseUtil.java
+++ b/src/main/java/com/keuin/blame/util/DatabaseUtil.java
@@ -7,6 +7,7 @@ import com.keuin.blame.data.enums.codec.ObjectTypeCodec;
import com.keuin.blame.data.enums.codec.WorldPosCodec;
import com.mongodb.ConnectionString;
import com.mongodb.MongoClientSettings;
+import org.bson.UuidRepresentation;
import org.bson.codecs.configuration.CodecRegistries;
import org.bson.codecs.configuration.CodecRegistry;
import org.bson.codecs.pojo.PojoCodecProvider;
@@ -20,7 +21,7 @@ public class DatabaseUtil {
public static final MongoConfig MONGO_CONFIG = Blame.config.getMongoConfig();
public static final CodecRegistry CODEC_REGISTRY = CodecRegistries.fromRegistries(
- com.mongodb.MongoClient.getDefaultCodecRegistry(),
+ MongoClientSettings.getDefaultCodecRegistry(),
CodecRegistries.fromCodecs(
new ActionTypeCodec(),
new ObjectTypeCodec(),
@@ -31,6 +32,7 @@ public class DatabaseUtil {
public static final MongoClientSettings CLIENT_SETTINGS = MongoClientSettings.builder()
.applyConnectionString(new ConnectionString(MONGO_CONFIG.getAddress()))
.codecRegistry(CODEC_REGISTRY)
+ .uuidRepresentation(UuidRepresentation.JAVA_LEGACY) // for backward-compatible with logs created by older versions
.build();
// TODO: Auto create indexes if the collection is empty