diff --git a/pom.xml b/pom.xml index b3c790a..214cf11 100644 --- a/pom.xml +++ b/pom.xml @@ -3,7 +3,7 @@ 4.0.0 cn.citycraft Yum - 1.8.8 + 1.8.9 Yum Minecraft 服务器插件管理系统 @@ -55,7 +55,8 @@ http://ci.citycraft.cn:8080 - &c临时兼容旧版本的全体更新... + &a通过检测NMS版本实现多端兼容处理... + Debug UTF-8 diff --git a/src/main/java/cn/citycraft/Yum/manager/PluginInfo.java b/src/main/java/cn/citycraft/Yum/manager/PluginInfo.java index 3624bff..133946e 100644 --- a/src/main/java/cn/citycraft/Yum/manager/PluginInfo.java +++ b/src/main/java/cn/citycraft/Yum/manager/PluginInfo.java @@ -1,10 +1,9 @@ package cn.citycraft.Yum.manager; -import java.util.List; - import org.bukkit.Bukkit; import org.bukkit.command.CommandSender; +import cn.citycraft.PluginHelper.PluginHelperLogger; import cn.citycraft.PluginHelper.utils.IOUtil; import cn.citycraft.Yum.manager.RepoSerialization.Plugin; import cn.citycraft.Yum.manager.RepoSerialization.TagInfo; @@ -19,7 +18,6 @@ public class PluginInfo { public String pom; public URLType type; public String repo; - public List tags; public String url; /** @@ -87,11 +85,15 @@ public class PluginInfo { public String getUrl(final CommandSender sender, final String version) { String ver = version; if (ver == null) { - if (tags != null) { - for (final TagInfo tagInfo : tags) { + if (plugin.tags != null) { + PluginHelperLogger.getLogger().debug("发现存在TAG标签 开始检索: " + NMSVersion); + for (final TagInfo tagInfo : plugin.tags) { if (tagInfo.tag.equalsIgnoreCase(NMSVersion)) { sender.sendMessage("§6版本: §b从Tag标签中获取 §e" + NMSVersion + " §b的最新版本..."); ver = tagInfo.version; + if (tagInfo.type == URLType.DirectUrl) { + return tagInfo.url; + } break; } } diff --git a/src/main/java/cn/citycraft/Yum/manager/RepoCache.java b/src/main/java/cn/citycraft/Yum/manager/RepoCache.java index a8fa0d6..399e763 100644 --- a/src/main/java/cn/citycraft/Yum/manager/RepoCache.java +++ b/src/main/java/cn/citycraft/Yum/manager/RepoCache.java @@ -32,7 +32,6 @@ public class RepoCache { } repos.put(repo, reposes); return reposes; - } public List getAllRepoInfo() { diff --git a/src/main/java/cn/citycraft/Yum/manager/RepoSerialization.java b/src/main/java/cn/citycraft/Yum/manager/RepoSerialization.java index 965bdbf..65c1de9 100644 --- a/src/main/java/cn/citycraft/Yum/manager/RepoSerialization.java +++ b/src/main/java/cn/citycraft/Yum/manager/RepoSerialization.java @@ -18,7 +18,7 @@ public class RepoSerialization { public List plugins = new ArrayList<>(); public String pom; public String url; - public String type; + public URLType type; } public class Plugin { @@ -31,7 +31,7 @@ public class RepoSerialization { public String pom; public List tags; public String version; - public String type; + public URLType type; } public class Repositories { @@ -41,13 +41,14 @@ public class RepoSerialization { public class Repository { public String id; - public String type; + public URLType type; public String url; } public class TagInfo { public String tag; public String version; + public URLType type; public String url; } diff --git a/src/main/java/cn/citycraft/Yum/manager/RepositoryManager.java b/src/main/java/cn/citycraft/Yum/manager/RepositoryManager.java index e918898..71570a4 100644 --- a/src/main/java/cn/citycraft/Yum/manager/RepositoryManager.java +++ b/src/main/java/cn/citycraft/Yum/manager/RepositoryManager.java @@ -23,6 +23,7 @@ import cn.citycraft.Yum.manager.RepoSerialization.PackageInfo; import cn.citycraft.Yum.manager.RepoSerialization.Plugin; import cn.citycraft.Yum.manager.RepoSerialization.Repositories; import cn.citycraft.Yum.manager.RepoSerialization.Repository; +import cn.citycraft.Yum.manager.RepoSerialization.TagInfo; import cn.citycraft.Yum.manager.RepoSerialization.URLType; /** @@ -92,9 +93,16 @@ public class RepositoryManager { public List getAllPluginsInfo() { final List li = new ArrayList(); + li.add("§d仓库名称 §a插件名称 §e插件描述"); for (final Entry pi : repocache.getPlugins().entrySet()) { final Plugin plugin = pi.getValue().plugin; li.add(String.format("§d%s §a%s §6- §e%s", pi.getValue().repo, pi.getValue().name, plugin.description)); + if (plugin.tags != null) { + li.add("§dTag标签 §a版本 §e类型 §c地址"); + for (final TagInfo tag : plugin.tags) { + li.add(String.format(" §d%s §a%s §e%s §6- §c%s", tag.tag, tag.version, tag.type != null ? tag.type : URLType.Maven, tag.url != null ? tag.url : "未定义")); + } + } } return li; } @@ -180,7 +188,8 @@ public class RepositoryManager { pi.branch = StringUtil.getNotNull(plugin.branch, "master"); pi.pom = StringUtil.getNotNull(plugin.pom, pkg.pom); pi.url = StringUtil.getNotNull(plugin.url, pkg.url); - pi.type = URLType.valueOf(StringUtil.getNotNull(StringUtil.getNotNull(plugin.type, pkg.type), URLType.Maven.name())); + pi.type = plugin.type != null ? plugin.type : pkg.type; + pi.type = pi.type != null ? pi.type : URLType.Maven; pi.plugin = plugin; pi.repo = pkg.name; repocache.getPlugins().put(plugin.groupId + "." + plugin.artifactId, pi);