From d9a14af021d8977058fc239f67af6490dbd1aa50 Mon Sep 17 00:00:00 2001 From: zhangyuheng Date: Wed, 8 May 2024 11:38:41 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=E8=87=AA=E5=8A=A8=E6=A3=80?= =?UTF-8?q?=E6=9F=A5=E6=9B=B4=E6=96=B0=E6=97=B6=E9=97=B4=E6=8E=A7=E5=88=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitea/workflows/build.yml | 2 +- pom.xml | 2 +- .../lunadeer/dominion/utils/GiteaReleaseCheck.java | 12 +++++++----- 3 files changed, 9 insertions(+), 7 deletions(-) diff --git a/.gitea/workflows/build.yml b/.gitea/workflows/build.yml index d37a020..16fa5bf 100644 --- a/.gitea/workflows/build.yml +++ b/.gitea/workflows/build.yml @@ -37,7 +37,7 @@ jobs: - name: "Release" uses: https://ssl.lunadeer.cn:14446/zhangyuheng/release-action@main with: - note: "带 `original-` 前缀的文件无法用于运行,请下载不带此前缀的版本。" + note: " - 带 `original-` 前缀的文件无法用于运行,请下载不带此前缀的版本。" files: |- staging/*.jar api_key: '${{secrets.RELEASE_TOKEN}}' \ No newline at end of file diff --git a/pom.xml b/pom.xml index 844c8a6..caf8ec8 100644 --- a/pom.xml +++ b/pom.xml @@ -6,7 +6,7 @@ cn.lunadeer Dominion - 1.22.1-beta + 1.22.2-beta jar Dominion diff --git a/src/main/java/cn/lunadeer/dominion/utils/GiteaReleaseCheck.java b/src/main/java/cn/lunadeer/dominion/utils/GiteaReleaseCheck.java index da910b8..ba68eba 100644 --- a/src/main/java/cn/lunadeer/dominion/utils/GiteaReleaseCheck.java +++ b/src/main/java/cn/lunadeer/dominion/utils/GiteaReleaseCheck.java @@ -12,6 +12,7 @@ import java.io.File; import java.io.InputStreamReader; import java.net.URL; import java.nio.file.Files; +import java.util.Random; import java.util.concurrent.TimeUnit; public class GiteaReleaseCheck { @@ -30,11 +31,12 @@ public class GiteaReleaseCheck { this.current_version = plugin.getPluginMeta().getVersion(); // 异步每12小时检查一次更新 plugin.getServer().getAsyncScheduler().runAtFixedRate(plugin, (instance) -> { - getLatestRelease(); - if (auto_update) { - downloadUpdate(); - } - }, 10, 60 * 60 * 12, TimeUnit.SECONDS); + getLatestRelease(); + if (auto_update) { + downloadUpdate(); + } + }, 10 + new Random().nextInt(10), 60 * 60 * 12 + new Random().nextInt(60), + TimeUnit.SECONDS); } public void enableAutoUpdate() {