mirror of
https://github.com/CarmJos/UltraDepository.git
synced 2026-06-04 16:48:21 +08:00
Compare commits
3 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| af82d64ab1 | |||
| 5d057d2e8e | |||
| a427db36e9 |
@@ -15,7 +15,7 @@
|
|||||||
<groupId>cc.carm.plugin</groupId>
|
<groupId>cc.carm.plugin</groupId>
|
||||||
<artifactId>ultradepository</artifactId>
|
<artifactId>ultradepository</artifactId>
|
||||||
<packaging>jar</packaging>
|
<packaging>jar</packaging>
|
||||||
<version>1.3.3</version>
|
<version>1.3.4</version>
|
||||||
|
|
||||||
<name>UltraDepository</name>
|
<name>UltraDepository</name>
|
||||||
<description>超级仓库插件,支持设定不同物品的存储仓库。</description>
|
<description>超级仓库插件,支持设定不同物品的存储仓库。</description>
|
||||||
@@ -116,6 +116,13 @@
|
|||||||
<optional>true</optional>
|
<optional>true</optional>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>cc.carm.lib</groupId>
|
||||||
|
<artifactId>githubreleases4j</artifactId>
|
||||||
|
<version>1.3.0</version>
|
||||||
|
<scope>compile</scope>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.spigotmc</groupId>
|
<groupId>org.spigotmc</groupId>
|
||||||
<artifactId>spigot-api</artifactId>
|
<artifactId>spigot-api</artifactId>
|
||||||
@@ -252,10 +259,18 @@
|
|||||||
<pattern>org.bstats</pattern>
|
<pattern>org.bstats</pattern>
|
||||||
<shadedPattern>cc.carm.plugin.ultradepository.lib.bstats</shadedPattern>
|
<shadedPattern>cc.carm.plugin.ultradepository.lib.bstats</shadedPattern>
|
||||||
</relocation>
|
</relocation>
|
||||||
|
<relocation>
|
||||||
|
<pattern>org.json</pattern>
|
||||||
|
<shadedPattern>cc.carm.plugin.ultradepository.lib.json</shadedPattern>
|
||||||
|
</relocation>
|
||||||
<relocation>
|
<relocation>
|
||||||
<pattern>cc.carm.lib.easyplugin</pattern>
|
<pattern>cc.carm.lib.easyplugin</pattern>
|
||||||
<shadedPattern>cc.carm.plugin.ultradepository.lib.easyplugin</shadedPattern>
|
<shadedPattern>cc.carm.plugin.ultradepository.lib.easyplugin</shadedPattern>
|
||||||
</relocation>
|
</relocation>
|
||||||
|
<relocation>
|
||||||
|
<pattern>cc.carm.lib.githubreleases4j</pattern>
|
||||||
|
<shadedPattern>cc.carm.plugin.ultradepository.lib.github</shadedPattern>
|
||||||
|
</relocation>
|
||||||
</relocations>
|
</relocations>
|
||||||
<filters>
|
<filters>
|
||||||
<filter>
|
<filter>
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ import cc.carm.lib.easyplugin.utils.MessageUtils;
|
|||||||
import cc.carm.plugin.ultradepository.command.DepositoryCommand;
|
import cc.carm.plugin.ultradepository.command.DepositoryCommand;
|
||||||
import cc.carm.plugin.ultradepository.configuration.PluginConfig;
|
import cc.carm.plugin.ultradepository.configuration.PluginConfig;
|
||||||
import cc.carm.plugin.ultradepository.hooker.PAPIExpansion;
|
import cc.carm.plugin.ultradepository.hooker.PAPIExpansion;
|
||||||
|
import cc.carm.plugin.ultradepository.hooker.UpdateChecker;
|
||||||
import cc.carm.plugin.ultradepository.listener.CollectListener;
|
import cc.carm.plugin.ultradepository.listener.CollectListener;
|
||||||
import cc.carm.plugin.ultradepository.listener.UserListener;
|
import cc.carm.plugin.ultradepository.listener.UserListener;
|
||||||
import cc.carm.plugin.ultradepository.manager.ConfigManager;
|
import cc.carm.plugin.ultradepository.manager.ConfigManager;
|
||||||
@@ -109,6 +110,13 @@ public class UltraDepository extends EasyPlugin {
|
|||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (PluginConfig.CHECK_UPDATE.get()) {
|
||||||
|
log("开始检查更新...");
|
||||||
|
UpdateChecker.checkUpdate(this);
|
||||||
|
} else {
|
||||||
|
log("已禁用检查更新,跳过。");
|
||||||
|
}
|
||||||
|
|
||||||
getUserManager().loadPlayersData();
|
getUserManager().loadPlayersData();
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
|||||||
@@ -21,6 +21,10 @@ public class PluginConfig {
|
|||||||
"metrics", Boolean.class, true
|
"metrics", Boolean.class, true
|
||||||
);
|
);
|
||||||
|
|
||||||
|
public static final ConfigValue<Boolean> CHECK_UPDATE = new ConfigValue<>(
|
||||||
|
"check-update", Boolean.class, true
|
||||||
|
);
|
||||||
|
|
||||||
public static final ConfigStringCast<StorageMethod> STORAGE_METHOD = new ConfigStringCast<>(
|
public static final ConfigStringCast<StorageMethod> STORAGE_METHOD = new ConfigStringCast<>(
|
||||||
"storage.method", StorageMethod::read, StorageMethod.YAML
|
"storage.method", StorageMethod::read, StorageMethod.YAML
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -0,0 +1,32 @@
|
|||||||
|
package cc.carm.plugin.ultradepository.hooker;
|
||||||
|
|
||||||
|
import cc.carm.lib.githubreleases4j.GithubReleases4J;
|
||||||
|
import cc.carm.plugin.ultradepository.UltraDepository;
|
||||||
|
|
||||||
|
public class UpdateChecker {
|
||||||
|
|
||||||
|
public static void checkUpdate(UltraDepository plugin) {
|
||||||
|
plugin.getScheduler().runAsync(() -> {
|
||||||
|
|
||||||
|
Integer behindVersions = GithubReleases4J.getVersionBehind(
|
||||||
|
"CarmJos", "UltraDepository",
|
||||||
|
plugin.getDescription().getVersion()
|
||||||
|
);
|
||||||
|
|
||||||
|
if (behindVersions == null) {
|
||||||
|
plugin.error("检查更新失败,请您定期查看插件是否更新,避免安全问题。");
|
||||||
|
plugin.error("插件下载地址&e " + GithubReleases4J.getReleasesURL("CarmJos", "UltraDepository"));
|
||||||
|
} else {
|
||||||
|
if (behindVersions > 0) {
|
||||||
|
plugin.log("检查更新完成,当前已落后 " + behindVersions + " 个版本。");
|
||||||
|
plugin.log("最新版本下载地址&e " + GithubReleases4J.getLatestReleaseURL("CarmJos", "UltraDepository"));
|
||||||
|
} else {
|
||||||
|
plugin.log("检查更新完成,当前已是最新版本。");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@@ -11,6 +11,11 @@ debug: false
|
|||||||
# 当然,您也可以选择在这里关闭,或在plugins/bStats下的配置文件中关闭。
|
# 当然,您也可以选择在这里关闭,或在plugins/bStats下的配置文件中关闭。
|
||||||
metrics: true
|
metrics: true
|
||||||
|
|
||||||
|
# 检查更新设定
|
||||||
|
# 该选项用于插件判断是否要检查更新,若您不希望插件检查更新并提示您,可以选择关闭。
|
||||||
|
# 检查更新为异步操作,绝不会影响性能与使用体验。
|
||||||
|
check-update: true
|
||||||
|
|
||||||
# 存储相关配置
|
# 存储相关配置
|
||||||
# 注意:存储配置不会通过重载指令生效,如有修改请重新启动服务器。
|
# 注意:存储配置不会通过重载指令生效,如有修改请重新启动服务器。
|
||||||
storage:
|
storage:
|
||||||
|
|||||||
@@ -0,0 +1,20 @@
|
|||||||
|
import cc.carm.lib.githubreleases4j.GithubRelease;
|
||||||
|
import cc.carm.lib.githubreleases4j.GithubReleases4J;
|
||||||
|
import org.junit.Test;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public class ReleasesTest {
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void onTest() {
|
||||||
|
|
||||||
|
List<GithubRelease> releases = GithubReleases4J.listReleases("CarmJos", "UltraDepository");
|
||||||
|
|
||||||
|
for (GithubRelease release : releases) {
|
||||||
|
System.out.println("#" + release.getID() + " (:" + release.getTagName() + ")" + " " + release.getName());
|
||||||
|
System.out.println("- " + release.getHTMLUrl());
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user