From 62a8bc462992f0a18d1ed04096221e02e58b5b14 Mon Sep 17 00:00:00 2001 From: carm Date: Mon, 17 Apr 2023 00:49:46 +0800 Subject: [PATCH] =?UTF-8?q?fix(init):=20=E4=BF=AE=E5=A4=8DSQL=E9=85=8D?= =?UTF-8?q?=E7=BD=AE=E7=9A=84Initializer=E6=9C=AA=E8=A2=AB=E8=B0=83?= =?UTF-8?q?=E7=94=A8=E7=9A=84=E9=97=AE=E9=A2=98=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- api/pom.xml | 2 +- core/pom.xml | 2 +- .../main/java/cc/carm/plugin/minesql/MineSQLCore.java | 9 +++++++-- platforms/bukkit/pom.xml | 2 +- platforms/bungee/pom.xml | 2 +- platforms/sponge8/pom.xml | 2 +- platforms/velocity/pom.xml | 2 +- plugin/pom.xml | 2 +- pom.xml | 8 ++++---- 9 files changed, 18 insertions(+), 13 deletions(-) diff --git a/api/pom.xml b/api/pom.xml index 857a429..7207b15 100644 --- a/api/pom.xml +++ b/api/pom.xml @@ -5,7 +5,7 @@ minesql-parent cc.carm.plugin - 1.4.0 + 1.4.1 4.0.0 diff --git a/core/pom.xml b/core/pom.xml index 09de8f0..6d3c438 100644 --- a/core/pom.xml +++ b/core/pom.xml @@ -5,7 +5,7 @@ minesql-parent cc.carm.plugin - 1.4.0 + 1.4.1 4.0.0 diff --git a/core/src/main/java/cc/carm/plugin/minesql/MineSQLCore.java b/core/src/main/java/cc/carm/plugin/minesql/MineSQLCore.java index a1be5c4..1b1a8c6 100644 --- a/core/src/main/java/cc/carm/plugin/minesql/MineSQLCore.java +++ b/core/src/main/java/cc/carm/plugin/minesql/MineSQLCore.java @@ -124,7 +124,7 @@ public class MineSQLCore implements IMineSQL { } @Override - public @NotNull SQLManagerImpl create(@NotNull String name, @NotNull SQLSourceConfig conf) { + public @NotNull SQLManagerImpl create(@NotNull String name, @NotNull SQLSourceConfig conf) throws Exception { BeeDataSourceConfig config = new BeeDataSourceConfig(); config.setDriverClassName(conf.getDriverClassName()); config.setJdbcUrl(conf.getJdbcURL()); @@ -147,7 +147,12 @@ public class MineSQLCore implements IMineSQL { Optional.ofNullable(conf.getSettings().getValidationTimeout()).ifPresent(config::setValidTestTimeout); Optional.ofNullable(conf.getSettings().getValidationInterval()).ifPresent(config::setValidAssumeTime); - return create(name, config); + SQLManagerImpl manager = create(name, config); + if (conf.getInitializer() != null) { + conf.getInitializer().accept(manager); + } + + return manager; } @Override diff --git a/platforms/bukkit/pom.xml b/platforms/bukkit/pom.xml index 0e9ae30..6226ef2 100644 --- a/platforms/bukkit/pom.xml +++ b/platforms/bukkit/pom.xml @@ -5,7 +5,7 @@ minesql-parent cc.carm.plugin - 1.4.0 + 1.4.1 ../../pom.xml 4.0.0 diff --git a/platforms/bungee/pom.xml b/platforms/bungee/pom.xml index d7678b4..d5150ed 100644 --- a/platforms/bungee/pom.xml +++ b/platforms/bungee/pom.xml @@ -5,7 +5,7 @@ minesql-parent cc.carm.plugin - 1.4.0 + 1.4.1 ../../pom.xml 4.0.0 diff --git a/platforms/sponge8/pom.xml b/platforms/sponge8/pom.xml index 81b60a9..b3975eb 100644 --- a/platforms/sponge8/pom.xml +++ b/platforms/sponge8/pom.xml @@ -5,7 +5,7 @@ minesql-parent cc.carm.plugin - 1.4.0 + 1.4.1 ../../pom.xml 4.0.0 diff --git a/platforms/velocity/pom.xml b/platforms/velocity/pom.xml index b2a407d..d347e81 100644 --- a/platforms/velocity/pom.xml +++ b/platforms/velocity/pom.xml @@ -5,7 +5,7 @@ minesql-parent cc.carm.plugin - 1.4.0 + 1.4.1 ../../pom.xml 4.0.0 diff --git a/plugin/pom.xml b/plugin/pom.xml index 1ccbec8..87d9e14 100644 --- a/plugin/pom.xml +++ b/plugin/pom.xml @@ -5,7 +5,7 @@ minesql-parent cc.carm.plugin - 1.4.0 + 1.4.1 4.0.0 diff --git a/pom.xml b/pom.xml index cfe0057..373168a 100644 --- a/pom.xml +++ b/pom.xml @@ -12,8 +12,8 @@ UTF-8 0.4.7 - 3.3.1 - 1.4.18 + 3.5.1 + 1.5.5 3.3.9 1.1.5 @@ -30,7 +30,7 @@ cc.carm.plugin minesql-parent pom - 1.4.0 + 1.4.1 api core @@ -128,7 +128,7 @@ org.jetbrains annotations - 23.1.0 + 24.0.1 provided