feat: 添加 api 功能

添加 api 功能
This commit is contained in:
2022-10-05 09:12:04 +08:00
parent c6d6a2d31c
commit 7f7394aecb
5 changed files with 64 additions and 8 deletions

View File

@@ -12,8 +12,8 @@ dependencies {
api 'net.kyori:adventure-api:4.11.0'
// https://mvnrepository.com/artifact/net.kyori/adventure-text-minimessage
api 'net.kyori:adventure-text-minimessage:4.11.0'
// // https://mvnrepository.com/artifact/net.kyori/adventure-platform-api
// implementation 'net.kyori:adventure-platform-api:4.1.2'
// https://mvnrepository.com/artifact/net.kyori/adventure-platform-api
implementation 'net.kyori:adventure-platform-api:4.1.2'
// https://mvnrepository.com/artifact/net.kyori/adventure-text-serializer-gson
api 'net.kyori:adventure-text-serializer-gson:4.11.0'

View File

@@ -1,5 +1,12 @@
package cn.hamster3.plugin.core.common.api;
import net.kyori.adventure.platform.AudienceProvider;
import org.jetbrains.annotations.NotNull;
import javax.sql.DataSource;
import java.sql.Connection;
import java.sql.SQLException;
@SuppressWarnings("unused")
public abstract class CommonAPI {
protected static CommonAPI instance;
@@ -8,10 +15,16 @@ public abstract class CommonAPI {
return instance;
}
public void reportError(String apiKey, String projectID, Throwable exception) {
@NotNull
public abstract AudienceProvider getAudienceProvider();
}
@NotNull
public abstract DataSource getDataSource();
public void reportFile(String apiKey, String projectID, String filename) {
}
@NotNull
public abstract Connection getConnection() throws SQLException;
public abstract void reportError(@NotNull String apiKey, @NotNull String projectID, @NotNull Throwable exception);
public abstract void reportFile(@NotNull String apiKey, @NotNull String projectID, @NotNull String filename, byte @NotNull [] bytes);
}