mirror of
https://github.com/CarmJos/MineSQL.git
synced 2026-06-04 16:43:03 +08:00
添加 PluginConfiguration 接口类
This commit is contained in:
@@ -3,14 +3,13 @@ package cc.carm.plugin.easysql.api;
|
|||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
import org.jetbrains.annotations.Nullable;
|
import org.jetbrains.annotations.Nullable;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
public class DBConfiguration {
|
public class DBConfiguration {
|
||||||
|
|
||||||
public DBConfiguration create(@NotNull SQLDriverType sourceType, @NotNull String url) {
|
public static DBConfiguration create(@NotNull SQLDriverType sourceType, @NotNull String url) {
|
||||||
return new DBConfiguration(sourceType.getDriverClass(), sourceType.getUrlPrefix(), url, sourceType.getDefaultSettings());
|
return new DBConfiguration(sourceType.getDriverClass(), sourceType.getUrlPrefix(), url, sourceType.getInitializeSQLs());
|
||||||
}
|
}
|
||||||
|
|
||||||
private final @NotNull String driverClassName;
|
private final @NotNull String driverClassName;
|
||||||
|
|||||||
@@ -1,28 +1,41 @@
|
|||||||
package cc.carm.plugin.easysql.api;
|
package cc.carm.plugin.easysql.api;
|
||||||
|
|
||||||
|
import org.jetbrains.annotations.Contract;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
import org.jetbrains.annotations.Nullable;
|
||||||
|
|
||||||
|
import java.util.Arrays;
|
||||||
|
|
||||||
public enum SQLDriverType {
|
public enum SQLDriverType {
|
||||||
|
|
||||||
MARIADB("org.mariadb.jdbc.Driver", "jdbc:mariadb://", "mariadb", new String[]{}),
|
MARIADB("org.mariadb.jdbc.Driver", "jdbc:mariadb://",
|
||||||
MYSQL("com.mysql.jdbc.Driver", "jdbc:mysql://", "mysql", new String[]{}),
|
new String[]{"mariadb", "maria-db"}, new String[]{}
|
||||||
H2("org.h2.Driver", "jdbc:h2:", "h2", new String[]{"MODE=MySQL", "DB_CLOSE_DELAY=-1"});
|
),
|
||||||
|
MYSQL("com.mysql.jdbc.Driver", "jdbc:mysql://",
|
||||||
|
new String[]{"mysql"}, new String[]{}
|
||||||
|
),
|
||||||
|
H2("org.h2.Driver", "jdbc:h2:",
|
||||||
|
new String[]{"h2", "h2-db", "h2-database"},
|
||||||
|
new String[]{"SET MODE=MySQL", "SET DB_CLOSE_DELAY=-1"}
|
||||||
|
);
|
||||||
|
|
||||||
private final @NotNull String databaseID;
|
|
||||||
private final @NotNull String driverClass;
|
private final @NotNull String driverClass;
|
||||||
private final @NotNull String urlPrefix;
|
private final @NotNull String urlPrefix;
|
||||||
private final @NotNull String[] defaultSettings;
|
private final @NotNull String[] databaseAlias;
|
||||||
|
private final @NotNull String[] initializeSQLs;
|
||||||
|
|
||||||
SQLDriverType(@NotNull String driverClass, @NotNull String urlPrefix,
|
SQLDriverType(@NotNull String driverClass, @NotNull String urlPrefix,
|
||||||
@NotNull String databaseID, @NotNull String[] initializeSQLs) {
|
@NotNull String[] databaseAlias,
|
||||||
this.databaseID = databaseID;
|
@NotNull String[] initializeSQLs) {
|
||||||
|
|
||||||
this.driverClass = driverClass;
|
this.driverClass = driverClass;
|
||||||
this.urlPrefix = urlPrefix;
|
this.urlPrefix = urlPrefix;
|
||||||
this.defaultSettings = initializeSQLs;
|
this.databaseAlias = databaseAlias;
|
||||||
|
this.initializeSQLs = initializeSQLs;
|
||||||
}
|
}
|
||||||
|
|
||||||
public @NotNull String getDatabaseID() {
|
public @NotNull String[] getDatabaseAlias() {
|
||||||
return databaseID;
|
return databaseAlias;
|
||||||
}
|
}
|
||||||
|
|
||||||
public @NotNull String getDriverClass() {
|
public @NotNull String getDriverClass() {
|
||||||
@@ -33,7 +46,20 @@ public enum SQLDriverType {
|
|||||||
return urlPrefix;
|
return urlPrefix;
|
||||||
}
|
}
|
||||||
|
|
||||||
public @NotNull String[] getDefaultSettings() {
|
public @NotNull String[] getInitializeSQLs() {
|
||||||
return defaultSettings;
|
return initializeSQLs;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Contract("null->null")
|
||||||
|
public static @Nullable SQLDriverType parse(@Nullable String driverString) {
|
||||||
|
if (driverString == null) return null;
|
||||||
|
return Arrays.stream(values())
|
||||||
|
.filter(value -> value.name().equalsIgnoreCase(driverString) || has(value.getDatabaseAlias(), driverString))
|
||||||
|
.findFirst().orElse(null);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private static boolean has(String[] array, String value) {
|
||||||
|
return Arrays.stream(array).anyMatch(s -> s.equalsIgnoreCase(value));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -37,14 +37,25 @@ public class EasySQLRegistryImpl implements EasySQLRegistry {
|
|||||||
thread.setDaemon(true);
|
thread.setDaemon(true);
|
||||||
return thread;
|
return thread;
|
||||||
});
|
});
|
||||||
Map<String, DBConfiguration> configurations = platform.readConfigurations();
|
Map<String, Properties> dbProperties = platform.readProperties();
|
||||||
|
Map<String, DBConfiguration> dbConfigurations = platform.readConfigurations();
|
||||||
|
|
||||||
if (configurations.isEmpty()) {
|
if (dbProperties.isEmpty() && dbConfigurations.isEmpty()) {
|
||||||
platform.getLogger().warning("未检测到任何数据库配置,将不会创建任何SQLManager。");
|
platform.getLogger().warning("未检测到任何数据库配置,将不会创建任何SQLManager。");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
configurations.forEach((id, configuration) -> {
|
dbProperties.forEach((id, properties) -> {
|
||||||
|
try {
|
||||||
|
SQLManagerImpl sqlManager = create(id, properties);
|
||||||
|
this.sqlManagerRegistry.put(id, sqlManager);
|
||||||
|
} catch (Exception exception) {
|
||||||
|
platform.getLogger().warning("初始化SQLManager(#" + id + ") 出错,请检查配置文件.");
|
||||||
|
exception.printStackTrace();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
dbConfigurations.forEach((id, configuration) -> {
|
||||||
try {
|
try {
|
||||||
SQLManagerImpl sqlManager = create(id, configuration);
|
SQLManagerImpl sqlManager = create(id, configuration);
|
||||||
this.sqlManagerRegistry.put(id, sqlManager);
|
this.sqlManagerRegistry.put(id, sqlManager);
|
||||||
@@ -130,6 +141,10 @@ public class EasySQLRegistryImpl implements EasySQLRegistry {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected HashMap<String, SQLManagerImpl> getManagers() {
|
||||||
|
return sqlManagerRegistry;
|
||||||
|
}
|
||||||
|
|
||||||
public ExecutorService getExecutor() {
|
public ExecutorService getExecutor() {
|
||||||
return executorPool;
|
return executorPool;
|
||||||
}
|
}
|
||||||
|
|||||||
+22
@@ -0,0 +1,22 @@
|
|||||||
|
package cc.carm.plugin.easysql.configuration;
|
||||||
|
|
||||||
|
import cc.carm.plugin.easysql.api.DBConfiguration;
|
||||||
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
public interface PluginConfiguration {
|
||||||
|
|
||||||
|
boolean isDebugEnabled();
|
||||||
|
|
||||||
|
boolean isMetricsEnabled();
|
||||||
|
|
||||||
|
boolean isUpdateCheckerEnabled();
|
||||||
|
|
||||||
|
boolean isPropertiesEnabled();
|
||||||
|
|
||||||
|
String getPropertiesFolder();
|
||||||
|
|
||||||
|
@NotNull Map<String, DBConfiguration> getDBConfigurations();
|
||||||
|
|
||||||
|
}
|
||||||
@@ -1,13 +0,0 @@
|
|||||||
package cc.carm.plugin.easysql.util;
|
|
||||||
|
|
||||||
import cc.carm.lib.githubreleases4j.GithubReleases4J;
|
|
||||||
|
|
||||||
import java.util.logging.Logger;
|
|
||||||
|
|
||||||
public class UpdateCheckUtil {
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -23,11 +23,22 @@ properties:
|
|||||||
# 该选项也支持绝对路径,但使用绝对路径时,请务必注意权限问题。
|
# 该选项也支持绝对路径,但使用绝对路径时,请务必注意权限问题。
|
||||||
folder: "db-properties/"
|
folder: "db-properties/"
|
||||||
|
|
||||||
configurations:
|
# 数据库源配置
|
||||||
"example-mariadb": # database id
|
# 目前支持的驱动类型(driver-type)有 mariadb、mysql 与 h2(文件数据库) 。
|
||||||
|
|
||||||
|
databases:
|
||||||
|
|
||||||
|
"example-mariadb": # 数据库源名称 不可包含“.” 以“example-”开头的数据源不会被加载
|
||||||
driver-type: mariadb
|
driver-type: mariadb
|
||||||
url: 127.0.0.1 # 数据库地址
|
host: 127.0.0.1 # 数据库地址
|
||||||
port: 3306 # 数据库端口
|
port: 3306 # 数据库端口
|
||||||
username: minecraft # 数据库用户名
|
username: minecraft # 数据库用户名
|
||||||
password: password #数据库连接密码
|
password: password #数据库连接密码
|
||||||
|
database: minecraft #数据库名
|
||||||
|
|
||||||
|
"example-h2": # 数据库源名称 不可包含“.” 以“example-”开头的数据源不会被加载
|
||||||
|
driver-type: h2 #数据库驱动类型,目前支持 mariadb, mysql, h2
|
||||||
|
file: "example.db" #数据库文件路径,相对于“plugins/EasySQL-Plugin/db-files/”
|
||||||
|
username: minecraft # 数据库用户名
|
||||||
|
password: password #数据库连接密码
|
||||||
database: minecraft #数据库名
|
database: minecraft #数据库名
|
||||||
+91
@@ -0,0 +1,91 @@
|
|||||||
|
package cc.carm.plugin.easysql;
|
||||||
|
|
||||||
|
import cc.carm.plugin.easysql.api.DBConfiguration;
|
||||||
|
import cc.carm.plugin.easysql.api.SQLDriverType;
|
||||||
|
import cc.carm.plugin.easysql.configuration.PluginConfiguration;
|
||||||
|
import org.bukkit.configuration.ConfigurationSection;
|
||||||
|
import org.bukkit.configuration.file.FileConfiguration;
|
||||||
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
|
import java.util.LinkedHashMap;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
public class BukkitConfiguration implements PluginConfiguration {
|
||||||
|
|
||||||
|
private final @NotNull FileConfiguration configuration;
|
||||||
|
|
||||||
|
protected BukkitConfiguration(@NotNull FileConfiguration configuration) {
|
||||||
|
this.configuration = configuration;
|
||||||
|
}
|
||||||
|
|
||||||
|
public @NotNull FileConfiguration getConfiguration() {
|
||||||
|
return configuration;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isDebugEnabled() {
|
||||||
|
return getConfiguration().getBoolean("debug", false);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isMetricsEnabled() {
|
||||||
|
return getConfiguration().getBoolean("metrics", true);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isUpdateCheckerEnabled() {
|
||||||
|
return getConfiguration().getBoolean("check-update", true);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isPropertiesEnabled() {
|
||||||
|
return getConfiguration().getBoolean("properties.enable", true);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getPropertiesFolder() {
|
||||||
|
return getConfiguration().getString("properties.folder", "db-properties/");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public @NotNull Map<String, DBConfiguration> getDBConfigurations() {
|
||||||
|
Map<String, DBConfiguration> dbConfigurations = new LinkedHashMap<>();
|
||||||
|
ConfigurationSection dbConfigurationsSection = getConfiguration().getConfigurationSection("databases");
|
||||||
|
if (dbConfigurationsSection != null) {
|
||||||
|
for (String dbName : dbConfigurationsSection.getKeys(false)) {
|
||||||
|
if (dbName.startsWith("example-")) continue;
|
||||||
|
ConfigurationSection dbSection = dbConfigurationsSection.getConfigurationSection(dbName);
|
||||||
|
if (dbSection == null) continue;
|
||||||
|
|
||||||
|
String driverString = dbSection.getString("driver-type");
|
||||||
|
SQLDriverType driverType = SQLDriverType.parse(driverString);
|
||||||
|
if (driverType == null) {
|
||||||
|
EasySQLBukkit.getInstance().error("不存在预设的驱动类型 " + driverString + "," + " 请检查配置文件 databases." + dbName + "。");
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
String host = dbSection.getString("host");
|
||||||
|
if (host == null) {
|
||||||
|
EasySQLBukkit.getInstance().error("地址配置不得为空," + " 请检查配置文件 databases." + dbName + "。");
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
int port = dbSection.getInt("port", -1);
|
||||||
|
if (port < 0) {
|
||||||
|
EasySQLBukkit.getInstance().error("端口未配置正确," + " 请检查配置文件 databases." + dbName + "。");
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
DBConfiguration configuration = DBConfiguration.create(driverType, host + ":" + port);
|
||||||
|
|
||||||
|
String username = dbSection.getString("username");
|
||||||
|
String password = dbSection.getString("password");
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
return dbConfigurations;
|
||||||
|
}
|
||||||
|
}
|
||||||
+68
-8
@@ -2,17 +2,18 @@ package cc.carm.plugin.easysql;
|
|||||||
|
|
||||||
import cc.carm.lib.easyplugin.EasyPlugin;
|
import cc.carm.lib.easyplugin.EasyPlugin;
|
||||||
import cc.carm.lib.easyplugin.i18n.EasyPluginMessageProvider;
|
import cc.carm.lib.easyplugin.i18n.EasyPluginMessageProvider;
|
||||||
|
import cc.carm.lib.easysql.api.SQLManager;
|
||||||
import cc.carm.plugin.easysql.api.DBConfiguration;
|
import cc.carm.plugin.easysql.api.DBConfiguration;
|
||||||
import cc.carm.plugin.easysql.util.PropertiesUtil;
|
import cc.carm.plugin.easysql.util.PropertiesUtil;
|
||||||
import cc.carm.plugin.easysql.util.ResourceReadUtil;
|
import cc.carm.plugin.easysql.util.ResourceReadUtil;
|
||||||
|
import cn.beecp.BeeDataSource;
|
||||||
import co.aikar.commands.PaperCommandManager;
|
import co.aikar.commands.PaperCommandManager;
|
||||||
|
import org.bstats.bukkit.Metrics;
|
||||||
|
import org.bstats.charts.SimplePie;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.util.HashMap;
|
import java.util.*;
|
||||||
import java.util.Map;
|
|
||||||
import java.util.Optional;
|
|
||||||
import java.util.Properties;
|
|
||||||
|
|
||||||
public class EasySQLBukkit extends EasyPlugin implements EasySQLPluginPlatform {
|
public class EasySQLBukkit extends EasyPlugin implements EasySQLPluginPlatform {
|
||||||
|
|
||||||
@@ -22,24 +23,76 @@ public class EasySQLBukkit extends EasyPlugin implements EasySQLPluginPlatform {
|
|||||||
|
|
||||||
protected static EasySQLBukkit instance;
|
protected static EasySQLBukkit instance;
|
||||||
|
|
||||||
private PaperCommandManager commandManager;
|
private BukkitConfiguration configuration;
|
||||||
private EasySQLRegistryImpl registry;
|
private EasySQLRegistryImpl registry;
|
||||||
|
|
||||||
|
private PaperCommandManager commandManager;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void load() {
|
protected void load() {
|
||||||
EasySQLBukkit.instance = this;
|
EasySQLBukkit.instance = this;
|
||||||
|
|
||||||
|
log("加载配置文件...");
|
||||||
|
getInstance().saveDefaultConfig();
|
||||||
|
this.configuration = new BukkitConfiguration(getInstance().getConfig());
|
||||||
|
|
||||||
|
log("初始化EasySQL注册器...");
|
||||||
this.registry = new EasySQLRegistryImpl(this);
|
this.registry = new EasySQLRegistryImpl(this);
|
||||||
|
|
||||||
initializeAPI(getRegistry()); // 尽快的初始化接口,方便其他插件调用
|
log("初始化EasySQLAPI...");
|
||||||
|
initializeAPI(getRegistry()); // 尽快地初始化接口,方便其他插件调用
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected boolean initialize() {
|
protected boolean initialize() {
|
||||||
|
log("初始化指令管理器...");
|
||||||
this.commandManager = new PaperCommandManager(this);
|
this.commandManager = new PaperCommandManager(this);
|
||||||
|
log("注册相关指令...");
|
||||||
initializeCommands(getCommandManager());
|
initializeCommands(getCommandManager());
|
||||||
|
|
||||||
|
if (getConfiguration().isMetricsEnabled()) {
|
||||||
|
log("启用统计数据...");
|
||||||
|
Metrics metrics = new Metrics(this, 14075);
|
||||||
|
metrics.addCustomChart(new SimplePie("update_check",
|
||||||
|
() -> getConfiguration().isUpdateCheckerEnabled() ? "ENABLED" : "DISABLED")
|
||||||
|
);
|
||||||
|
metrics.addCustomChart(new SimplePie("properties_configuration",
|
||||||
|
() -> getConfiguration().isPropertiesEnabled() ? "ENABLED" : "DISABLED")
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (getConfiguration().isUpdateCheckerEnabled()) {
|
||||||
|
log("开始检查更新...");
|
||||||
|
getRegistry().checkUpdate(getDescription().getVersion());
|
||||||
|
} else {
|
||||||
|
log("已禁用检查更新,跳过。");
|
||||||
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void shutdown() {
|
||||||
|
log("终止全部数据库连接...");
|
||||||
|
for (String dbName : new HashSet<>(getRegistry().list().keySet())) {
|
||||||
|
log(" 正在关闭数据库 " + dbName + "...");
|
||||||
|
SQLManager manager = getRegistry().get(dbName);
|
||||||
|
getRegistry().shutdown(manager, activeQueries -> {
|
||||||
|
log(" 数据库 " + dbName + " 仍有有 " + activeQueries + " 条活动查询,强制关闭中...");
|
||||||
|
if (manager.getDataSource() instanceof BeeDataSource) {
|
||||||
|
BeeDataSource dataSource = (BeeDataSource) manager.getDataSource();
|
||||||
|
dataSource.close(); //Close bee connection pool
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
getRegistry().getManagers().clear(); // release all managers
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isDebugging() {
|
||||||
|
return getConfiguration().isDebugEnabled();
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@NotNull
|
@NotNull
|
||||||
public EasySQLRegistryImpl getRegistry() {
|
public EasySQLRegistryImpl getRegistry() {
|
||||||
@@ -49,13 +102,16 @@ public class EasySQLBukkit extends EasyPlugin implements EasySQLPluginPlatform {
|
|||||||
@Override
|
@Override
|
||||||
public @NotNull
|
public @NotNull
|
||||||
Map<String, DBConfiguration> readConfigurations() {
|
Map<String, DBConfiguration> readConfigurations() {
|
||||||
return new HashMap<>();
|
return getConfiguration().getDBConfigurations();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public @NotNull
|
public @NotNull
|
||||||
Map<String, Properties> readProperties() {
|
Map<String, Properties> readProperties() {
|
||||||
return PropertiesUtil.readDBProperties(new File(getDataFolder(), "db-properties"));
|
if (!getConfiguration().isPropertiesEnabled()) return new HashMap<>();
|
||||||
|
String propertiesFolder = getConfiguration().getPropertiesFolder();
|
||||||
|
if (propertiesFolder == null || propertiesFolder.length() == 0) return new HashMap<>();
|
||||||
|
else return PropertiesUtil.readDBProperties(new File(getDataFolder(), propertiesFolder));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -67,6 +123,10 @@ public class EasySQLBukkit extends EasyPlugin implements EasySQLPluginPlatform {
|
|||||||
return EasySQLBukkit.instance;
|
return EasySQLBukkit.instance;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected BukkitConfiguration getConfiguration() {
|
||||||
|
return configuration;
|
||||||
|
}
|
||||||
|
|
||||||
protected PaperCommandManager getCommandManager() {
|
protected PaperCommandManager getCommandManager() {
|
||||||
return commandManager;
|
return commandManager;
|
||||||
}
|
}
|
||||||
|
|||||||
+1
-24
@@ -1,23 +1,16 @@
|
|||||||
package cc.carm.plugin.easysql;
|
package cc.carm.plugin.easysql;
|
||||||
|
|
||||||
import cc.carm.plugin.easysql.api.DBConfiguration;
|
|
||||||
import cc.carm.plugin.easysql.api.EasySQLRegistry;
|
|
||||||
import cc.carm.plugin.easysql.util.PropertiesUtil;
|
|
||||||
import net.md_5.bungee.api.plugin.Plugin;
|
import net.md_5.bungee.api.plugin.Plugin;
|
||||||
import net.md_5.bungee.config.Configuration;
|
import net.md_5.bungee.config.Configuration;
|
||||||
import net.md_5.bungee.config.ConfigurationProvider;
|
import net.md_5.bungee.config.ConfigurationProvider;
|
||||||
import net.md_5.bungee.config.YamlConfiguration;
|
import net.md_5.bungee.config.YamlConfiguration;
|
||||||
import org.jetbrains.annotations.NotNull;
|
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.InputStream;
|
import java.io.InputStream;
|
||||||
import java.nio.file.Files;
|
import java.nio.file.Files;
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.Map;
|
|
||||||
import java.util.Properties;
|
|
||||||
|
|
||||||
public class EasySQLBungee extends Plugin implements EasySQLPluginPlatform {
|
public class EasySQLBungee extends Plugin {
|
||||||
|
|
||||||
private boolean setup = false;
|
private boolean setup = false;
|
||||||
|
|
||||||
@@ -69,20 +62,4 @@ public class EasySQLBungee extends Plugin implements EasySQLPluginPlatform {
|
|||||||
getLogger().info("Shutting down...");
|
getLogger().info("Shutting down...");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public @NotNull EasySQLRegistry getRegistry() {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public @NotNull Map<String, DBConfiguration> readConfigurations() {
|
|
||||||
return new HashMap<>();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public @NotNull Map<String, Properties> readProperties() {
|
|
||||||
return PropertiesUtil.readDBProperties(new File(getDataFolder(), "db-properties"));
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user