Merge remote-tracking branch 'origin/master'

This commit is contained in:
2023-10-13 04:25:24 +08:00
9 changed files with 49 additions and 110 deletions

View File

@@ -16,9 +16,9 @@ repositories {
dependencies {
// 对于 Bukkit 插件
compileOnly "cn.hamster3.mc.plugin:core-bukkit:1.0.0"
compileOnly "cn.hamster3.mc.plugin:core-bukkit:+"
// 对于 BungeeCord 插件
compileOnly "cn.hamster3.mc.plugin:core-bungeecord:1.0.0"
compileOnly "cn.hamster3.mc.plugin:core-bungeecord:+"
}
```

View File

@@ -9,7 +9,7 @@ version = "1.1.0-SNAPSHOT"
subprojects {
apply {
plugin("java")
plugin("java-library")
plugin("maven-publish")
plugin("com.github.johnrengelman.shadow")
}
@@ -24,51 +24,34 @@ subprojects {
}
dependencies {
// https://mvnrepository.com/artifact/org.jetbrains/annotations
compileOnly("org.jetbrains:annotations:23.0.0")
// https://mvnrepository.com/artifact/org.projectlombok/lombok
compileOnly("org.projectlombok:lombok:1.18.28")
annotationProcessor("org.projectlombok:lombok:1.18.28")
compileOnly("org.jetbrains:annotations:+")
compileOnly("org.projectlombok:lombok:+")
annotationProcessor("org.projectlombok:lombok:+")
}
java {
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
// withJavadocJar()
withSourcesJar()
}
tasks {
withType<JavaCompile>() {
withType<JavaCompile> {
options.encoding = "UTF-8"
}
withType<Jar>() {
withType<Jar> {
from(rootProject.file("LICENSE"))
duplicatesStrategy = DuplicatesStrategy.EXCLUDE
}
jar {
archiveClassifier = "dev"
}
javadoc {
options.jFlags("-Dfile.encoding=utf8")
options.encoding = "UTF-8"
options.quiet()
val o: StandardJavadocDocletOptions = options as StandardJavadocDocletOptions
o.addStringOption("Xdoclint:none", "-quiet")
o.links(
"https://javadoc.io/doc/org.jetbrains/annotations/23.0.0",
"https://javadoc.io/doc/com.google.code.gson/gson/2.8.0",
"http://milkbowl.github.io/VaultAPI",
"https://bukkit.windit.net/javadoc"
)
}
shadowJar {
archiveClassifier = ""
relocate("net.kyori", "cn.hamster3.mc.plugin.core.lib.net.kyori")
relocate("com.zaxxer.hikari", "cn.hamster3.mc.plugin.core.lib.com.zaxxer.hikari")
relocate("de.tr7zw.changeme.nbtapi", "cn.hamster3.mc.plugin.core.lib.de.tr7zw.nbtapi")
relocate("de.tr7zw.annotations", "cn.hamster3.mc.plugin.core.lib.de.tr7zw.nbtapi.annotations")
destinationDirectory = rootProject.buildDir
}
build {
dependsOn(shadowJar)

View File

@@ -1,41 +1,22 @@
evaluationDependsOn(":core-common")
dependencies {
compileOnly("org.spigotmc:spigot-api:1.20.1-R0.1-SNAPSHOT")
compileOnly("net.milkbowl.vault:VaultAPI:1.7") {
isTransitive = false
}
compileOnly("org.black_ixx:playerpoints:2.1.3") {
isTransitive = false
}
api(project(":core-common")) { isTransitive = false }
compileOnly("org.spigotmc:spigot-api:+")
implementation(project(":core-common")) {
isTransitive = false
}
implementation("de.tr7zw:item-nbt-api:2.11.2")
val adventureVersion = property("adventure_version")
// https://mvnrepository.com/artifact/net.kyori/adventure-platform-bungeecord
implementation("net.kyori:adventure-platform-bukkit:${adventureVersion}") {
implementation("de.tr7zw:item-nbt-api:+")
compileOnly("net.milkbowl.vault:VaultAPI:+") { isTransitive = false }
compileOnly("org.black_ixx:playerpoints:+") { isTransitive = false }
api("net.kyori:adventure-platform-bukkit:4+") {
exclude(group = "org.jetbrains")
exclude(group = "com.google.code.gson")
}
val adventureSerializerVersion = property("adventure_serializer_version")
// https://mvnrepository.com/artifact/net.kyori/adventure-text-minimessage
implementation("net.kyori:adventure-text-minimessage:${adventureSerializerVersion}") {
api("net.kyori:adventure-text-minimessage:4+") {
exclude(module = "adventure-api")
exclude(group = "org.jetbrains")
}
// https://mvnrepository.com/artifact/net.kyori/adventure-text-serializer-gson
implementation("net.kyori:adventure-text-serializer-gson:${adventureSerializerVersion}") {
exclude(group = "org.jetbrains")
exclude(group = "com.google.code.gson")
}
// https://mvnrepository.com/artifact/net.kyori/adventure-text-serializer-legacy
implementation("net.kyori:adventure-text-serializer-legacy:${adventureSerializerVersion}") {
exclude(group = "org.jetbrains")
}
val hikariVersion = property("HikariCP_version")
implementation("com.zaxxer:HikariCP:${hikariVersion}") {
implementation("com.zaxxer:HikariCP:4+") {
exclude(group = "org.slf4j")
}
}
@@ -46,7 +27,10 @@ tasks {
expand(project.properties)
}
}
withType<Jar>() {
withType<Jar> {
archiveBaseName = "HamsterCore-Bukkit"
}
shadowJar {
destinationDirectory = rootProject.buildDir
}
}

View File

@@ -99,22 +99,22 @@ public final class CoreBukkitAPI extends CoreAPI {
}
@Override
public Gson getGson() {
public @NotNull Gson getGson() {
return gson;
}
@Override
public Gson getHumanGson() {
public @NotNull Gson getHumanGson() {
return humanGson;
}
@Override
public ExecutorService getExecutorService() {
public @NotNull ExecutorService getExecutorService() {
return executorService;
}
@Override
public ScheduledExecutorService getScheduledExecutorService() {
public @NotNull ScheduledExecutorService getScheduledExecutorService() {
return scheduledExecutorService;
}
}

View File

@@ -1,34 +1,18 @@
evaluationDependsOn(":core-common")
dependencies {
compileOnly("net.md-5:bungeecord-api:1.20-R0.1-SNAPSHOT")
api(project(":core-common")) { isTransitive = false }
compileOnly("net.md-5:bungeecord-api:+")
implementation(project(":core-common")) {
isTransitive = false
}
val adventureVersion = property("adventure_version")
// https://mvnrepository.com/artifact/net.kyori/adventure-platform-bungeecord
implementation("net.kyori:adventure-platform-bungeecord:${adventureVersion}") {
api("net.kyori:adventure-platform-bungeecord:4+") {
exclude(group = "org.jetbrains")
exclude(group = "com.google.code.gson")
}
val adventureSerializerVersion = property("adventure_serializer_version")
// https://mvnrepository.com/artifact/net.kyori/adventure-text-minimessage
implementation("net.kyori:adventure-text-minimessage:${adventureSerializerVersion}") {
api("net.kyori:adventure-text-minimessage:4+") {
exclude(module = "adventure-api")
exclude(group = "org.jetbrains")
}
// https://mvnrepository.com/artifact/net.kyori/adventure-text-serializer-gson
implementation("net.kyori:adventure-text-serializer-gson:${adventureSerializerVersion}") {
exclude(group = "org.jetbrains")
exclude(group = "com.google.code.gson")
}
// https://mvnrepository.com/artifact/net.kyori/adventure-text-serializer-legacy
implementation("net.kyori:adventure-text-serializer-legacy:${adventureSerializerVersion}") {
exclude(group = "org.jetbrains")
}
val hikariVersion = property("HikariCP_version")
implementation("com.zaxxer:HikariCP:${hikariVersion}") {
implementation("com.zaxxer:HikariCP:4+") {
exclude(group = "org.slf4j")
}
}
@@ -39,7 +23,10 @@ tasks {
expand(project.properties)
}
}
withType<Jar>() {
withType<Jar> {
archiveBaseName = "HamsterCore-BungeeCord"
}
shadowJar {
destinationDirectory = rootProject.buildDir
}
}

View File

@@ -91,22 +91,22 @@ public final class CoreBungeeAPI extends CoreAPI {
}
@Override
public Gson getGson() {
public @NotNull Gson getGson() {
return gson;
}
@Override
public Gson getHumanGson() {
public @NotNull Gson getHumanGson() {
return humanGson;
}
@Override
public ExecutorService getExecutorService() {
public @NotNull ExecutorService getExecutorService() {
return executorService;
}
@Override
public ScheduledExecutorService getScheduledExecutorService() {
public @NotNull ScheduledExecutorService getScheduledExecutorService() {
return scheduledExecutorService;
}
}

View File

@@ -1,32 +1,19 @@
@file:Suppress("VulnerableLibrariesLocal")
dependencies {
// https://mvnrepository.com/artifact/com.google.code.gson/gson
compileOnly("com.google.code.gson:gson:2.8.0")
val adventureVersion = property("adventure_version")
// https://mvnrepository.com/artifact/net.kyori/adventure-platform-api
implementation("net.kyori:adventure-platform-api:${adventureVersion}") {
api("net.kyori:adventure-platform-api:4+") {
exclude(group = "org.jetbrains")
}
val adventureSerializerVersion = property("adventure_serializer_version")
// https://mvnrepository.com/artifact/net.kyori/adventure-text-minimessage
implementation("net.kyori:adventure-text-minimessage:${adventureSerializerVersion}") {
exclude(group = "org.jetbrains")
}
// https://mvnrepository.com/artifact/net.kyori/adventure-text-serializer-gson
implementation("net.kyori:adventure-text-serializer-gson:${adventureSerializerVersion}") {
api("net.kyori:adventure-text-serializer-gson:4.13+") {
exclude(group = "org.jetbrains")
exclude(group = "com.google.code.gson")
}
// https://mvnrepository.com/artifact/net.kyori/adventure-text-serializer-legacy
implementation("net.kyori:adventure-text-serializer-legacy:${adventureSerializerVersion}") {
exclude(group = "org.jetbrains")
}
}
tasks {
withType<Jar>() {
withType<Jar> {
archiveBaseName = "HamsterCore-Common"
}
}

View File

@@ -1,6 +1,7 @@
package cn.hamster3.mc.plugin.core.common.api;
import com.google.gson.Gson;
import lombok.Getter;
import net.kyori.adventure.platform.AudienceProvider;
import org.jetbrains.annotations.NotNull;
@@ -12,12 +13,9 @@ import java.util.concurrent.ScheduledExecutorService;
@SuppressWarnings("unused")
public abstract class CoreAPI {
@Getter
protected static CoreAPI instance;
public static CoreAPI getInstance() {
return instance;
}
@NotNull
public abstract AudienceProvider getAudienceProvider();
@@ -32,20 +30,24 @@ public abstract class CoreAPI {
/**
* @return GSON 工具
*/
@NotNull
public abstract Gson getGson();
/**
* @return GSON 工具会使用格式化输出、且解析中包含null参数
*/
@NotNull
public abstract Gson getHumanGson();
/**
* @return 异步线程池
*/
@NotNull
public abstract ExecutorService getExecutorService();
/**
* @return 调度器线程池
*/
@NotNull
public abstract ScheduledExecutorService getScheduledExecutorService();
}

View File

@@ -1,4 +0,0 @@
org.gradle.jvmargs=-Xmx2G
adventure_version=4.3.0
adventure_serializer_version=4.14.0
HikariCP_version=4.0.3