4 Commits
1.4.1 ... 1.4.3

Author SHA1 Message Date
141e2f62e0 feat: 优化线程池配置并更新依赖版本
All checks were successful
Publish Project / build (push) Successful in 3m17s
- 将 item-nbt-api 从 2.15.1 更新至 2.15.3
- 将 adventure-platform-bukkit 从 4.3.2 更新至 4.4.1
- 将 adventure-text-minimessage 从 4.15.0 更新至 4.25.0
- 升级项目版本号从 1.4.2 至 1.4.3
- 在各模块配置文件中新增线程池大小配置项
- 根据配置动态设置普通任务和定时任务线程池大小
- 默认线程池大小分别为 10 和 5,并支持自定义配置
2025-12-13 22:26:47 +08:00
0b8614fec9 ci: 优化构建脚本 2025-08-23 04:12:30 +08:00
b9be8e4b0b ci: 优化构建脚本 2025-08-23 04:11:29 +08:00
594bdf15b6 fix: 修复插件自动更新时下载 URL 显示错误的问题
All checks were successful
Publish Project / build (push) Successful in 2m45s
2025-07-30 20:41:56 +08:00
11 changed files with 46 additions and 29 deletions

View File

@@ -17,12 +17,11 @@ jobs:
java-version: 21
distribution: temurin
cache: gradle
cache-dependency-path: gradle/wrapper/gradle-wrapper.properties
- name: Build Project
env:
ORG_GRADLE_PROJECT_MAVEN_AIRGAME_USERNAME: ${{ secrets.MAVEN_AIRGAME_USERNAME }}
ORG_GRADLE_PROJECT_MAVEN_AIRGAME_PASSWORD: ${{ secrets.MAVEN_AIRGAME_PASSWORD }}
run: chmod +x gradlew && ./gradlew build publish --no-daemon
run: chmod +x gradlew && ./gradlew build publish --console plain --no-daemon
- name: Publish to Release
uses: softprops/action-gh-release@v2
with:

View File

