1
mirror of https://github.com/CarmJos/MineSQL.git synced 2026-06-05 00:48:16 +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
@@ -1,6 +1,7 @@
package cc.carm.plugin.easysql;
import cc.carm.plugin.easysql.api.DBConfiguration;
import cc.carm.plugin.easysql.api.EasySQLRegistry;
import org.jetbrains.annotations.NotNull;
import java.util.Map;
@@ -9,7 +10,7 @@ import java.util.logging.Logger;
public interface EasySQLPluginPlatform {
@NotNull EasySQLRegistry getRegistry();
@NotNull Map<String, DBConfiguration> readConfigurations();
@@ -17,4 +18,8 @@ public interface EasySQLPluginPlatform {
Logger getLogger();
default void initializeAPI(EasySQLRegistry registry) {
EasySQLAPI.initializeAPI(registry);
}
}
@@ -0,0 +1,11 @@
package cc.carm.plugin.easysql.command;
import co.aikar.commands.BaseCommand;
public class EasySQLCommand extends BaseCommand {
}
@@ -0,0 +1,27 @@
package cc.carm.plugin.easysql.util;
import org.jetbrains.annotations.Nullable;
import java.io.InputStream;
import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;
public class ResourceReadUtil {
public static @Nullable String[] readResource(@Nullable InputStream resourceStream) {
if (resourceStream == null) return null;
try (Scanner scanner = new Scanner(resourceStream, "UTF-8")) {
List<String> contents = new ArrayList<>();
while (scanner.hasNextLine()) {
contents.add(scanner.nextLine());
}
return contents.toArray(new String[0]);
} catch (Exception e) {
return null;
}
}
}