From bcb55c5a679e92f5a98881088bb0bf9e91619a04 Mon Sep 17 00:00:00 2001 From: EoD <293499+EoD@users.noreply.github.com> Date: Sat, 3 May 2025 21:16:20 +0000 Subject: [PATCH] Revert "register JDBC driver to work around Forge bug" This reverts commit ce0e173a9e7372715f09e4eb2f49657461224230. --- build.gradle | 4 +--- src/main/java/vip/fubuki/playersync/PlayerSync.java | 10 ---------- 2 files changed, 1 insertion(+), 13 deletions(-) diff --git a/build.gradle b/build.gradle index 2757bde..34e5214 100644 --- a/build.gradle +++ b/build.gradle @@ -151,9 +151,7 @@ dependencies { // modImplementation project(":myproject") // embedd the JDBC driver in the mod using jarJar - // JDBC driver auto-detection is broken in Forge as of v47.4.0 - // i.e. we need to need it both at compile and runtime - implementation "com.mysql:mysql-connector-j:${jdbc_version}" + runtimeOnly "com.mysql:mysql-connector-j:${jdbc_version}" jarJar "com.mysql:mysql-connector-j:${jdbc_version}" additionalRuntimeClasspath "com.mysql:mysql-connector-j:${jdbc_version}" diff --git a/src/main/java/vip/fubuki/playersync/PlayerSync.java b/src/main/java/vip/fubuki/playersync/PlayerSync.java index 71b3b27..2ca63a1 100644 --- a/src/main/java/vip/fubuki/playersync/PlayerSync.java +++ b/src/main/java/vip/fubuki/playersync/PlayerSync.java @@ -17,11 +17,9 @@ import vip.fubuki.playersync.sync.VanillaSync; import vip.fubuki.playersync.util.JDBCsetUp; import java.sql.Connection; -import java.sql.DriverManager; import java.sql.ResultSet; import java.sql.SQLException; import java.sql.Statement; -import com.mysql.cj.jdbc.Driver; @Mod(PlayerSync.MODID) public class PlayerSync { @@ -36,14 +34,6 @@ public class PlayerSync { } private void commonSetup(final FMLCommonSetupEvent event) { - // JDBC driver auto-detection is broken in Forge as of v47.4.0 - // We need to register the driver manually - try { - DriverManager.registerDriver(new Driver()); - } catch (SQLException e) { - LOGGER.error("Unable to register JDBC MySQL driver", e); - } - VanillaSync.register(); event.enqueueWork(() -> { // read SYNC_CHAT only within the enqueueWork to reliably get the real