1
mirror of https://github.com/CarmJos/MineSQL.git synced 2026-06-04 16:43:03 +08:00

feat(lib): 独立数据库依赖加载,缩减文件体积。

This commit is contained in:
2023-03-16 01:12:25 +08:00
parent 6331cf2047
commit e6fad85438
16 changed files with 192 additions and 107 deletions
+12 -3
View File
@@ -5,7 +5,7 @@
<parent>
<artifactId>minesql-parent</artifactId>
<groupId>cc.carm.plugin</groupId>
<version>1.3.1</version>
<version>1.4.0</version>
<relativePath>../../pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
@@ -82,16 +82,25 @@
<scope>compile</scope>
</dependency>
<dependency>
<groupId>net.byteflux</groupId>
<artifactId>libby-velocity</artifactId>
<version>${deps.libby.version}</version>
<scope>compile</scope>
</dependency>
<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>
@@ -16,11 +16,13 @@ import com.velocitypowered.api.plugin.PluginContainer;
import com.velocitypowered.api.plugin.PluginDescription;
import com.velocitypowered.api.plugin.annotation.DataDirectory;
import com.velocitypowered.api.proxy.ProxyServer;
import net.byteflux.libby.LibraryManager;
import net.byteflux.libby.VelocityLibraryManager;
import net.kyori.adventure.text.Component;
import org.bstats.charts.SimplePie;
import org.bstats.velocity.Metrics;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import org.slf4j.LoggerFactory;
import java.io.File;
import java.nio.file.Path;
@@ -29,7 +31,7 @@ import java.util.Optional;
import java.util.logging.Logger;
@Plugin(id = "minesql", name = "MineSQL (EasySQL-Plugin)", version = "1.3.1",
@Plugin(id = "minesql", name = "MineSQL (EasySQL-Plugin)", version = "1.3.2",
description = "EasySQL Plugin For Velocity",
url = "https://github.com/CarmJos/MineSQL",
authors = {"CarmJos", "GhostChu"}
@@ -41,6 +43,7 @@ public class MineSQLVelocity implements MineSQLPlatform {
private final File dataFolder;
private final Metrics.Factory metricsFactory;
protected VelocityLibraryManager<MineSQLVelocity> libraryManager;
protected MineSQLCore core;
protected VelocityCommandManager commandManager;
@@ -53,14 +56,19 @@ public class MineSQLVelocity implements MineSQLPlatform {
this.logger = logger;
this.dataFolder = dataDirectory.toFile();
this.metricsFactory = metricsFactory;
getLogger().info("加载基础核心...");
this.core = new MineSQLCore(this);
this.libraryManager = new VelocityLibraryManager<>(
LoggerFactory.getLogger("minesql"), dataDirectory,
server.getPluginManager(), this
);
}
@Subscribe(order = PostOrder.FIRST)
public void onInitialize(ProxyInitializeEvent event) {
outputInfo();
getLogger().info("加载基础核心...");
this.core = new MineSQLCore(this);
getLogger().info("初始化指令管理器...");
this.commandManager = new VelocityCommandManager(server, this);
@@ -116,10 +124,15 @@ public class MineSQLVelocity implements MineSQLPlatform {
@Override
public @Nullable CommandManager<?, ?, ?, ?, ?, ?> getCommandManager() {
public @NotNull CommandManager<?, ?, ?, ?, ?, ?> getCommandManager() {
return commandManager;
}
@Override
public @NotNull LibraryManager getLibraryManager() {
return this.libraryManager;
}
public @NotNull PluginConfiguration getConfiguration() {
return this.core.getConfig();
}