@@ -24,9 +24,9 @@ repositories {
dependencies {
// 对于 Bukkit 插件
compileOnly("cn.hamster3.mc.plugin:core-bukkit:1.4.1")
compileOnly("cn.hamster3.mc.plugin:core-bukkit:1.4.2")
// 对于 BungeeCord 插件
compileOnly("cn.hamster3.mc.plugin:core-bungee:1.4.1")
compileOnly("cn.hamster3.mc.plugin:core-bungee:1.4.2")
}
```
@@ -52,13 +52,13 @@ dependencies {
<dependency>
<groupId>cn.hamster3.mc.plugin</groupId>
<artifactId>core-bukkit</artifactId>
<version>1.4.1</version>
<version>1.4.2</version>
</dependency>
<!--对于 BungeeCord 插件-->
<dependency>
<groupId>cn.hamster3.mc.plugin</groupId>
<artifactId>core-bungee</artifactId>
<version>1.4.1</version>
<version>1.4.2</version>
</dependency>
</dependencies>
</project>

View File

@@ -5,7 +5,7 @@ plugins {
}
group = "cn.hamster3.mc.plugin"
version = "1.4.1"
version = "1.4.3"
description = "叁只仓鼠的 Minecraft 插件开发通用工具包"
subprojects {

View File

@@ -14,14 +14,14 @@ dependencies {
compileOnly("me.clip:placeholderapi:2.11.5") { isTransitive = false }
// https://www.spigotmc.org/resources/nbt-api.7939/
implementation("de.tr7zw:item-nbt-api:2.15.1")
implementation("de.tr7zw:item-nbt-api:2.15.3")
api("net.kyori:adventure-platform-bukkit:4.3.2") {
api("net.kyori:adventure-platform-bukkit:4.4.1") {
exclude(group = "org.jetbrains")
exclude(group = "com.google.code.gson")
exclude(group = "io.netty")
}
api("net.kyori:adventure-text-minimessage:4.15.0") {
api("net.kyori:adventure-text-minimessage:4.25.0") {
exclude(module = "adventure-api")
exclude(group = "org.jetbrains")
exclude(group = "io.netty")
@@ -50,11 +50,7 @@ tasks {
shadowJar {
dependsOn(":core-relocate-lettuce:shadowJar")
val task = project(":core-relocate-lettuce").tasks.shadowJar.get()
from(task.outputs.files.map {
if (it.isDirectory) it else zipTree(
it
)
})
from(task.outputs.files.map { if (it.isDirectory) it else zipTree(it) })
destinationDirectory = rootProject.layout.buildDirectory
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")

View File

@@ -1,3 +1,11 @@
# 普通任务执行线程池大小
# 建议设置为玩家数 / 5但不小于 10
executor-thread-pool-size: 10
# 定时任务执行线程池大小
# 建议设置为玩家数 / 10但不小于 5
scheduler-thread-pool-size: 5
# 是否启用 redis 连接池功能
enable-redis: false

View File

@@ -42,11 +42,7 @@ tasks {
shadowJar {
dependsOn(":core-relocate-lettuce:shadowJar")
val task = project(":core-relocate-lettuce").tasks.shadowJar.get()
from(task.outputs.files.map {
if (it.isDirectory) it else zipTree(
it
)
})
from(task.outputs.files.map { if (it.isDirectory) it else zipTree(it) })
destinationDirectory = rootProject.layout.buildDirectory
}
}

View File

@@ -1,3 +1,11 @@
# 普通任务执行线程池大小
# 建议设置为玩家数 / 5但不小于 10
executor-thread-pool-size: 10
# 定时任务执行线程池大小
# 建议设置为玩家数 / 10但不小于 5
scheduler-thread-pool-size: 5
# 是否启用 redis 连接池功能
enable-redis: false

View File

@@ -57,8 +57,14 @@ public abstract class CoreAPI {
public CoreAPI(@NotNull ConfigSection config) {
SimpleLogger logger = getLogger();
executorService = Executors.newCachedThreadPool(new NamedThreadFactory("HamsterCore - Executor"));
scheduledService = Executors.newScheduledThreadPool(1, new NamedThreadFactory("HamsterCore - Scheduler"));
executorService = Executors.newFixedThreadPool(
config.getInt("executor-thread-pool-size", 10),
new NamedThreadFactory("HamsterCore - Executor")
);
scheduledService = Executors.newScheduledThreadPool(
config.getInt("scheduler-thread-pool-size", 5),
new NamedThreadFactory("HamsterCore - Scheduler")
);
logger.info("已创建线程池");
enableRedis = config.getBoolean("enable-redis", true);

View File

@@ -47,7 +47,7 @@ public final class UpdateCheckUtils {
case "GITEA_RELEASES": {
lastRelease = getGiteaLastRelease(baseUrl, gitRepo, gitToken);
if (downloadUrl == null) {
downloadUrl = URI.create(baseUrl).resolve(gitRepo).toString();
downloadUrl = URI.create(baseUrl).resolve("/" + gitRepo).toString();
}
break;
}
@@ -58,7 +58,7 @@ public final class UpdateCheckUtils {
}
lastRelease = getGitlabLastRelease(baseUrl, projectID, gitToken);
if (downloadUrl == null) {
downloadUrl = URI.create(baseUrl).resolve(gitRepo).toString();
downloadUrl = URI.create(baseUrl).resolve("/" + gitRepo).toString();
}
break;
}

View File

@@ -56,11 +56,7 @@ tasks {
shadowJar {
dependsOn(":core-relocate-lettuce:shadowJar")
val task = project(":core-relocate-lettuce").tasks.shadowJar.get()
from(task.outputs.files.map {
if (it.isDirectory) it else zipTree(
it
)
})
from(task.outputs.files.map { if (it.isDirectory) it else zipTree(it) })
destinationDirectory = rootProject.layout.buildDirectory
}
}

View File

@@ -1,3 +1,11 @@
# 普通任务执行线程池大小
# 建议设置为玩家数 / 5但不小于 10
executor-thread-pool-size: 10
# 定时任务执行线程池大小
# 建议设置为玩家数 / 10但不小于 5
scheduler-thread-pool-size: 5
# 是否启用 redis 连接池功能
enable-redis: false