From 2d31e5ac870e80fdc4b9ef8902658dfb1c85aa5d Mon Sep 17 00:00:00 2001 From: Ghost_chu <2908803755@qq.com> Date: Fri, 4 Feb 2022 14:06:46 +0800 Subject: [PATCH] add getSqlManager method --- .../plugin/easysql/api/EasySQLPluginPlatform.java | 11 +++++++++++ .../java/cc/carm/plugin/easysql/EasySQLBukkit.java | 11 +++++++++++ .../java/cc/carm/plugin/easysql/EasySQLBungee.java | 12 ++++++++++++ .../java/cc/carm/plugin/easysql/EasySQLVelocity.java | 1 - 4 files changed, 34 insertions(+), 1 deletion(-) diff --git a/easysql-plugin-api/src/main/java/cc/carm/plugin/easysql/api/EasySQLPluginPlatform.java b/easysql-plugin-api/src/main/java/cc/carm/plugin/easysql/api/EasySQLPluginPlatform.java index acc6f32..b50d638 100644 --- a/easysql-plugin-api/src/main/java/cc/carm/plugin/easysql/api/EasySQLPluginPlatform.java +++ b/easysql-plugin-api/src/main/java/cc/carm/plugin/easysql/api/EasySQLPluginPlatform.java @@ -1,4 +1,15 @@ package cc.carm.plugin.easysql.api; +import cc.carm.lib.easysql.api.SQLManager; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; + public interface EasySQLPluginPlatform { + /** + * 获取 SQL 管理器 + * @param name 注册键 + * @return SQL管理器 + */ + @Nullable + SQLManager getSqlManager(@NotNull String name); } diff --git a/platforms/easysql-plugin-bukkit/src/main/java/cc/carm/plugin/easysql/EasySQLBukkit.java b/platforms/easysql-plugin-bukkit/src/main/java/cc/carm/plugin/easysql/EasySQLBukkit.java index 67820a4..4fd04de 100644 --- a/platforms/easysql-plugin-bukkit/src/main/java/cc/carm/plugin/easysql/EasySQLBukkit.java +++ b/platforms/easysql-plugin-bukkit/src/main/java/cc/carm/plugin/easysql/EasySQLBukkit.java @@ -14,6 +14,7 @@ import org.bukkit.event.server.PluginDisableEvent; import org.bukkit.plugin.Plugin; import org.bukkit.plugin.java.JavaPlugin; import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; public class EasySQLBukkit extends JavaPlugin implements EasySQLPluginPlatform, Listener { private EasySQLAPI apiImpl; @@ -107,4 +108,14 @@ public class EasySQLBukkit extends JavaPlugin implements EasySQLPluginPlatform, this.apiImpl.unregisterSQLManagerAll(plugin.getName()); } + /** + * 获取 SQL 管理器 + * + * @param name 注册键 + * @return SQL管理器 + */ + @Override + public @Nullable SQLManager getSqlManager(@NotNull String name) { + return this.apiImpl.getSQLManager(name); + } } diff --git a/platforms/easysql-plugin-bungee/src/main/java/cc/carm/plugin/easysql/EasySQLBungee.java b/platforms/easysql-plugin-bungee/src/main/java/cc/carm/plugin/easysql/EasySQLBungee.java index ebd1919..97e7cc7 100644 --- a/platforms/easysql-plugin-bungee/src/main/java/cc/carm/plugin/easysql/EasySQLBungee.java +++ b/platforms/easysql-plugin-bungee/src/main/java/cc/carm/plugin/easysql/EasySQLBungee.java @@ -10,6 +10,7 @@ import net.md_5.bungee.config.Configuration; import net.md_5.bungee.config.ConfigurationProvider; import net.md_5.bungee.config.YamlConfiguration; import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; import java.io.File; import java.io.IOException; @@ -123,4 +124,15 @@ public class EasySQLBungee extends Plugin implements EasySQLPluginPlatform { public void unregister(@NotNull Plugin plugin){ this.apiImpl.unregisterSQLManagerAll(plugin.getDescription().getName()); } + + /** + * 获取 SQL 管理器 + * + * @param name 注册键 + * @return SQL管理器 + */ + @Override + public @Nullable SQLManager getSqlManager(@NotNull String name) { + return this.apiImpl.getSQLManager(name); + } } diff --git a/platforms/easysql-plugin-velocity/src/main/java/cc/carm/plugin/easysql/EasySQLVelocity.java b/platforms/easysql-plugin-velocity/src/main/java/cc/carm/plugin/easysql/EasySQLVelocity.java index f4f7815..68c966a 100644 --- a/platforms/easysql-plugin-velocity/src/main/java/cc/carm/plugin/easysql/EasySQLVelocity.java +++ b/platforms/easysql-plugin-velocity/src/main/java/cc/carm/plugin/easysql/EasySQLVelocity.java @@ -44,7 +44,6 @@ public class EasySQLVelocity { @Subscribe public void onInitialize(ProxyInitializeEvent event) { - } }