3 Commits
1.4.2 ... 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
9 changed files with 40 additions and 23 deletions

View File

@@ -17,12 +17,11 @@ jobs:
java-version: 21 java-version: 21
distribution: temurin distribution: temurin
cache: gradle cache: gradle
cache-dependency-path: gradle/wrapper/gradle-wrapper.properties
- name: Build Project - name: Build Project
env: env:
ORG_GRADLE_PROJECT_MAVEN_AIRGAME_USERNAME: ${{ secrets.MAVEN_AIRGAME_USERNAME }} ORG_GRADLE_PROJECT_MAVEN_AIRGAME_USERNAME: ${{ secrets.MAVEN_AIRGAME_USERNAME }}
ORG_GRADLE_PROJECT_MAVEN_AIRGAME_PASSWORD: ${{ secrets.MAVEN_AIRGAME_PASSWORD }} 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 - name: Publish to Release
uses: softprops/action-gh-release@v2 uses: softprops/action-gh-release@v2
with: with:

View File

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

View File

@@ -14,14 +14,14 @@ dependencies {
compileOnly("me.clip:placeholderapi:2.11.5") { isTransitive = false } compileOnly("me.clip:placeholderapi:2.11.5") { isTransitive = false }
// https://www.spigotmc.org/resources/nbt-api.7939/ // 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 = "org.jetbrains")
exclude(group = "com.google.code.gson") exclude(group = "com.google.code.gson")
exclude(group = "io.netty") 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(module = "adventure-api")
exclude(group = "org.jetbrains") exclude(group = "org.jetbrains")
exclude(group = "io.netty") exclude(group = "io.netty")
@@ -50,11 +50,7 @@ tasks {
shadowJar { shadowJar {
dependsOn(":core-relocate-lettuce:shadowJar") dependsOn(":core-relocate-lettuce:shadowJar")
val task = project(":core-relocate-lettuce").tasks.shadowJar.get() val task = project(":core-relocate-lettuce").tasks.shadowJar.get()
from(task.outputs.files.map { from(task.outputs.files.map { if (it.isDirectory) it else zipTree(it) })
if (it.isDirectory) it else zipTree(
it
)
})
destinationDirectory = rootProject.layout.buildDirectory destinationDirectory = rootProject.layout.buildDirectory
relocate("de.tr7zw.changeme.nbtapi", "cn.hamster3.mc.plugin.core.lib.de.tr7zw.nbtapi") 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") 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 连接池功能 # 是否启用 redis 连接池功能
enable-redis: false enable-redis: false

View File

@@ -42,11 +42,7 @@ tasks {
shadowJar { shadowJar {
dependsOn(":core-relocate-lettuce:shadowJar") dependsOn(":core-relocate-lettuce:shadowJar")
val task = project(":core-relocate-lettuce").tasks.shadowJar.get() val task = project(":core-relocate-lettuce").tasks.shadowJar.get()
from(task.outputs.files.map { from(task.outputs.files.map { if (it.isDirectory) it else zipTree(it) })
if (it.isDirectory) it else zipTree(
it
)
})
destinationDirectory = rootProject.layout.buildDirectory 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 连接池功能 # 是否启用 redis 连接池功能
enable-redis: false enable-redis: false

View File

@@ -57,8 +57,14 @@ public abstract class CoreAPI {
public CoreAPI(@NotNull ConfigSection config) { public CoreAPI(@NotNull ConfigSection config) {
SimpleLogger logger = getLogger(); SimpleLogger logger = getLogger();
executorService = Executors.newCachedThreadPool(new NamedThreadFactory("HamsterCore - Executor")); executorService = Executors.newFixedThreadPool(
scheduledService = Executors.newScheduledThreadPool(1, new NamedThreadFactory("HamsterCore - Scheduler")); 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("已创建线程池"); logger.info("已创建线程池");
enableRedis = config.getBoolean("enable-redis", true); enableRedis = config.getBoolean("enable-redis", true);

View File

@@ -56,11 +56,7 @@ tasks {
shadowJar { shadowJar {
dependsOn(":core-relocate-lettuce:shadowJar") dependsOn(":core-relocate-lettuce:shadowJar")
val task = project(":core-relocate-lettuce").tasks.shadowJar.get() val task = project(":core-relocate-lettuce").tasks.shadowJar.get()
from(task.outputs.files.map { from(task.outputs.files.map { if (it.isDirectory) it else zipTree(it) })
if (it.isDirectory) it else zipTree(
it
)
})
destinationDirectory = rootProject.layout.buildDirectory 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 连接池功能 # 是否启用 redis 连接池功能
enable-redis: false enable-redis: false