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

新增通用接口与指令

This commit is contained in:
2022-02-22 02:59:18 +08:00
parent 67bd7a4141
commit 108442ad43
14 changed files with 246 additions and 66 deletions
+21 -2
View File
@@ -24,7 +24,6 @@
<name>EasySQL-Plugin-Bukkit</name>
<dependencies>
<dependency>
@@ -37,6 +36,8 @@
<dependency>
<groupId>cc.carm.lib</groupId>
<artifactId>easyplugin-main</artifactId>
<version>${easyplugin.version}</version>
<optional>true</optional>
<scope>compile</scope>
</dependency>
@@ -50,9 +51,19 @@
<dependency>
<groupId>org.bstats</groupId>
<artifactId>bstats-bukkit</artifactId>
<version>2.2.1</version>
<version>3.0.0</version>
<optional>true</optional>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>co.aikar</groupId>
<artifactId>acf-paper</artifactId>
<version>0.5.1-SNAPSHOT</version>
<optional>true</optional>
<scope>compile</scope>
</dependency>
</dependencies>
<build>
@@ -87,6 +98,14 @@
<pattern>cc.carm.lib.easyplugin</pattern>
<shadedPattern>cc.carm.plugin.easysql.lib.easyplugin</shadedPattern>
</relocation>
<relocation>
<pattern>co.aikar.commands</pattern>
<shadedPattern>cc.carm.plugin.easysql.lib.acf</shadedPattern> <!-- Replace this -->
</relocation>
<relocation>
<pattern>co.aikar.locales</pattern>
<shadedPattern>cc.carm.plugin.easysql.lib.locales</shadedPattern> <!-- Replace this -->
</relocation>
</relocations>
<filters>
<filter>
@@ -1,54 +0,0 @@
package cc.carm.plugin.easysql;
import cc.carm.lib.easyplugin.EasyPlugin;
import cc.carm.lib.easyplugin.i18n.EasyPluginMessageProvider;
import cc.carm.plugin.easysql.api.DBConfiguration;
import cc.carm.plugin.easysql.util.PropertiesUtil;
import org.jetbrains.annotations.NotNull;
import java.io.File;
import java.util.HashMap;
import java.util.Map;
import java.util.Properties;
public class EasySQLBukkit extends EasyPlugin implements EasySQLPluginPlatform {
public EasySQLBukkit() {
super(new EasyPluginMessageProvider.zh_CN());
}
@Override
protected void load() {
}
@Override
protected boolean initialize() {
return false;
}
@Override
public @NotNull Map<String, DBConfiguration> readConfigurations() {
return new HashMap<>();
}
@Override
public @NotNull Map<String, Properties> readProperties() {
return PropertiesUtil.readDBProperties(new File(getDataFolder(), "properties"));
}
@Override
public void outputInfo() {
log("\n" +
"&5&l ______ _____ ____ _ &d&l_____ _ _ \n" +
"&5&l| ____| / ____|/ __ \\| | &d&l| __ \\| | (_) \n" +
"&5&l| |__ __ _ ___ _ _| (___ | | | | | &d&l| |__) | |_ _ __ _ _ _ __ \n" +
"&5&l| __| / _` / __| | | |\\___ \\| | | | | &d&l| ___/| | | | |/ _` | | '_ \\ \n" +
"&5&l| |___| (_| \\__ \\ |_| |____) | |__| | |____ &d&l| | | | |_| | (_| | | | | |\n" +
"&5&l|______\\__,_|___/\\__, |_____/ \\___\\_\\______| &d&l|_| |_|\\__,_|\\__, |_|_| |_|\n" +
"&5&l __/ | &d&l __/ | \n" +
"&5&l |___/ &d&l|___/ "
);
}
}
@@ -0,0 +1,78 @@
package cc.carm.plugin.easysql.bukkit;
import cc.carm.lib.easyplugin.EasyPlugin;
import cc.carm.lib.easyplugin.i18n.EasyPluginMessageProvider;
import cc.carm.plugin.easysql.EasySQLPluginPlatform;
import cc.carm.plugin.easysql.EasySQLRegistryImpl;
import cc.carm.plugin.easysql.api.DBConfiguration;
import cc.carm.plugin.easysql.util.PropertiesUtil;
import cc.carm.plugin.easysql.util.ResourceReadUtil;
import co.aikar.commands.PaperCommandManager;
import org.jetbrains.annotations.NotNull;
import java.io.File;
import java.util.HashMap;
import java.util.Map;
import java.util.Optional;
import java.util.Properties;
public class EasySQLBukkit extends EasyPlugin implements EasySQLPluginPlatform {
public EasySQLBukkit() {
super(new EasyPluginMessageProvider.zh_CN());
}
protected static EasySQLBukkit instance;
protected PaperCommandManager commandManager;
protected EasySQLRegistryImpl registry;
@Override
protected void load() {
EasySQLBukkit.instance = this;
this.commandManager = new PaperCommandManager(this);
initializeAPI(getRegistry());
}
@Override
protected boolean initialize() {
//TODO COMMANDS
return true;
}
@Override
@NotNull
public EasySQLRegistryImpl getRegistry() {
return this.registry;
}
@Override
public @NotNull
Map<String, DBConfiguration> readConfigurations() {
return new HashMap<>();
}
@Override
public @NotNull
Map<String, Properties> readProperties() {
return PropertiesUtil.readDBProperties(new File(getDataFolder(), "properties"));
}
@Override
public void outputInfo() {
Optional.ofNullable(ResourceReadUtil.readResource(this.getResource("info.txt"))).ifPresent(this::log);
}
public static EasySQLBukkit getInstance() {
return EasySQLBukkit.instance;
}
protected PaperCommandManager getCommandManager() {
return commandManager;
}
}
@@ -0,0 +1,21 @@
main: cc.carm.plugin.easysql.bukkit.EasySQLBukkit
version: ${project.version}
name: EasySQL-Plugin-Bukkit
load: STARTUP
website: ${project.url}
description: ${project.description}
authors:
- CarmJos
- GhostChu
api-version: 1.13
prefix: EasySQL
commands:
"EasySQLBukkit":
usage: "/EasySQLBukkit help"
description: "EasySQL独立插件的主指令,只允许后台运行。"
aliases:
- "EasySQL"