diff --git a/easysql-plugin-core/src/main/resources/config.yml b/easysql-plugin-core/src/main/resources/config.yml index e4214e7..bb87bf7 100644 --- a/easysql-plugin-core/src/main/resources/config.yml +++ b/easysql-plugin-core/src/main/resources/config.yml @@ -1,19 +1,33 @@ +version: ${project.version} #配置文件版本,若与插件版本不同请记得检查配置文件内容 + +debug: false + +# 统计数据设定 +# 改选项用于帮助开发者统计插件版本与使用情况,且绝不会影响性能与使用体验。 +# 当然,您也可以选择在这里关闭,或在plugins/bStats下的配置文件中关闭。 +metrics: true + # 检查更新设定 # 该选项用于插件判断是否要检查更新,若您不希望插件检查更新并提示您,可以选择关闭。 # 检查更新为异步操作,绝不会影响性能与使用体验。 check-update: true +# 启用 Properties 文件配置 +# 相关配置介绍(BeeCP) https://github.com/Chris2018998/BeeCP/wiki/Configuration--List#配置列表 properties: + # 该选项用于启用 Properties 配置读取,若您不希望插件启用 Properties 文件配置,可以选择关闭。 enable: true - folder: "properties/" + # 文件夹路径,将读取该文件夹下的所有 .properties 文件,并以文件名为数据管理器名称。 + # 读取时,将排除以 “.” 开头的文件与非 .properties 文件。 + # 默认为 "db-properties/" 相对路径,指向“plugins/EasySQL-Plugin/db-properties/”; + # 该选项也支持绝对路径,但使用绝对路径时,请务必注意权限问题。 + folder: "db-properties/" configurations: "example-mariadb": # database id driver-type: mariadb url: 127.0.0.1 # 数据库地址 port: 3306 # 数据库端口 - use-ssl: false # 是否使用SSL连接 username: minecraft # 数据库用户名 password: password #数据库连接密码 - database: minecraft #数据库名 - + database: minecraft #数据库名 \ No newline at end of file diff --git a/easysql-plugin-core/src/main/resources/db-properties/.example-mysql.properties b/easysql-plugin-core/src/main/resources/db-properties/.example-mysql.properties new file mode 100644 index 0000000..7e0ef75 --- /dev/null +++ b/easysql-plugin-core/src/main/resources/db-properties/.example-mysql.properties @@ -0,0 +1,63 @@ +# suppress inspection "UnusedProperty" for whole file + +# 该功能一般用于专业开发者使用,若您不了解该功能,请尽量使用config.yml中提供的配置方式,简单便捷,能够满足大多数需求。 +# 更多帮助详见 BeeCP项目地址 https://github.com/Chris2018998/BeeCP + +#JDBC 用户名 +username=root +#JDBC 密码 +password=root +# JDBC连接URL +jdbcUrl=jdbc:mysql://localhost/test +# JDBC驱动类名 +driverClassName=com.mysql.cj.jdbc.Driver +# 连接有效性测试SQL语句 +connectionTestSQL=select 1 from dual +# 池名,如果未赋值则会自动产生一个 +poolName=Pool1 +# 是否使用公平模式 (竞争模式=false) +fairMode=false +# 连接池初始大小 +initialSize=1 +# 连接池最大个数 +maxActive=10 +# 信号量许可大小 min(最大连接数/2,CPU核心数) +borrowSemaphoreSize=4 +# 连接借用等待最大时间(毫秒) +maxWait=8000 +# 连接闲置最大时间(毫秒) +idleTimeout=18000 +# 连接被持有不用最大允许时间(毫秒) +holdTimeout=30000 +# 连接有效性测试SQL语句 +validTestTimeout=3 +# 连接测试的间隔时间(毫秒) +validAssumeTime=500 +# 闲置扫描线程间隔时间(毫秒) +timerCheckInterval=30000 +# 在结束时是否直接关闭使用中连接 +forceCloseUsingOnClear=true +# 延迟清理的时候时间(毫秒) +delayTimeForNextClear=3000 + +# JMX监控支持开关 +enableJmx=false + +# Catalog默认值 +defaultCatalog=test1 +# Schema默认值 +defaultSchema=test2 +# ReadOnly默认值 +defaultReadOnly=true +# 自动提交默认值 +defaultAutoCommit=true + +# 事物隔离代码,未设置时则从第一个连接上读取 +defaultTransactionIsolationCode=1 +defaultTransactionIsolationName=TRANSACTION_READ_UNCOMMITTED + +# 额外链接配置 +connectProperties=cachePrepStmts=true +connectProperties.count=2 +connectProperties.1=prepStmtCacheSize=50 +connectProperties.2=prepStmtCacheSqlLimit=2048&useServerPrepStmts=true \ No newline at end of file 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 9a075b6..35d4b22 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 @@ -30,8 +30,7 @@ public class EasySQLBukkit extends EasyPlugin implements EasySQLPluginPlatform { EasySQLBukkit.instance = this; this.registry = new EasySQLRegistryImpl(this); - initializeAPI(getRegistry()); - + initializeAPI(getRegistry()); // 尽快的初始化接口,方便其他插件调用 } @Override @@ -56,7 +55,7 @@ public class EasySQLBukkit extends EasyPlugin implements EasySQLPluginPlatform { @Override public @NotNull Map readProperties() { - return PropertiesUtil.readDBProperties(new File(getDataFolder(), "properties")); + return PropertiesUtil.readDBProperties(new File(getDataFolder(), "db-properties")); } @Override diff --git a/platforms/easysql-plugin-bukkit/src/main/resources/plugin.yml b/platforms/easysql-plugin-bukkit/src/main/resources/plugin.yml index 8479bc4..97387cf 100644 --- a/platforms/easysql-plugin-bukkit/src/main/resources/plugin.yml +++ b/platforms/easysql-plugin-bukkit/src/main/resources/plugin.yml @@ -1,7 +1,7 @@ main: cc.carm.plugin.easysql.EasySQLBukkit version: ${project.version} prefix: EasySQL-Plugin -name: EasySQL-Plugin-Bukkit +name: EasySQL-Plugin load: STARTUP website: ${project.url} 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 44e5faa..9e9a848 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 @@ -81,7 +81,7 @@ public class EasySQLBungee extends Plugin implements EasySQLPluginPlatform { @Override public @NotNull Map readProperties() { - return PropertiesUtil.readDBProperties(new File(getDataFolder(), "properties")); + return PropertiesUtil.readDBProperties(new File(getDataFolder(), "db-properties")); }