mirror of
https://github.com/CarmJos/MineSQL.git
synced 2026-06-14 05:11:08 +08:00
Compare commits
90 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 5a393a10fb | |||
| d67984f5a1 | |||
| d3d92415c8 | |||
| 657fbb200e | |||
| 3d72f3c82b | |||
| 912462c5b7 | |||
| ead4ec2c3f | |||
| 3e7aa791a1 | |||
| 92ed6f7a78 | |||
| d885ecd086 | |||
| f9abf54c55 | |||
| a4be406e3e | |||
| f5715ccddb | |||
| fe602fc7eb | |||
| f2b3c9853b | |||
| 1c9685b317 | |||
| 9dcaba0d2b | |||
| 1942fa74f6 | |||
| 2a21ef4fdd | |||
| 992d4dcfb9 | |||
| 05458aca87 | |||
| d35b1bba97 | |||
| c9a91f81b1 | |||
| 48df780b7d | |||
| e209fcc2ae | |||
| 258c4924b4 | |||
| 736e65ae31 | |||
| 9dcd61fd04 | |||
| 4449a879b8 | |||
| ce0f694004 | |||
| 6c9231bd45 | |||
| 4834d79c96 | |||
| e17f9ddce0 | |||
| e6521b9791 | |||
| 26124a1b5e | |||
| db5ea87b13 | |||
| b67ef84b82 | |||
| af9c6a42f2 | |||
| 385eaa5d27 | |||
| 87c3d520f4 | |||
| 0b9403631b | |||
| a7c70aba80 | |||
| e877792fbf | |||
| 628de160a6 | |||
| b55cce9310 | |||
| 5ce1bf149a | |||
| 35ae98b3af | |||
| 9963348467 | |||
| ca6e6e4944 | |||
| d871644322 | |||
| bb7906fd8d | |||
| c2c5e0656d | |||
| e6bbe36cb1 | |||
| b49c46ffe8 | |||
| 06f7a2607b | |||
| 66396c0c27 | |||
| e3ef67e342 | |||
| 9ba9b1f5d1 | |||
| 31aa49a60b | |||
| 1e2b18026a | |||
| 1013501fda | |||
| 3e30a83484 | |||
| 83936ee53e | |||
| 7a1216e624 | |||
| 24530e1f50 | |||
| a22d9bd797 | |||
| 62a8bc4629 | |||
| 40afd988e4 | |||
| fff84fafae | |||
| e6fad85438 | |||
| 6331cf2047 | |||
| f314ec4351 | |||
| 6fc169ca30 | |||
| 5b90969f81 | |||
| 33c79affab | |||
| f3b7653150 | |||
| d2df91d45c | |||
| 3d885a85a2 | |||
| 3c45eb29bf | |||
| 6456f0d2fe | |||
| 58bddd86aa | |||
| 7dec1a1e5a | |||
| ddf263c697 | |||
| 054f9bb04c | |||
| 8c9c6b72e2 | |||
| 668df1d517 | |||
| 0134b0f518 | |||
| 7ca019bac9 | |||
| e8608adada | |||
| 6c82c6419b |
@@ -29,13 +29,13 @@ properties:
|
||||
databases:
|
||||
|
||||
"example-mariadb": # 数据库源名称 不可包含“.” 以“example-”开头的数据源不会被加载
|
||||
driver-type: mariadb
|
||||
type: mariadb # MySQL / MariaDB 类型
|
||||
host: 127.0.0.1 # 数据库地址
|
||||
port: 3306 # 数据库端口
|
||||
username: minecraft # 数据库用户名
|
||||
password: password #数据库连接密码
|
||||
database: minecraft #数据库名
|
||||
|
||||
"example-h2": # 数据库源名称 不可包含“.” 以“example-”开头的数据源不会被加载
|
||||
driver-type: h2 #数据库驱动类型,目前支持 mariadb, mysql, h2
|
||||
"example-h2":
|
||||
type: h2-file
|
||||
file: "example.db" #数据库文件路径,相对于“plugins/MineSQL/db-files/”
|
||||
@@ -13,7 +13,7 @@
|
||||
<repository>
|
||||
<id>MineSQL</id>
|
||||
<name>GitHub Branch Repository</name>
|
||||
<url>https://github.com/CarmJos/MineSQL/blob/repo/</url>
|
||||
<url>https://raw.githubusercontent.com/CarmJos/MineSQL/repo/</url>
|
||||
</repository>
|
||||
</repositories>
|
||||
```
|
||||
@@ -22,6 +22,6 @@
|
||||
|
||||
```groovy
|
||||
repositories {
|
||||
maven { url 'https://github.com/CarmJos/MineSQL/blob/repo/' }
|
||||
maven { url 'https://raw.githubusercontent.com/CarmJos/MineSQL/repo/' }
|
||||
}
|
||||
```
|
||||
@@ -38,11 +38,11 @@ jobs:
|
||||
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v2
|
||||
uses: actions/checkout@v6
|
||||
|
||||
# Initializes the CodeQL tools for scanning.
|
||||
- name: Initialize CodeQL
|
||||
uses: github/codeql-action/init@v1
|
||||
uses: github/codeql-action/init@v4
|
||||
with:
|
||||
languages: ${{ matrix.language }}
|
||||
# If you wish to specify custom queries, you can do so here or in a config file.
|
||||
@@ -53,7 +53,7 @@ jobs:
|
||||
# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
|
||||
# If this step fails, then you should remove it and run the build manually (see below)
|
||||
- name: Autobuild
|
||||
uses: github/codeql-action/autobuild@v1
|
||||
uses: github/codeql-action/autobuild@v4
|
||||
|
||||
# ℹ️ Command-line programs to run using the OS shell.
|
||||
# 📚 https://git.io/JvXDl
|
||||
@@ -67,4 +67,4 @@ jobs:
|
||||
# make release
|
||||
|
||||
- name: Perform CodeQL Analysis
|
||||
uses: github/codeql-action/analyze@v1
|
||||
uses: github/codeql-action/analyze@v4
|
||||
|
||||
@@ -13,9 +13,9 @@ jobs:
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- uses: actions/checkout@v6
|
||||
- name: "Set up JDK"
|
||||
uses: actions/setup-java@v2
|
||||
uses: actions/setup-java@v5
|
||||
with:
|
||||
java-version: '11'
|
||||
distribution: 'adopt'
|
||||
@@ -47,9 +47,9 @@ jobs:
|
||||
name: "Deploy Project (GitHub Repo)"
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- uses: actions/checkout@v6
|
||||
- name: "Set up JDK"
|
||||
uses: actions/setup-java@v2
|
||||
uses: actions/setup-java@v5
|
||||
with:
|
||||
java-version: '11'
|
||||
distribution: 'adopt'
|
||||
@@ -63,14 +63,14 @@ jobs:
|
||||
rm -rf deploy
|
||||
mkdir -vp deploy
|
||||
cp -vrf $HOME/local-deploy/* deploy/
|
||||
cp -vrf .documentation/repository/REPO-README.md deploy/README.md
|
||||
cp -vrf .doc/repository/REPO-README.md deploy/README.md
|
||||
|
||||
- name: "Copy Javadoc"
|
||||
run: |
|
||||
rm -rf docs
|
||||
mkdir -vp docs
|
||||
cp -vrf api/target/apidocs/* docs/
|
||||
cp -vrf .documentation/javadoc/JAVADOC-README.md docs/README.md
|
||||
cp -vrf .doc/javadoc/JAVADOC-README.md docs/README.md
|
||||
|
||||
- name: "Generate Javadoc sitemap"
|
||||
id: sitemap
|
||||
@@ -122,9 +122,9 @@ jobs:
|
||||
name: "Deploy Project (Central)"
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- uses: actions/checkout@v6
|
||||
- name: "Set up JDK"
|
||||
uses: actions/setup-java@v2
|
||||
uses: actions/setup-java@v5
|
||||
with:
|
||||
java-version: '11'
|
||||
distribution: 'adopt'
|
||||
|
||||
@@ -19,9 +19,9 @@ jobs:
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- uses: actions/checkout@v6
|
||||
- name: "Set up JDK"
|
||||
uses: actions/setup-java@v2
|
||||
uses: actions/setup-java@v5
|
||||
with:
|
||||
java-version: '11'
|
||||
distribution: 'adopt'
|
||||
@@ -29,13 +29,17 @@ jobs:
|
||||
run: mvn -B package --file pom.xml -Dgpg.skip
|
||||
|
||||
- name: "Upload artifacts"
|
||||
uses: actions/upload-artifact@v2
|
||||
uses: actions/upload-artifact@v6
|
||||
with:
|
||||
name: artifacts
|
||||
path: "**/target/"
|
||||
retention-days: 5
|
||||
include-hidden-files: true
|
||||
|
||||
- name: "Upload assets"
|
||||
uses: actions/upload-artifact@v2
|
||||
uses: actions/upload-artifact@v6
|
||||
with:
|
||||
name: assets
|
||||
path: ".asset/"
|
||||
path: ".asset/"
|
||||
retention-days: 5
|
||||
include-hidden-files: true
|
||||
@@ -22,11 +22,8 @@
|
||||
### 对于服主 (插件使用者)
|
||||
|
||||
- 统一配置数据库连接,避免重复配置费时费力分神。
|
||||
-
|
||||
|
||||
支持更高级更全面的配置方式,以根据不同的使用场景独立优化[连接池配置](https://github.com/Chris2018998/BeeCP/wiki/Configuration--List)
|
||||
。
|
||||
|
||||
- 支持更高级更全面的配置方式,以根据不同的使
|
||||
用场景独立优化[连接池配置](https://github.com/Chris2018998/BeeCP/wiki/Configuration--List)。
|
||||
- 使相关插件共用连接池,避免每个插件单独新开连接池导致资源的浪费。
|
||||
|
||||
### 对于插件开发者
|
||||
@@ -136,7 +133,7 @@ Properties 文件的文件名几位数据源的ID,允许为英文、数字、
|
||||
<!--采用github分支依赖库,稳定更新快-->
|
||||
<id>MineSQL</id>
|
||||
<name>GitHub Branch Repository</name>
|
||||
<url>https://github.com/CarmJos/MineSQL/blob/repo/</url>
|
||||
<url>https://raw.githubusercontent.com/CarmJos/MineSQL/repo/</url>
|
||||
</repository>
|
||||
|
||||
<repository>
|
||||
@@ -173,7 +170,7 @@ repositories {
|
||||
mavenCentral()
|
||||
|
||||
// 采用github分支依赖库,稳定更新快
|
||||
maven { url 'https://github.com/CarmJos/MineSQL/blob/repo/' }
|
||||
maven { url 'https://raw.githubusercontent.com/CarmJos/MineSQL/repo/' }
|
||||
|
||||
// 采用我的私人依赖库,简单方便,但可能因为变故而无法使用
|
||||
maven { url 'https://repo.carm.cc/repository/maven-public/' }
|
||||
@@ -207,7 +204,7 @@ public class Main extends JavaPlugin {
|
||||
|
||||
if (manager == null) {
|
||||
System.out.println("请配置一个正确的数据库名。");
|
||||
setEnable(false);
|
||||
setEnabled(false);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
+2
-2
@@ -5,7 +5,7 @@
|
||||
<parent>
|
||||
<artifactId>minesql-parent</artifactId>
|
||||
<groupId>cc.carm.plugin</groupId>
|
||||
<version>1.1.1</version>
|
||||
<version>1.4.3</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
@@ -81,7 +81,7 @@
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-javadoc-plugin</artifactId>
|
||||
<version>3.2.0</version>
|
||||
<version>3.12.0</version>
|
||||
<configuration>
|
||||
<classifier>javadoc</classifier>
|
||||
<detectJavaApiLink>false</detectJavaApiLink>
|
||||
|
||||
@@ -4,6 +4,8 @@ import cc.carm.lib.easysql.api.SQLManager;
|
||||
import cc.carm.lib.easysql.api.SQLQuery;
|
||||
import cc.carm.plugin.minesql.api.SQLRegistry;
|
||||
import cc.carm.plugin.minesql.api.source.SQLSourceConfig;
|
||||
import cc.carm.plugin.minesql.api.table.SQLTablesRoot;
|
||||
import cc.carm.plugin.minesql.api.table.SimpleSQLTable;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
@@ -61,4 +63,18 @@ interface IMineSQL {
|
||||
*/
|
||||
void shutdown(SQLManager manager, @Nullable Consumer<Map<UUID, SQLQuery>> activeQueries);
|
||||
|
||||
/**
|
||||
* 读取一个 {@link SQLTablesRoot} 中全部的 {@link SimpleSQLTable} 实例并初始化。
|
||||
*
|
||||
* @param tablesRoot {@link SQLTablesRoot}实例
|
||||
*/
|
||||
void createTables(@NotNull SQLTablesRoot tablesRoot) throws Exception;
|
||||
|
||||
/**
|
||||
* 读取一个 {@link SQLTablesRoot}类中 中全部的静态 {@link SimpleSQLTable} 实例并初始化。
|
||||
*
|
||||
* @param tablesRootClazz {@link SQLTablesRoot}静态类
|
||||
*/
|
||||
void createTables(@NotNull Class<? extends SQLTablesRoot> tablesRootClazz) throws Exception;
|
||||
|
||||
}
|
||||
|
||||
@@ -4,6 +4,9 @@ import cc.carm.lib.easysql.api.SQLManager;
|
||||
import cc.carm.lib.easysql.api.SQLQuery;
|
||||
import cc.carm.plugin.minesql.api.SQLRegistry;
|
||||
import cc.carm.plugin.minesql.api.source.SQLSourceConfig;
|
||||
import cc.carm.plugin.minesql.api.table.SQLTablesRoot;
|
||||
import cc.carm.plugin.minesql.api.table.SimpleSQLTable;
|
||||
import org.jetbrains.annotations.ApiStatus;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
@@ -17,9 +20,15 @@ import java.util.logging.Logger;
|
||||
|
||||
public class MineSQL {
|
||||
|
||||
private MineSQL() {
|
||||
throw new UnsupportedOperationException("API Instance");
|
||||
}
|
||||
|
||||
private static IMineSQL instance;
|
||||
|
||||
protected static void initializeAPI(IMineSQL api) {
|
||||
@ApiStatus.Internal
|
||||
@SuppressWarnings("ClassEscapesDefinedScope")
|
||||
protected static void initializeAPI(@NotNull IMineSQL api) {
|
||||
MineSQL.instance = api;
|
||||
}
|
||||
|
||||
@@ -114,4 +123,23 @@ public class MineSQL {
|
||||
shutdown(manager, true);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 读取一个 {@link SQLTablesRoot} 中全部的 {@link SimpleSQLTable} 实例并初始化。
|
||||
*
|
||||
* @param tablesRoot {@link SQLTablesRoot}实例
|
||||
*/
|
||||
public static void createTables(@NotNull SQLTablesRoot tablesRoot) throws Exception {
|
||||
instance.createTables(tablesRoot);
|
||||
}
|
||||
|
||||
/**
|
||||
* 读取一个 {@link SQLTablesRoot}类中 中全部的静态 {@link SimpleSQLTable} 实例并初始化。
|
||||
*
|
||||
* @param tablesRootClazz {@link SQLTablesRoot}静态类
|
||||
*/
|
||||
public static void createTables(@NotNull Class<? extends SQLTablesRoot> tablesRootClazz) throws Exception {
|
||||
instance.createTables(tablesRootClazz);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -12,7 +12,15 @@ import java.util.Optional;
|
||||
* 入口类
|
||||
*/
|
||||
public interface SQLRegistry {
|
||||
|
||||
/**
|
||||
* 获取原生注册的首个 SQLManager 实例
|
||||
*
|
||||
* @return {@link SQLManager} 实例
|
||||
*/
|
||||
default @Nullable SQLManager get() {
|
||||
return get(null);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取原生注册的指定名称的 SQLManager 实例
|
||||
*
|
||||
|
||||
@@ -0,0 +1,12 @@
|
||||
package cc.carm.plugin.minesql.api.table;
|
||||
|
||||
import cc.carm.lib.easysql.api.function.SQLHandler;
|
||||
|
||||
import java.util.function.Supplier;
|
||||
|
||||
/**
|
||||
* 表声明类的根节点,用于标注该类用于记录表的结构信息。
|
||||
* <br> 创建表请使用 {@link SimpleSQLTable#of(String, String, Supplier, SQLHandler)}。
|
||||
*/
|
||||
public abstract class SQLTablesRoot {
|
||||
}
|
||||
@@ -0,0 +1,156 @@
|
||||
package cc.carm.plugin.minesql.api.table;
|
||||
|
||||
import cc.carm.lib.easysql.api.SQLManager;
|
||||
import cc.carm.lib.easysql.api.action.PreparedSQLUpdateAction;
|
||||
import cc.carm.lib.easysql.api.action.PreparedSQLUpdateBatchAction;
|
||||
import cc.carm.lib.easysql.api.builder.*;
|
||||
import cc.carm.lib.easysql.api.function.SQLHandler;
|
||||
import cc.carm.plugin.minesql.MineSQL;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import java.sql.SQLException;
|
||||
import java.util.Optional;
|
||||
import java.util.function.Supplier;
|
||||
|
||||
public class SimpleSQLTable {
|
||||
|
||||
public static @NotNull SimpleSQLTable of(@NotNull String tableName,
|
||||
@NotNull SQLHandler<TableCreateBuilder> tableBuilder) {
|
||||
return new SimpleSQLTable(null, tableName, null, tableBuilder);
|
||||
}
|
||||
|
||||
public static @NotNull SimpleSQLTable of(@Nullable String database, @NotNull String tableName,
|
||||
@NotNull SQLHandler<TableCreateBuilder> tableBuilder) {
|
||||
return new SimpleSQLTable(database, tableName, null, tableBuilder);
|
||||
}
|
||||
|
||||
public static @NotNull SimpleSQLTable of(@Nullable String database, @NotNull String tableName,
|
||||
@Nullable String tablePrefix, @NotNull SQLHandler<TableCreateBuilder> tableBuilder) {
|
||||
return new SimpleSQLTable(database, tableName, () -> tablePrefix, tableBuilder);
|
||||
}
|
||||
|
||||
public static @NotNull SimpleSQLTable of(@Nullable String database, @NotNull String tableName,
|
||||
@Nullable Supplier<String> tablePrefix, @NotNull SQLHandler<TableCreateBuilder> tableBuilder) {
|
||||
return new SimpleSQLTable(database, tableName, tablePrefix, tableBuilder);
|
||||
}
|
||||
|
||||
protected final @Nullable String database;
|
||||
protected final @NotNull String tableName;
|
||||
|
||||
protected final @Nullable Supplier<String> tablePrefix;
|
||||
protected final @NotNull SQLHandler<TableCreateBuilder> tableCreator;
|
||||
|
||||
public SimpleSQLTable(@Nullable String database, @NotNull String tableName,
|
||||
@Nullable Supplier<String> tablePrefix, @NotNull SQLHandler<TableCreateBuilder> table) {
|
||||
this.database = database;
|
||||
this.tableName = tableName;
|
||||
this.tablePrefix = tablePrefix;
|
||||
this.tableCreator = table;
|
||||
}
|
||||
|
||||
public boolean create() throws SQLException {
|
||||
SQLManager sqlManager = getSQLManager();
|
||||
if (sqlManager == null) throw new SQLException(getExceptionReason());
|
||||
|
||||
TableCreateBuilder tableBuilder = sqlManager.createTable(getTableName());
|
||||
tableCreator.accept(tableBuilder);
|
||||
return tableBuilder.build().executeFunction(l -> l > 0, false);
|
||||
}
|
||||
|
||||
public @Nullable String getDatabase() {
|
||||
return database;
|
||||
}
|
||||
|
||||
public @Nullable SQLManager getSQLManager() {
|
||||
return MineSQL.getRegistry().get(getDatabase());
|
||||
}
|
||||
|
||||
public @NotNull String getTableName() {
|
||||
String prefix = getTablePrefix();
|
||||
return (prefix != null ? prefix : "") + tableName;
|
||||
}
|
||||
|
||||
public @Nullable String getTablePrefix() {
|
||||
return Optional.ofNullable(tablePrefix).map(Supplier::get).orElse(null);
|
||||
}
|
||||
|
||||
public @NotNull TableQueryBuilder createQuery() {
|
||||
return Optional.ofNullable(getSQLManager()).map(this::createQuery)
|
||||
.orElseThrow(() -> new NullPointerException(getExceptionReason()));
|
||||
}
|
||||
|
||||
public @NotNull TableQueryBuilder createQuery(@NotNull SQLManager sqlManager) {
|
||||
return sqlManager.createQuery().inTable(getTableName());
|
||||
}
|
||||
|
||||
public @NotNull DeleteBuilder createDelete() {
|
||||
return Optional.ofNullable(getSQLManager()).map(this::createDelete)
|
||||
.orElseThrow(() -> new NullPointerException(getExceptionReason()));
|
||||
}
|
||||
|
||||
public @NotNull DeleteBuilder createDelete(@NotNull SQLManager sqlManager) {
|
||||
return sqlManager.createDelete(getTableName());
|
||||
}
|
||||
|
||||
public @NotNull UpdateBuilder createUpdate() {
|
||||
return Optional.ofNullable(getSQLManager()).map(this::createUpdate)
|
||||
.orElseThrow(() -> new NullPointerException(getExceptionReason()));
|
||||
}
|
||||
|
||||
public @NotNull UpdateBuilder createUpdate(@NotNull SQLManager sqlManager) {
|
||||
return sqlManager.createUpdate(getTableName());
|
||||
}
|
||||
|
||||
public @NotNull InsertBuilder<PreparedSQLUpdateAction<Integer>> createInsert() {
|
||||
return Optional.ofNullable(getSQLManager()).map(this::createInsert)
|
||||
.orElseThrow(() -> new NullPointerException(getExceptionReason()));
|
||||
}
|
||||
|
||||
public @NotNull InsertBuilder<PreparedSQLUpdateAction<Integer>> createInsert(@NotNull SQLManager sqlManager) {
|
||||
return sqlManager.createInsert(getTableName());
|
||||
}
|
||||
|
||||
public @NotNull InsertBuilder<PreparedSQLUpdateBatchAction<Integer>> createInsertBatch() {
|
||||
return Optional.ofNullable(getSQLManager()).map(this::createInsertBatch)
|
||||
.orElseThrow(() -> new NullPointerException(getExceptionReason()));
|
||||
}
|
||||
|
||||
public @NotNull InsertBuilder<PreparedSQLUpdateBatchAction<Integer>> createInsertBatch(@NotNull SQLManager sqlManager) {
|
||||
return sqlManager.createInsertBatch(getTableName());
|
||||
}
|
||||
|
||||
public @NotNull ReplaceBuilder<PreparedSQLUpdateAction<Integer>> createReplace() {
|
||||
return Optional.ofNullable(getSQLManager()).map(this::createReplace)
|
||||
.orElseThrow(() -> new NullPointerException(getExceptionReason()));
|
||||
|
||||
}
|
||||
|
||||
public @NotNull ReplaceBuilder<PreparedSQLUpdateAction<Integer>> createReplace(@NotNull SQLManager sqlManager) {
|
||||
return sqlManager.createReplace(getTableName());
|
||||
}
|
||||
|
||||
public @NotNull ReplaceBuilder<PreparedSQLUpdateBatchAction<Integer>> createReplaceBatch() {
|
||||
return Optional.ofNullable(getSQLManager()).map(this::createReplaceBatch)
|
||||
.orElseThrow(() -> new NullPointerException(getExceptionReason()));
|
||||
}
|
||||
|
||||
public @NotNull ReplaceBuilder<PreparedSQLUpdateBatchAction<Integer>> createReplaceBatch(@NotNull SQLManager sqlManager) {
|
||||
return sqlManager.createReplaceBatch(getTableName());
|
||||
}
|
||||
|
||||
public @NotNull TableAlterBuilder alter() {
|
||||
return Optional.ofNullable(getSQLManager()).map(this::alter)
|
||||
.orElseThrow(() -> new NullPointerException(getExceptionReason()));
|
||||
}
|
||||
|
||||
public @NotNull TableAlterBuilder alter(@NotNull SQLManager sqlManager) {
|
||||
return sqlManager.alterTable(getTableName());
|
||||
}
|
||||
|
||||
private String getExceptionReason() {
|
||||
if (getDatabase() == null) return "Cannot find any SQLManager.";
|
||||
else return "Cannot find any SQLManager for \"" + getDatabase() + "\".";
|
||||
}
|
||||
|
||||
}
|
||||
+59
-34
@@ -5,7 +5,7 @@
|
||||
<parent>
|
||||
<artifactId>minesql-parent</artifactId>
|
||||
<groupId>cc.carm.plugin</groupId>
|
||||
<version>1.1.1</version>
|
||||
<version>1.4.3</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<properties>
|
||||
@@ -80,6 +80,24 @@
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.mariadb.jdbc</groupId>
|
||||
<artifactId>mariadb-java-client</artifactId>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.mysql</groupId>
|
||||
<artifactId>mysql-connector-j</artifactId>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.h2database</groupId>
|
||||
<artifactId>h2</artifactId>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>cc.carm.lib</groupId>
|
||||
<artifactId>easyplugin-githubchecker</artifactId>
|
||||
@@ -96,52 +114,59 @@
|
||||
|
||||
<dependency>
|
||||
<groupId>cc.carm.lib</groupId>
|
||||
<artifactId>easyconfiguration-yaml</artifactId>
|
||||
<artifactId>configured-yaml</artifactId>
|
||||
<version>${deps.easyconf.version}</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>cc.carm.lib</groupId>
|
||||
<artifactId>githubreleases4j</artifactId>
|
||||
<version>1.3.1</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.mariadb.jdbc</groupId>
|
||||
<artifactId>mariadb-java-client</artifactId>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>mysql</groupId>
|
||||
<artifactId>mysql-connector-java</artifactId>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
|
||||
<!--suppress VulnerableLibrariesLocal -->
|
||||
<dependency>
|
||||
<groupId>com.h2database</groupId>
|
||||
<artifactId>h2</artifactId>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-source-plugin</artifactId>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-compiler-plugin</artifactId>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-jar-plugin</artifactId>
|
||||
<artifactId>maven-resources-plugin</artifactId>
|
||||
<version>3.5.0</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>filter-version</id>
|
||||
<phase>process-resources</phase>
|
||||
<goals>
|
||||
<goal>copy-resources</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<outputDirectory>${project.build.directory}/generated-sources/java</outputDirectory>
|
||||
<resources>
|
||||
<resource>
|
||||
<directory>src/main/templates</directory>
|
||||
<filtering>true</filtering>
|
||||
</resource>
|
||||
</resources>
|
||||
</configuration>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.codehaus.mojo</groupId>
|
||||
<artifactId>build-helper-maven-plugin</artifactId>
|
||||
<version>3.6.1</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>add-source</id>
|
||||
<phase>generate-sources</phase>
|
||||
<goals>
|
||||
<goal>add-source</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<sources>
|
||||
<source>${project.build.directory}/generated-sources/java</source>
|
||||
</sources>
|
||||
</configuration>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
|
||||
@@ -1,28 +1,32 @@
|
||||
package cc.carm.plugin.minesql;
|
||||
|
||||
import cc.carm.lib.configuration.EasyConfiguration;
|
||||
import cc.carm.lib.configuration.yaml.YAMLConfigProvider;
|
||||
import cc.carm.lib.configuration.source.ConfigurationHolder;
|
||||
import cc.carm.lib.configuration.source.yaml.YAMLConfigFactory;
|
||||
import cc.carm.lib.easyplugin.utils.JarResourceUtils;
|
||||
import cc.carm.lib.easysql.api.SQLManager;
|
||||
import cc.carm.lib.easysql.api.SQLQuery;
|
||||
import cc.carm.lib.easysql.manager.SQLManagerImpl;
|
||||
import cc.carm.lib.githubreleases4j.GithubReleases4J;
|
||||
import cc.carm.plugin.minesql.api.source.SQLSourceConfig;
|
||||
import cc.carm.plugin.minesql.api.table.SQLTablesRoot;
|
||||
import cc.carm.plugin.minesql.api.table.SimpleSQLTable;
|
||||
import cc.carm.plugin.minesql.command.MineSQLCommand;
|
||||
import cc.carm.plugin.minesql.command.MineSQLHelpFormatter;
|
||||
import cc.carm.plugin.minesql.conf.PluginConfiguration;
|
||||
import cc.carm.plugin.minesql.conf.SQLSourceGroup;
|
||||
import cc.carm.plugin.minesql.util.DBPropertiesUtil;
|
||||
import cn.beecp.BeeDataSource;
|
||||
import cn.beecp.BeeDataSourceConfig;
|
||||
import co.aikar.commands.CommandManager;
|
||||
import co.aikar.commands.InvalidCommandArgument;
|
||||
import co.aikar.commands.Locales;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import org.stone.beecp.BeeDataSource;
|
||||
import org.stone.beecp.BeeDataSourceConfig;
|
||||
|
||||
import javax.sql.DataSource;
|
||||
import java.io.File;
|
||||
import java.lang.reflect.Field;
|
||||
import java.sql.SQLException;
|
||||
import java.util.*;
|
||||
import java.util.function.Consumer;
|
||||
import java.util.logging.Logger;
|
||||
@@ -31,13 +35,11 @@ public class MineSQLCore implements IMineSQL {
|
||||
|
||||
protected static MineSQLCore instance;
|
||||
|
||||
public static final String REPO_OWNER = "CarmJos";
|
||||
public static final String REPO_NAME = "MineSQL";
|
||||
|
||||
protected final MineSQLPlatform platform;
|
||||
|
||||
protected final MineSQLRegistry registry;
|
||||
protected final YAMLConfigProvider configProvider;
|
||||
protected final ConfigurationHolder<?> configProvider;
|
||||
protected final PluginConfiguration config;
|
||||
|
||||
public MineSQLCore(MineSQLPlatform platform) {
|
||||
@@ -45,7 +47,7 @@ public class MineSQLCore implements IMineSQL {
|
||||
this.platform = platform;
|
||||
|
||||
getLogger().info("加载配置文件...");
|
||||
this.configProvider = EasyConfiguration.from(new File(platform.getPluginFolder(), "config.yml"));
|
||||
this.configProvider = YAMLConfigFactory.from(new File(platform.getPluginFolder(), "config.yml")).build();
|
||||
this.config = new PluginConfiguration();
|
||||
this.configProvider.initialize(this.config);
|
||||
|
||||
@@ -107,7 +109,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());
|
||||
@@ -126,11 +128,16 @@ public class MineSQLCore implements IMineSQL {
|
||||
Optional.ofNullable(conf.getSettings().getReadOnly()).ifPresent(config::setDefaultReadOnly);
|
||||
Optional.ofNullable(conf.getSettings().getSchema()).ifPresent(config::setDefaultSchema);
|
||||
|
||||
Optional.ofNullable(conf.getSettings().getValidationSQL()).ifPresent(config::setValidTestSql);
|
||||
Optional.ofNullable(conf.getSettings().getValidationTimeout()).ifPresent(config::setValidTestTimeout);
|
||||
Optional.ofNullable(conf.getSettings().getValidationInterval()).ifPresent(config::setValidAssumeTime);
|
||||
Optional.ofNullable(conf.getSettings().getValidationSQL()).ifPresent(config::setAliveTestSql);
|
||||
Optional.ofNullable(conf.getSettings().getValidationTimeout()).ifPresent(config::setAliveTestTimeout);
|
||||
Optional.ofNullable(conf.getSettings().getValidationInterval()).ifPresent(config::setTimerCheckInterval);
|
||||
|
||||
return create(name, config);
|
||||
SQLManagerImpl manager = create(name, config);
|
||||
if (conf.getInitializer() != null) {
|
||||
conf.getInitializer().accept(manager);
|
||||
}
|
||||
|
||||
return manager;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -157,6 +164,48 @@ public class MineSQLCore implements IMineSQL {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void createTables(@NotNull SQLTablesRoot tablesRoot) throws SQLException {
|
||||
for (Field field : tablesRoot.getClass().getDeclaredFields()) {
|
||||
initializeTableField(tablesRoot, field);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void createTables(@NotNull Class<? extends SQLTablesRoot> clazz) throws SQLException {
|
||||
initializeTableClass(clazz);
|
||||
}
|
||||
|
||||
protected void initializeTableClass(@NotNull Class<?> clazz) throws SQLException {
|
||||
if (!SQLTablesRoot.class.isAssignableFrom(clazz)) return;
|
||||
|
||||
for (Field field : clazz.getDeclaredFields()) {
|
||||
initializeTableField(clazz, field);
|
||||
}
|
||||
|
||||
for (Class<?> subClass : clazz.getDeclaredClasses()) {
|
||||
initializeTableClass(subClass);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
protected void initializeTableField(@NotNull Object source, @NotNull Field field) throws SQLException {
|
||||
try {
|
||||
field.setAccessible(true);
|
||||
Object object = field.get(source);
|
||||
|
||||
if (object instanceof SimpleSQLTable) {
|
||||
((SimpleSQLTable) object).create();
|
||||
} else if (source instanceof SQLTablesRoot && object instanceof SQLTablesRoot) {
|
||||
createTables((SQLTablesRoot) object);
|
||||
} else if (source instanceof Class<?> && object instanceof Class<?>) {
|
||||
// 当且仅当 源字段与字段 均为静态类时,才对目标字段进行下一步初始化加载。
|
||||
initializeTableClass((Class<?>) object);
|
||||
}
|
||||
} catch (IllegalAccessException ignored) {
|
||||
}
|
||||
}
|
||||
|
||||
public void shutdownAll() {
|
||||
this.registry.getManagers().forEach((k, manager) -> {
|
||||
getLogger().info(" 正在关闭数据库 " + k + "...");
|
||||
@@ -188,7 +237,7 @@ public class MineSQLCore implements IMineSQL {
|
||||
return config;
|
||||
}
|
||||
|
||||
public YAMLConfigProvider getConfigProvider() {
|
||||
public ConfigurationHolder<?> getConfigProvider() {
|
||||
return configProvider;
|
||||
}
|
||||
|
||||
@@ -249,8 +298,8 @@ public class MineSQLCore implements IMineSQL {
|
||||
public void checkUpdate(String currentVersion) {
|
||||
Logger logger = getLogger();
|
||||
|
||||
Integer behindVersions = GithubReleases4J.getVersionBehind(REPO_OWNER, REPO_NAME, currentVersion);
|
||||
String downloadURL = GithubReleases4J.getReleasesURL(REPO_OWNER, REPO_NAME);
|
||||
Integer behindVersions = GithubReleases4J.getVersionBehind(References.REPO_OWNER, References.REPO_NAME, currentVersion);
|
||||
String downloadURL = GithubReleases4J.getReleasesURL(References.REPO_OWNER, References.REPO_NAME);
|
||||
if (behindVersions == null) {
|
||||
logger.severe("检查更新失败,请您定期查看插件是否更新,避免安全问题。");
|
||||
logger.severe("下载地址 " + downloadURL);
|
||||
|
||||
@@ -2,6 +2,7 @@ package cc.carm.plugin.minesql;
|
||||
|
||||
import co.aikar.commands.CommandManager;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.logging.Logger;
|
||||
@@ -12,6 +13,6 @@ public interface MineSQLPlatform {
|
||||
|
||||
@NotNull Logger getLogger();
|
||||
|
||||
@NotNull CommandManager<?, ?, ?, ?, ?, ?> getCommandManager();
|
||||
@Nullable CommandManager<?, ?, ?, ?, ?, ?> getCommandManager();
|
||||
|
||||
}
|
||||
|
||||
@@ -21,7 +21,9 @@ public class MineSQLRegistry implements SQLRegistry {
|
||||
|
||||
@Override
|
||||
public @NotNull Optional<@Nullable SQLManager> getOptional(@Nullable String id) {
|
||||
return Optional.of(this.managers.get(id));
|
||||
if (id != null) return Optional.of(this.managers.get(id));
|
||||
else if (managers.isEmpty()) return Optional.empty();
|
||||
else return Optional.ofNullable(managers.values().iterator().next());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -3,6 +3,7 @@ package cc.carm.plugin.minesql.command;
|
||||
import cc.carm.lib.easysql.api.SQLManager;
|
||||
import cc.carm.lib.easysql.api.SQLQuery;
|
||||
import cc.carm.plugin.minesql.MineSQLCore;
|
||||
import cc.carm.plugin.minesql.lib.PluginLibraries;
|
||||
import cc.carm.plugin.minesql.util.VersionReader;
|
||||
import co.aikar.commands.BaseCommand;
|
||||
import co.aikar.commands.CommandHelp;
|
||||
@@ -42,7 +43,7 @@ public class MineSQLCommand extends BaseCommand {
|
||||
issuer.sendMessage("§c只有后台执行才能使用此命令。");
|
||||
return;
|
||||
}
|
||||
VersionReader reader = new VersionReader();
|
||||
VersionReader reader = PluginLibraries.READER;
|
||||
String pluginVersion = reader.get("plugin", null);
|
||||
if (pluginVersion == null) {
|
||||
issuer.sendMessage("§c无法获取当前版本信息,请保证使用原生版本以避免安全问题。");
|
||||
@@ -50,9 +51,9 @@ public class MineSQLCommand extends BaseCommand {
|
||||
}
|
||||
issuer.sendMessage("§r当前插件版本为 §b" + pluginVersion + "§r。 §7(基于 EasySQL &3" + reader.get("api") + "&7)");
|
||||
issuer.sendMessage("§8 - &f连接池依赖 BeeCP §9" + reader.get("beecp"));
|
||||
issuer.sendMessage("§8 - &f数据库驱动 MySQL §9" + reader.get("mysql-driver"));
|
||||
issuer.sendMessage("§8 - &f数据库驱动 MariaDB §9" + reader.get("mariadb-driver"));
|
||||
issuer.sendMessage("§8 - &f数据库驱动 h2-database §9" + reader.get("h2-driver"));
|
||||
issuer.sendMessage("§8 - &f数据库驱动 MySQL §9" + PluginLibraries.MYSQL_DRIVER.getVersion());
|
||||
issuer.sendMessage("§8 - &f数据库驱动 MariaDB §9" + PluginLibraries.MARIADB_DRIVER.getVersion());
|
||||
issuer.sendMessage("§8 - &f数据库驱动 h2-database §9" + PluginLibraries.H2_DRIVER.getVersion());
|
||||
|
||||
issuer.sendMessage("§r正在检查插件更新,请稍候...");
|
||||
core.checkUpdate(pluginVersion);
|
||||
|
||||
@@ -1,69 +1,70 @@
|
||||
package cc.carm.plugin.minesql.conf;
|
||||
|
||||
import cc.carm.lib.configuration.core.ConfigurationRoot;
|
||||
import cc.carm.lib.configuration.core.annotation.HeaderComment;
|
||||
import cc.carm.lib.configuration.core.value.ConfigValue;
|
||||
import cc.carm.lib.configuration.core.value.type.ConfiguredValue;
|
||||
import cc.carm.lib.configuration.Configuration;
|
||||
import cc.carm.lib.configuration.annotation.ConfigPath;
|
||||
import cc.carm.lib.configuration.annotation.HeaderComments;
|
||||
import cc.carm.lib.configuration.value.standard.ConfiguredValue;
|
||||
|
||||
public class PluginConfiguration extends ConfigurationRoot {
|
||||
@ConfigPath(root = true)
|
||||
public class PluginConfiguration implements Configuration {
|
||||
|
||||
@HeaderComment("排错模式,一般留给开发者检查问题,平常使用无需开启。")
|
||||
public ConfigValue<Boolean> DEBUG = ConfiguredValue.of(Boolean.class, false);
|
||||
@HeaderComments("排错模式,一般留给开发者检查问题,平常使用无需开启。")
|
||||
public final ConfiguredValue<Boolean> DEBUG = ConfiguredValue.of(Boolean.class, false);
|
||||
|
||||
@HeaderComment({
|
||||
@HeaderComments({"",
|
||||
"统计数据设定",
|
||||
"该选项用于帮助开发者统计插件版本与使用情况,且绝不会影响性能与使用体验。",
|
||||
"当然,您也可以选择在这里关闭,或在plugins/bStats下的配置文件中关闭所有插件的统计信息。"
|
||||
})
|
||||
public ConfigValue<Boolean> METRICS = ConfiguredValue.of(Boolean.class, true);
|
||||
public final ConfiguredValue<Boolean> METRICS = ConfiguredValue.of(Boolean.class, true);
|
||||
|
||||
@HeaderComment({
|
||||
@HeaderComments({"",
|
||||
"检查更新设定",
|
||||
"该选项用于插件判断是否要检查更新,若您不希望插件检查更新并提示您,可以选择关闭。",
|
||||
"检查更新为异步操作,绝不会影响性能与使用体验。"
|
||||
})
|
||||
public ConfigValue<Boolean> UPDATE_CHECKER = ConfiguredValue.of(Boolean.class, true);
|
||||
public final ConfiguredValue<Boolean> UPDATE_CHECKER = ConfiguredValue.of(Boolean.class, true);
|
||||
|
||||
@HeaderComment({"插件注册池配置"})
|
||||
public SettingsConfig SETTINGS = new SettingsConfig();
|
||||
@HeaderComments({"插件注册池配置"})
|
||||
public final SettingsConfig SETTINGS = new SettingsConfig();
|
||||
|
||||
@HeaderComment({
|
||||
@HeaderComments({"",
|
||||
"Properties 数据库配置文件配置",
|
||||
"相关配置介绍(BeeCP) https://github.com/Chris2018998/BeeCP/wiki/Configuration--List#配置列表"
|
||||
})
|
||||
public PropertiesConfig PROPERTIES = new PropertiesConfig();
|
||||
public final PropertiesConfig PROPERTIES = new PropertiesConfig();
|
||||
|
||||
@HeaderComment({
|
||||
@HeaderComments({"",
|
||||
"数据库源配置",
|
||||
"目前支持的驱动类型(type)有 mariadb、mysql、h2-file(文件数据库) 与 h2-mem(内存临时数据库)。",
|
||||
"详细配置介绍请查看 https://github.com/CarmJos/MineSQL/.doc/README.md"
|
||||
})
|
||||
public ConfigValue<SQLSourceGroup> SOURCES = ConfigValue.builder()
|
||||
.asValue(SQLSourceGroup.class).fromSection()
|
||||
.parseValue((w, d) -> SQLSourceGroup.parse(w))
|
||||
.serializeValue(SQLSourceGroup::serialize)
|
||||
public final ConfiguredValue<SQLSourceGroup> SOURCES = ConfiguredValue.builderOf(SQLSourceGroup.class)
|
||||
.fromSection()
|
||||
.parse((w, sec) -> SQLSourceGroup.parse(sec))
|
||||
.serialize(SQLSourceGroup::serialize)
|
||||
.defaults(SQLSourceGroup.defaults())
|
||||
.build();
|
||||
|
||||
public static class PropertiesConfig extends ConfigurationRoot {
|
||||
public static class PropertiesConfig implements Configuration {
|
||||
|
||||
@HeaderComment("该选项用于启用 Properties 配置读取,若您不希望插件启用 Properties 文件配置,可以选择关闭。")
|
||||
public ConfigValue<Boolean> ENABLE = ConfiguredValue.of(Boolean.class, true);
|
||||
@HeaderComments({"该选项用于启用 Properties 配置读取。", "若您不希望插件启用 Properties 文件配置功能,可以选择关闭。"})
|
||||
public ConfiguredValue<Boolean> ENABLE = ConfiguredValue.of(Boolean.class, true);
|
||||
|
||||
@HeaderComment({
|
||||
@HeaderComments({
|
||||
"文件夹路径,将读取该文件夹下的所有 .properties 文件,并以文件名为数据管理器名称。",
|
||||
"读取时,将排除以 “.” 开头的文件与非 .properties 文件。",
|
||||
"默认为 \"db-properties/\" 相对路径,指向“plugins/MineSQL/db-properties/”;",
|
||||
"该选项也支持绝对路径,但使用绝对路径时,请务必注意权限问题。"
|
||||
})
|
||||
public ConfigValue<String> FOLDER = ConfiguredValue.of(String.class, "db-properties/");
|
||||
public ConfiguredValue<String> FOLDER = ConfiguredValue.of(String.class, "db-properties/");
|
||||
|
||||
}
|
||||
|
||||
public static class SettingsConfig extends ConfigurationRoot {
|
||||
public static class SettingsConfig implements Configuration {
|
||||
|
||||
@HeaderComment({"在插件卸载时是否强制关闭活跃链接"})
|
||||
public ConfigValue<Boolean> FORCE_CLOSE = ConfiguredValue.of(Boolean.class, true);
|
||||
@HeaderComments({"在插件卸载时是否强制关闭活跃链接"})
|
||||
public ConfiguredValue<Boolean> FORCE_CLOSE = ConfiguredValue.of(Boolean.class, true);
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
package cc.carm.plugin.minesql.conf;
|
||||
|
||||
import cc.carm.lib.configuration.core.source.ConfigurationWrapper;
|
||||
import cc.carm.lib.configuration.source.section.ConfigureSection;
|
||||
import cc.carm.plugin.minesql.MineSQL;
|
||||
import cc.carm.plugin.minesql.api.SQLDriverType;
|
||||
import cc.carm.plugin.minesql.api.conf.SQLDriverConfig;
|
||||
@@ -44,11 +44,11 @@ public class SQLSourceGroup {
|
||||
return new SQLSourceGroup(configs);
|
||||
}
|
||||
|
||||
public static @NotNull SQLSourceGroup parse(ConfigurationWrapper<?> rootSection) {
|
||||
public static @NotNull SQLSourceGroup parse(ConfigureSection rootSection) {
|
||||
LinkedHashMap<String, SQLDriverConfig> configs = new LinkedHashMap<>();
|
||||
for (String name : rootSection.getKeys(false)) {
|
||||
if (!rootSection.isConfigurationSection(name)) continue;
|
||||
ConfigurationWrapper<?> section = rootSection.getConfigurationSection(name);
|
||||
if (!rootSection.isSection(name)) continue;
|
||||
ConfigureSection section = rootSection.getSection(name);
|
||||
if (section == null) continue;
|
||||
SQLDriverConfig conf = parse(name, section);
|
||||
if (conf != null) configs.put(name, conf);
|
||||
@@ -56,7 +56,7 @@ public class SQLSourceGroup {
|
||||
return new SQLSourceGroup(configs);
|
||||
}
|
||||
|
||||
public static @Nullable SQLDriverConfig parse(String name, ConfigurationWrapper<?> section) {
|
||||
public static @Nullable SQLDriverConfig parse(String name, ConfigureSection section) {
|
||||
@Nullable String driverString = section.getString("type");
|
||||
@Nullable SQLDriverType driverType = SQLDriverType.parse(driverString);
|
||||
if (driverType == null) {
|
||||
|
||||
@@ -0,0 +1,27 @@
|
||||
package cc.carm.plugin.minesql.lib;
|
||||
|
||||
import cc.carm.plugin.minesql.util.VersionReader;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
public enum PluginLibraries {
|
||||
|
||||
BEECP("com.github.chris2018998", "beecp"),
|
||||
H2_DRIVER("com.h2database", "h2"),
|
||||
MYSQL_DRIVER("com.mysql", "mysql-connector-j"),
|
||||
MARIADB_DRIVER("org.mariadb.jdbc", "mariadb-java-client");
|
||||
|
||||
public static final VersionReader READER = new VersionReader();
|
||||
|
||||
private final @NotNull String groupID;
|
||||
private final @NotNull String artifactID;
|
||||
|
||||
PluginLibraries(@NotNull String groupID, @NotNull String artifactID) {
|
||||
this.groupID = groupID;
|
||||
this.artifactID = artifactID;
|
||||
}
|
||||
|
||||
public @NotNull String getVersion() {
|
||||
return READER.get(name().toLowerCase().replace('_', '-'));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -17,7 +17,7 @@ public class DBPropertiesUtil {
|
||||
if (!propertiesFolder.exists() || !propertiesFolder.isDirectory()) return propertiesMap;
|
||||
|
||||
File[] files = propertiesFolder.listFiles();
|
||||
if (files == null || files.length == 0) return propertiesMap;
|
||||
if (files == null) return propertiesMap;
|
||||
for (File file : files) {
|
||||
if (!validateName(file.getName())) continue;
|
||||
String name = file.getName().substring(0, file.getName().lastIndexOf("."));
|
||||
|
||||
@@ -1,45 +0,0 @@
|
||||
package cc.carm.plugin.minesql.util;
|
||||
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import java.io.InputStream;
|
||||
import java.util.Properties;
|
||||
|
||||
public class MavenReadUtil {
|
||||
|
||||
public static String getMavenPropertiesPath(@NotNull String groupID, @NotNull String artifactID) {
|
||||
return String.format("/META-INF/maven/%s/%s/pom.properties", groupID, artifactID);
|
||||
}
|
||||
|
||||
public static synchronized @Nullable String getVersion(@NotNull Object provider,
|
||||
@NotNull String groupID,
|
||||
@NotNull String artifactID) {
|
||||
String path = getMavenPropertiesPath(groupID, artifactID);
|
||||
String version = null;
|
||||
// Using maven properties to get the version
|
||||
try (InputStream is = provider.getClass().getResourceAsStream(path)) {
|
||||
if (is != null) {
|
||||
Properties p = new Properties();
|
||||
p.load(is);
|
||||
version = p.getProperty("version", "");
|
||||
}
|
||||
} catch (Exception ignored) {
|
||||
}
|
||||
|
||||
if (version != null) return version;
|
||||
|
||||
// Fine, lets try Java API
|
||||
Package pkg = provider.getClass().getPackage();
|
||||
if (pkg != null) {
|
||||
version = pkg.getImplementationVersion();
|
||||
if (version == null) {
|
||||
version = pkg.getSpecificationVersion();
|
||||
}
|
||||
}
|
||||
|
||||
return version;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
package cc.carm.plugin.minesql;
|
||||
|
||||
public interface References {
|
||||
|
||||
String REPO_OWNER = "CarmJos";
|
||||
String REPO_NAME = "MineSQL";
|
||||
String VERSION = "${project.version}";
|
||||
|
||||
}
|
||||
@@ -5,7 +5,7 @@
|
||||
<parent>
|
||||
<artifactId>minesql-parent</artifactId>
|
||||
<groupId>cc.carm.plugin</groupId>
|
||||
<version>1.1.1</version>
|
||||
<version>1.4.3</version>
|
||||
<relativePath>../../pom.xml</relativePath>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
@@ -19,7 +19,7 @@
|
||||
<maven.deploy.skip>true</maven.deploy.skip>
|
||||
</properties>
|
||||
|
||||
<artifactId>minesql-bukkit</artifactId>
|
||||
<artifactId>minesql-platform-bukkit</artifactId>
|
||||
<packaging>jar</packaging>
|
||||
|
||||
<name>MineSQL-Bukkit</name>
|
||||
@@ -75,21 +75,21 @@
|
||||
<dependency>
|
||||
<groupId>org.spigotmc</groupId>
|
||||
<artifactId>spigot-api</artifactId>
|
||||
<version>1.16.3-R0.1-SNAPSHOT</version>
|
||||
<version>1.19-R0.1-20220725.090125-47</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.bstats</groupId>
|
||||
<artifactId>bstats-bukkit</artifactId>
|
||||
<version>3.0.0</version>
|
||||
<version>${deps.bstats.version}</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>co.aikar</groupId>
|
||||
<artifactId>acf-paper</artifactId>
|
||||
<version>0.5.1-SNAPSHOT</version>
|
||||
<version>${deps.acf.version}</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
|
||||
@@ -97,10 +97,6 @@
|
||||
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-source-plugin</artifactId>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-compiler-plugin</artifactId>
|
||||
|
||||
@@ -2,6 +2,7 @@ package cc.carm.plugin.minesql;
|
||||
|
||||
import cc.carm.lib.easyplugin.EasyPlugin;
|
||||
import cc.carm.plugin.minesql.conf.PluginConfiguration;
|
||||
import co.aikar.commands.CommandManager;
|
||||
import co.aikar.commands.PaperCommandManager;
|
||||
import org.bstats.bukkit.Metrics;
|
||||
import org.bstats.charts.SimplePie;
|
||||
@@ -43,7 +44,7 @@ public class MineSQLBukkit extends EasyPlugin implements MineSQLPlatform {
|
||||
);
|
||||
}
|
||||
|
||||
if (getConfiguration().PROPERTIES.ENABLE.getNotNull()) {
|
||||
if (getConfiguration().UPDATE_CHECKER.getNotNull()) {
|
||||
log("开始检查更新,可能需要一小段时间...");
|
||||
log(" 如不希望检查更新,可在配置文件中关闭。");
|
||||
getScheduler().runAsync(() -> this.core.checkUpdate(getDescription().getVersion()));
|
||||
@@ -73,7 +74,7 @@ public class MineSQLBukkit extends EasyPlugin implements MineSQLPlatform {
|
||||
return this.core.getConfig();
|
||||
}
|
||||
|
||||
public @NotNull PaperCommandManager getCommandManager() {
|
||||
public @NotNull CommandManager<?, ?, ?, ?, ?, ?> getCommandManager() {
|
||||
return commandManager;
|
||||
}
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
<parent>
|
||||
<artifactId>minesql-parent</artifactId>
|
||||
<groupId>cc.carm.plugin</groupId>
|
||||
<version>1.1.1</version>
|
||||
<version>1.4.3</version>
|
||||
<relativePath>../../pom.xml</relativePath>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
@@ -19,7 +19,7 @@
|
||||
<maven.deploy.skip>true</maven.deploy.skip>
|
||||
</properties>
|
||||
|
||||
<artifactId>minesql-bungee</artifactId>
|
||||
<artifactId>minesql-platform-bungee</artifactId>
|
||||
<packaging>jar</packaging>
|
||||
|
||||
<name>MineSQL-Bungee</name>
|
||||
@@ -56,15 +56,6 @@
|
||||
<url>https://github.com/CarmJos/MineSQL/actions/workflows/maven.yml</url>
|
||||
</ciManagement>
|
||||
|
||||
<repositories>
|
||||
|
||||
<repository>
|
||||
<id>bungeecord-repo</id>
|
||||
<url>https://oss.sonatype.org/content/repositories/snapshots</url>
|
||||
</repository>
|
||||
|
||||
</repositories>
|
||||
|
||||
<dependencies>
|
||||
|
||||
<dependency>
|
||||
@@ -75,32 +66,23 @@
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>net.md-5</groupId>
|
||||
<artifactId>bungeecord-api</artifactId>
|
||||
<version>1.16-R0.5-SNAPSHOT</version>
|
||||
<type>jar</type>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>net.md-5</groupId>
|
||||
<artifactId>bungeecord-api</artifactId>
|
||||
<version>1.16-R0.5-SNAPSHOT</version>
|
||||
<type>javadoc</type>
|
||||
<groupId>io.github.waterfallmc</groupId>
|
||||
<artifactId>waterfall-api</artifactId>
|
||||
<version>1.21-R0.5-SNAPSHOT</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.bstats</groupId>
|
||||
<artifactId>bstats-bungeecord</artifactId>
|
||||
<version>3.0.0</version>
|
||||
<version>${deps.bstats.version}</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>co.aikar</groupId>
|
||||
<artifactId>acf-bungee</artifactId>
|
||||
<version>0.5.1-SNAPSHOT</version>
|
||||
<version>${deps.acf.version}</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
|
||||
@@ -108,10 +90,6 @@
|
||||
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-source-plugin</artifactId>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-compiler-plugin</artifactId>
|
||||
|
||||
@@ -51,7 +51,7 @@ public class MineSQLBungee extends Plugin implements MineSQLPlatform {
|
||||
);
|
||||
}
|
||||
|
||||
if (getConfiguration().PROPERTIES.ENABLE.getNotNull()) {
|
||||
if (getConfiguration().UPDATE_CHECKER.getNotNull()) {
|
||||
getLogger().info("开始检查更新,可能需要一小段时间...");
|
||||
getLogger().info(" 如不希望检查更新,可在配置文件中关闭。");
|
||||
ProxyServer.getInstance().getScheduler().runAsync(
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
<parent>
|
||||
<artifactId>minesql-parent</artifactId>
|
||||
<groupId>cc.carm.plugin</groupId>
|
||||
<version>1.1.1</version>
|
||||
<version>1.4.3</version>
|
||||
<relativePath>../../pom.xml</relativePath>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
@@ -19,7 +19,7 @@
|
||||
<maven.deploy.skip>true</maven.deploy.skip>
|
||||
</properties>
|
||||
|
||||
<artifactId>minesql-velocity</artifactId>
|
||||
<artifactId>minesql-platform-velocity</artifactId>
|
||||
<packaging>jar</packaging>
|
||||
|
||||
<name>MineSQL-Velocity</name>
|
||||
@@ -85,13 +85,15 @@
|
||||
<dependency>
|
||||
<groupId>org.bstats</groupId>
|
||||
<artifactId>bstats-velocity</artifactId>
|
||||
<version>3.0.0</version>
|
||||
<version>${deps.bstats.version}</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>co.aikar</groupId>
|
||||
<artifactId>acf-velocity</artifactId>
|
||||
<version>0.5.1-SNAPSHOT</version>
|
||||
<version>${deps.acf.version}</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
@@ -99,10 +101,6 @@
|
||||
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-source-plugin</artifactId>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-compiler-plugin</artifactId>
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
package cc.carm.plugin.minesql;
|
||||
|
||||
|
||||
import cc.carm.plugin.minesql.conf.PluginConfiguration;
|
||||
import co.aikar.commands.CommandManager;
|
||||
import co.aikar.commands.VelocityCommandManager;
|
||||
@@ -23,7 +22,8 @@ import java.nio.file.Path;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
|
||||
@Plugin(id = "minesql", name = "MineSQL (EasySQL-Plugin)", version = "1.0.0",
|
||||
@Plugin(id = "minesql", name = "MineSQL (EasySQL-Plugin)",
|
||||
version = References.VERSION,
|
||||
description = "EasySQL Plugin For Velocity",
|
||||
url = "https://github.com/CarmJos/MineSQL",
|
||||
authors = {"CarmJos", "GhostChu"}
|
||||
@@ -54,7 +54,8 @@ public class MineSQLVelocity implements MineSQLPlatform {
|
||||
|
||||
@Subscribe(order = PostOrder.FIRST)
|
||||
public void onInitialize(ProxyInitializeEvent event) {
|
||||
outputInfo();
|
||||
|
||||
|
||||
getLogger().info("初始化指令管理器...");
|
||||
this.commandManager = new VelocityCommandManager(server, this);
|
||||
|
||||
@@ -72,7 +73,7 @@ public class MineSQLVelocity implements MineSQLPlatform {
|
||||
);
|
||||
}
|
||||
|
||||
if (getConfiguration().PROPERTIES.ENABLE.getNotNull()) {
|
||||
if (getConfiguration().UPDATE_CHECKER.getNotNull()) {
|
||||
getLogger().info("开始检查更新,可能需要一小段时间...");
|
||||
getLogger().info(" 如不希望检查更新,可在配置文件中关闭。");
|
||||
server.getScheduler().buildTask(this, () -> this.core.checkUpdate(getVersion())).schedule();
|
||||
@@ -84,7 +85,6 @@ public class MineSQLVelocity implements MineSQLPlatform {
|
||||
|
||||
@Subscribe(order = PostOrder.LAST)
|
||||
public void onShutdown(ProxyShutdownEvent event) {
|
||||
outputInfo();
|
||||
getLogger().info("终止全部数据库连接...");
|
||||
this.core.shutdownAll();
|
||||
}
|
||||
@@ -108,7 +108,6 @@ public class MineSQLVelocity implements MineSQLPlatform {
|
||||
return this.dataFolder;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public @NotNull CommandManager<?, ?, ?, ?, ?, ?> getCommandManager() {
|
||||
return commandManager;
|
||||
@@ -117,8 +116,4 @@ public class MineSQLVelocity implements MineSQLPlatform {
|
||||
public @NotNull PluginConfiguration getConfiguration() {
|
||||
return this.core.getConfig();
|
||||
}
|
||||
|
||||
public void outputInfo() {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
+18
-58
@@ -5,7 +5,7 @@
|
||||
<parent>
|
||||
<artifactId>minesql-parent</artifactId>
|
||||
<groupId>cc.carm.plugin</groupId>
|
||||
<version>1.1.1</version>
|
||||
<version>1.4.3</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<properties>
|
||||
@@ -22,21 +22,21 @@
|
||||
|
||||
<dependency>
|
||||
<groupId>${project.parent.groupId}</groupId>
|
||||
<artifactId>minesql-bukkit</artifactId>
|
||||
<artifactId>minesql-platform-bukkit</artifactId>
|
||||
<version>${project.parent.version}</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>${project.parent.groupId}</groupId>
|
||||
<artifactId>minesql-bungee</artifactId>
|
||||
<artifactId>minesql-platform-bungee</artifactId>
|
||||
<version>${project.parent.version}</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>${project.parent.groupId}</groupId>
|
||||
<artifactId>minesql-velocity</artifactId>
|
||||
<artifactId>minesql-platform-velocity</artifactId>
|
||||
<version>${project.parent.version}</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
@@ -45,10 +45,6 @@
|
||||
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-source-plugin</artifactId>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-compiler-plugin</artifactId>
|
||||
@@ -60,7 +56,7 @@
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-shade-plugin</artifactId>
|
||||
<version>3.2.3</version>
|
||||
<version>3.6.1</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<phase>package</phase>
|
||||
@@ -77,83 +73,45 @@
|
||||
<relocations>
|
||||
<relocation>
|
||||
<pattern>org.bstats</pattern>
|
||||
<shadedPattern>cc.carm.plugin.minesql.lib.bstats</shadedPattern>
|
||||
<shadedPattern>${code.package}.lib.bstats</shadedPattern>
|
||||
</relocation>
|
||||
<relocation>
|
||||
<pattern>org.json</pattern>
|
||||
<shadedPattern>cc.carm.plugin.minesql.lib.json</shadedPattern>
|
||||
<shadedPattern>${code.package}.lib.json</shadedPattern>
|
||||
</relocation>
|
||||
<relocation>
|
||||
<pattern>cc.carm.lib.easyplugin</pattern>
|
||||
<shadedPattern>cc.carm.plugin.minesql.lib.easyplugin</shadedPattern>
|
||||
<shadedPattern>${code.package}.lib.easyplugin</shadedPattern>
|
||||
</relocation>
|
||||
<relocation>
|
||||
<pattern>cc.carm.lib.githubreleases4j</pattern>
|
||||
<shadedPattern>cc.carm.plugin.minesql.lib.githubreleases4j</shadedPattern>
|
||||
<shadedPattern>${code.package}.lib.githubreleases4j</shadedPattern>
|
||||
</relocation>
|
||||
<relocation>
|
||||
<pattern>cc.carm.lib.configuration</pattern>
|
||||
<shadedPattern>cc.carm.plugin.minesql.lib.configuration</shadedPattern>
|
||||
<shadedPattern>${code.package}.lib.configuration</shadedPattern>
|
||||
</relocation>
|
||||
<relocation>
|
||||
<pattern>org.bspfsystems.yamlconfiguration</pattern>
|
||||
<shadedPattern>cc.carm.plugin.minesql.lib.configuration.yaml
|
||||
</shadedPattern> <!-- Replace this -->
|
||||
<shadedPattern>${code.package}.lib.configuration.yaml</shadedPattern>
|
||||
</relocation>
|
||||
<relocation>
|
||||
<pattern>org.yaml.snakeyaml</pattern>
|
||||
<shadedPattern>cc.carm.plugin.minesql.lib.yaml</shadedPattern> <!-- Replace this -->
|
||||
<shadedPattern>${code.package}.lib.yaml</shadedPattern> <!-- Replace this -->
|
||||
</relocation>
|
||||
|
||||
<relocation>
|
||||
<pattern>co.aikar.commands</pattern>
|
||||
<shadedPattern>cc.carm.plugin.minesql.lib.acf</shadedPattern> <!-- Replace this -->
|
||||
<shadedPattern>${code.package}.lib.acf</shadedPattern> <!-- Replace this -->
|
||||
</relocation>
|
||||
<relocation>
|
||||
<pattern>co.aikar.locales</pattern>
|
||||
<shadedPattern>cc.carm.plugin.minesql.lib.locales</shadedPattern> <!-- Replace this -->
|
||||
</relocation>
|
||||
<relocation>
|
||||
<pattern>cn.beecp</pattern>
|
||||
<shadedPattern>cc.carm.plugin.minesql.lib.beecp</shadedPattern> <!-- Replace this -->
|
||||
<shadedPattern>${code.package}.lib.locales</shadedPattern> <!-- Replace this -->
|
||||
</relocation>
|
||||
|
||||
<relocation>
|
||||
<pattern>org.h2</pattern>
|
||||
<shadedPattern>cc.carm.plugin.minesql.driver.h2</shadedPattern> <!-- Replace this -->
|
||||
</relocation>
|
||||
<relocation>
|
||||
<pattern>org.mariadb</pattern>
|
||||
<shadedPattern>cc.carm.plugin.minesql.driver.mariadb</shadedPattern> <!-- Replace this -->
|
||||
</relocation>
|
||||
<relocation>
|
||||
<pattern>com.mysql</pattern>
|
||||
<shadedPattern>cc.carm.plugin.minesql.driver.mysql</shadedPattern> <!-- Replace this -->
|
||||
</relocation>
|
||||
|
||||
<relocation>
|
||||
<pattern>com.sun.jna</pattern>
|
||||
<shadedPattern>cc.carm.plugin.minesql.lib.jna</shadedPattern> <!-- Replace this -->
|
||||
</relocation>
|
||||
<relocation>
|
||||
<pattern>com.google.protobuf</pattern>
|
||||
<shadedPattern>cc.carm.plugin.minesql.lib.google.protobuf</shadedPattern> <!-- Replace this -->
|
||||
</relocation>
|
||||
<relocation>
|
||||
<pattern>com.google.errorprone</pattern>
|
||||
<shadedPattern>cc.carm.plugin.minesql.lib.google.errorprone</shadedPattern> <!-- Replace this -->
|
||||
</relocation>
|
||||
<relocation>
|
||||
<pattern>com.github</pattern>
|
||||
<shadedPattern>cc.carm.plugin.minesql.lib.github</shadedPattern> <!-- Replace this -->
|
||||
</relocation>
|
||||
<relocation>
|
||||
<pattern>org.checkerframework</pattern>
|
||||
<shadedPattern>cc.carm.plugin.minesql.lib.checkerframework</shadedPattern> <!-- Replace this -->
|
||||
</relocation>
|
||||
<relocation>
|
||||
<pattern>waffle</pattern>
|
||||
<shadedPattern>cc.carm.plugin.minesql.lib.waffle</shadedPattern> <!-- Replace this -->
|
||||
<pattern>net.byteflux.libby</pattern>
|
||||
<shadedPattern>${code.package}.lib.libby</shadedPattern>
|
||||
</relocation>
|
||||
|
||||
</relocations>
|
||||
@@ -172,6 +130,8 @@
|
||||
<excludes>
|
||||
<exclude>META-INF/MANIFEST.MF</exclude>
|
||||
<exclude>META-INF/*.txt</exclude>
|
||||
<exclude>LICENSE</exclude>
|
||||
<exclude>README</exclude>
|
||||
</excludes>
|
||||
</filter>
|
||||
</filters>
|
||||
|
||||
@@ -11,20 +11,26 @@
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
<maven.compiler.encoding>UTF-8</maven.compiler.encoding>
|
||||
|
||||
<deps.easysql.version>0.4.6</deps.easysql.version>
|
||||
<deps.easyconf.version>3.3.1</deps.easyconf.version>
|
||||
<deps.easyplugin.version>1.4.18</deps.easyplugin.version>
|
||||
<deps.beecp.version>3.3.9</deps.beecp.version>
|
||||
<deps.easysql.version>0.4.7</deps.easysql.version>
|
||||
<deps.easyconf.version>4.2.0</deps.easyconf.version>
|
||||
<deps.easyplugin.version>1.5.14</deps.easyplugin.version>
|
||||
<deps.beecp.version>5.2.1</deps.beecp.version>
|
||||
|
||||
<deps.mysql-driver.version>8.0.31</deps.mysql-driver.version>
|
||||
<deps.mariadb-driver.version>3.1.0</deps.mariadb-driver.version>
|
||||
<deps.h2-driver.version>2.1.214</deps.h2-driver.version>
|
||||
<deps.libby.version>1.1.5</deps.libby.version>
|
||||
<deps.acf.version>0.5.1-SNAPSHOT</deps.acf.version>
|
||||
<deps.bstats.version>3.1.0</deps.bstats.version>
|
||||
|
||||
<deps.mysql-driver.version>9.6.0</deps.mysql-driver.version>
|
||||
<deps.mariadb-driver.version>3.5.7</deps.mariadb-driver.version>
|
||||
<deps.h2-driver.version>2.4.240</deps.h2-driver.version>
|
||||
|
||||
<code.package>cc.carm.plugin.minesql</code.package>
|
||||
</properties>
|
||||
|
||||
<groupId>cc.carm.plugin</groupId>
|
||||
<artifactId>minesql-parent</artifactId>
|
||||
<packaging>pom</packaging>
|
||||
<version>1.1.1</version>
|
||||
<version>1.4.3</version>
|
||||
<modules>
|
||||
<module>api</module>
|
||||
<module>core</module>
|
||||
@@ -32,6 +38,7 @@
|
||||
<module>platforms/bukkit</module>
|
||||
<module>platforms/bungee</module>
|
||||
<module>platforms/velocity</module>
|
||||
|
||||
<module>plugin</module>
|
||||
</modules>
|
||||
|
||||
@@ -115,7 +122,7 @@
|
||||
<dependency>
|
||||
<groupId>org.jetbrains</groupId>
|
||||
<artifactId>annotations</artifactId>
|
||||
<version>23.1.0</version>
|
||||
<version>26.0.2-1</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
|
||||
@@ -148,7 +155,7 @@
|
||||
<dependency>
|
||||
<groupId>com.google.guava</groupId>
|
||||
<artifactId>guava</artifactId>
|
||||
<version>31.0.1-jre</version>
|
||||
<version>33.5.0-jre</version>
|
||||
</dependency>
|
||||
|
||||
<!-- https://mvnrepository.com/artifact/org.mariadb.jdbc/mariadb-java-client -->
|
||||
@@ -160,8 +167,8 @@
|
||||
|
||||
<!-- https://mvnrepository.com/artifact/mysql/mysql-connector-java -->
|
||||
<dependency>
|
||||
<groupId>mysql</groupId>
|
||||
<artifactId>mysql-connector-java</artifactId>
|
||||
<groupId>com.mysql</groupId>
|
||||
<artifactId>mysql-connector-j</artifactId>
|
||||
<version>${deps.mysql-driver.version}</version>
|
||||
</dependency>
|
||||
|
||||
@@ -180,7 +187,7 @@
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-clean-plugin</artifactId>
|
||||
<version>2.5</version>
|
||||
<version>3.5.0</version>
|
||||
<configuration>
|
||||
<filesets>
|
||||
<fileset>
|
||||
@@ -196,7 +203,7 @@
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-surefire-plugin</artifactId>
|
||||
<version>2.22.1</version>
|
||||
<version>3.5.4</version>
|
||||
<configuration>
|
||||
<useSystemClassLoader>false</useSystemClassLoader>
|
||||
</configuration>
|
||||
@@ -204,7 +211,7 @@
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-gpg-plugin</artifactId>
|
||||
<version>3.0.1</version>
|
||||
<version>3.2.8</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>sign-artifacts</id>
|
||||
@@ -224,7 +231,7 @@
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-release-plugin</artifactId>
|
||||
<version>2.5.3</version>
|
||||
<version>3.3.1</version>
|
||||
<configuration>
|
||||
<autoVersionSubmodules>true</autoVersionSubmodules>
|
||||
<useReleaseProfile>false</useReleaseProfile>
|
||||
@@ -238,7 +245,7 @@
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-compiler-plugin</artifactId>
|
||||
<version>3.8.1</version>
|
||||
<version>3.15.0</version>
|
||||
<configuration>
|
||||
<source>${project.jdk.version}</source>
|
||||
<target>${project.jdk.version}</target>
|
||||
@@ -249,12 +256,12 @@
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-jar-plugin</artifactId>
|
||||
<version>3.2.0</version>
|
||||
<version>3.5.0</version>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-source-plugin</artifactId>
|
||||
<version>3.2.0</version>
|
||||
<version>3.4.0</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<phase>package</phase>
|
||||
|
||||
@@ -0,0 +1,13 @@
|
||||
{
|
||||
"$schema": "https://docs.renovatebot.com/renovate-schema.json",
|
||||
"extends": [
|
||||
"config:recommended"
|
||||
],
|
||||
"packageRules": [
|
||||
{
|
||||
"matchUpdateTypes": ["minor", "patch"],
|
||||
"matchCurrentVersion": "!/^0/",
|
||||
"automerge": true
|
||||
}
|
||||
]
|
||||
}
|
||||
Reference in New Issue
Block a user