mirror of
https://github.com/CarmJos/MineSQL.git
synced 2026-06-04 16:43:03 +08:00
refactor(lib): Removed libby and simple shaded all libraries.
This commit is contained in:
+19
-8
@@ -68,17 +68,10 @@
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>net.byteflux</groupId>
|
||||
<artifactId>libby-core</artifactId>
|
||||
<version>${deps.libby.version}</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.github.chris2018998</groupId>
|
||||
<artifactId>beecp</artifactId>
|
||||
<scope>provided</scope>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
@@ -87,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>
|
||||
|
||||
@@ -14,12 +14,10 @@ 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.lib.PluginLibraries;
|
||||
import cc.carm.plugin.minesql.util.DBPropertiesUtil;
|
||||
import co.aikar.commands.CommandManager;
|
||||
import co.aikar.commands.InvalidCommandArgument;
|
||||
import co.aikar.commands.Locales;
|
||||
import net.byteflux.libby.Library;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import org.stone.beecp.BeeDataSource;
|
||||
@@ -50,17 +48,6 @@ public class MineSQLCore implements IMineSQL {
|
||||
instance = this;
|
||||
this.platform = platform;
|
||||
|
||||
getLogger().info("加载数据库依赖文件...");
|
||||
getPlatform().getLibraryManager().addMavenLocal();
|
||||
getPlatform().getLibraryManager().addMavenCentral();
|
||||
getPlatform().getLibraryManager().addSonatype();
|
||||
|
||||
for (PluginLibraries value : PluginLibraries.values()) {
|
||||
Library lib = value.getLibrary();
|
||||
getLogger().info(" 加载 " + lib.getArtifactId() + " (" + lib.getVersion() + ") ...");
|
||||
getPlatform().getLibraryManager().loadLibrary(value.getLibrary());
|
||||
}
|
||||
|
||||
getLogger().info("加载配置文件...");
|
||||
this.configProvider = EasyConfiguration.from(new File(platform.getPluginFolder(), "config.yml"));
|
||||
this.config = new PluginConfiguration();
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
package cc.carm.plugin.minesql;
|
||||
|
||||
import co.aikar.commands.CommandManager;
|
||||
import net.byteflux.libby.LibraryManager;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
@@ -16,6 +15,4 @@ public interface MineSQLPlatform {
|
||||
|
||||
@Nullable CommandManager<?, ?, ?, ?, ?, ?> getCommandManager();
|
||||
|
||||
@NotNull LibraryManager getLibraryManager();
|
||||
|
||||
}
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
package cc.carm.plugin.minesql.lib;
|
||||
|
||||
import cc.carm.plugin.minesql.util.VersionReader;
|
||||
import net.byteflux.libby.Library;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
public enum PluginLibraries {
|
||||
@@ -21,16 +20,8 @@ public enum PluginLibraries {
|
||||
this.artifactID = artifactID;
|
||||
}
|
||||
|
||||
public @NotNull Library getLibrary() {
|
||||
return Library.builder().id(name())
|
||||
.groupId(this.groupID).artifactId(this.artifactID)
|
||||
.version(getVersion())
|
||||
.build();
|
||||
}
|
||||
|
||||
public @NotNull String getVersion() {
|
||||
return READER.get(name().toLowerCase().replace('_', '-'));
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -85,11 +85,6 @@ public class MineSQLBukkit extends EasyPlugin implements MineSQLPlatform {
|
||||
return commandManager;
|
||||
}
|
||||
|
||||
@Override
|
||||
public @NotNull LibraryManager getLibraryManager() {
|
||||
return this.libraryManager;
|
||||
}
|
||||
|
||||
@Override
|
||||
public @NotNull File getPluginFolder() {
|
||||
return getDataFolder();
|
||||
|
||||
@@ -72,13 +72,6 @@
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>net.byteflux</groupId>
|
||||
<artifactId>libby-bungee</artifactId>
|
||||
<version>${deps.libby.version}</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.bstats</groupId>
|
||||
<artifactId>bstats-bungeecord</artifactId>
|
||||
|
||||
@@ -5,8 +5,6 @@ import cc.carm.lib.easyplugin.utils.JarResourceUtils;
|
||||
import cc.carm.plugin.minesql.conf.PluginConfiguration;
|
||||
import co.aikar.commands.BungeeCommandManager;
|
||||
import co.aikar.commands.CommandManager;
|
||||
import net.byteflux.libby.BungeeLibraryManager;
|
||||
import net.byteflux.libby.LibraryManager;
|
||||
import net.md_5.bungee.api.ProxyServer;
|
||||
import net.md_5.bungee.api.plugin.Plugin;
|
||||
import org.bstats.bungeecord.Metrics;
|
||||
@@ -22,8 +20,6 @@ public class MineSQLBungee extends Plugin implements MineSQLPlatform {
|
||||
|
||||
protected static MineSQLBungee instance;
|
||||
|
||||
protected BungeeLibraryManager libraryManager;
|
||||
|
||||
protected MineSQLCore core;
|
||||
protected BungeeCommandManager commandManager;
|
||||
|
||||
@@ -31,9 +27,6 @@ public class MineSQLBungee extends Plugin implements MineSQLPlatform {
|
||||
public void onLoad() {
|
||||
MineSQLBungee.instance = this;
|
||||
|
||||
getLogger().info("加载依赖管理器...");
|
||||
this.libraryManager = new BungeeLibraryManager(this);
|
||||
|
||||
getLogger().info("加载基础核心...");
|
||||
this.core = new MineSQLCore(this);
|
||||
}
|
||||
@@ -99,11 +92,6 @@ public class MineSQLBungee extends Plugin implements MineSQLPlatform {
|
||||
return this.commandManager;
|
||||
}
|
||||
|
||||
@Override
|
||||
public @NotNull LibraryManager getLibraryManager() {
|
||||
return this.libraryManager;
|
||||
}
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
public void outputInfo() {
|
||||
Optional.ofNullable(JarResourceUtils.readResource(this.getResourceAsStream("PLUGIN_INFO")))
|
||||
|
||||
@@ -84,13 +84,6 @@
|
||||
</exclusions>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>net.byteflux</groupId>
|
||||
<artifactId>libby-sponge</artifactId>
|
||||
<version>${deps.libby.version}</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.bstats</groupId>
|
||||
<artifactId>bstats-sponge</artifactId>
|
||||
|
||||
@@ -5,8 +5,6 @@ import cc.carm.lib.easyplugin.utils.JarResourceUtils;
|
||||
import cc.carm.plugin.minesql.conf.PluginConfiguration;
|
||||
import co.aikar.commands.CommandManager;
|
||||
import com.google.inject.Inject;
|
||||
import net.byteflux.libby.LibraryManager;
|
||||
import net.byteflux.libby.SpongeLibraryManager;
|
||||
import net.kyori.adventure.text.Component;
|
||||
import org.bstats.charts.SimplePie;
|
||||
import org.bstats.sponge.Metrics;
|
||||
@@ -43,17 +41,13 @@ public class MineSQLSponge implements MineSQLPlatform {
|
||||
private final PluginContainer pluginContainer;
|
||||
private final Metrics.Factory metricsFactory;
|
||||
|
||||
protected final SpongeLibraryManager<MineSQLSponge> libraryManager;
|
||||
protected final MineSQLCore core;
|
||||
// protected SpongeCommandManager commandManager;
|
||||
|
||||
@Inject
|
||||
public MineSQLSponge(Metrics.Factory factory,
|
||||
PluginContainer pluginContainer,
|
||||
SpongeLibraryManager<MineSQLSponge> libraryManager) {
|
||||
public MineSQLSponge(Metrics.Factory factory, PluginContainer pluginContainer) {
|
||||
this.pluginContainer = pluginContainer;
|
||||
this.metricsFactory = factory;
|
||||
this.libraryManager = libraryManager;
|
||||
|
||||
getLogger().info("加载基础核心...");
|
||||
this.core = new MineSQLCore(this);
|
||||
@@ -115,11 +109,6 @@ public class MineSQLSponge implements MineSQLPlatform {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public @NotNull LibraryManager getLibraryManager() {
|
||||
return this.libraryManager;
|
||||
}
|
||||
|
||||
public String getVersion() {
|
||||
return pluginContainer.metadata().version().toString();
|
||||
}
|
||||
|
||||
@@ -82,13 +82,6 @@
|
||||
<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>
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
package cc.carm.plugin.minesql;
|
||||
|
||||
|
||||
import cc.carm.lib.easyplugin.utils.ColorParser;
|
||||
import cc.carm.lib.easyplugin.utils.JarResourceUtils;
|
||||
import cc.carm.plugin.minesql.conf.PluginConfiguration;
|
||||
@@ -16,13 +15,10 @@ 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.slf4j.LoggerFactory;
|
||||
|
||||
import java.io.File;
|
||||
import java.nio.file.Path;
|
||||
@@ -43,7 +39,6 @@ public class MineSQLVelocity implements MineSQLPlatform {
|
||||
private final File dataFolder;
|
||||
|
||||
private final Metrics.Factory metricsFactory;
|
||||
protected VelocityLibraryManager<MineSQLVelocity> libraryManager;
|
||||
|
||||
protected MineSQLCore core;
|
||||
protected VelocityCommandManager commandManager;
|
||||
@@ -56,18 +51,16 @@ public class MineSQLVelocity implements MineSQLPlatform {
|
||||
this.logger = logger;
|
||||
this.dataFolder = dataDirectory.toFile();
|
||||
this.metricsFactory = metricsFactory;
|
||||
this.libraryManager = new VelocityLibraryManager<>(
|
||||
LoggerFactory.getLogger("minesql"), dataDirectory,
|
||||
server.getPluginManager(), this
|
||||
);
|
||||
|
||||
outputInfo();
|
||||
getLogger().info("加载基础核心...");
|
||||
this.core = new MineSQLCore(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);
|
||||
|
||||
@@ -126,11 +119,6 @@ public class MineSQLVelocity implements MineSQLPlatform {
|
||||
return commandManager;
|
||||
}
|
||||
|
||||
@Override
|
||||
public @NotNull LibraryManager getLibraryManager() {
|
||||
return this.libraryManager;
|
||||
}
|
||||
|
||||
public @NotNull PluginConfiguration getConfiguration() {
|
||||
return this.core.getConfig();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user