mirror of
https://e.coding.net/circlecloud/Yum.git
synced 2024-11-22 14:28:46 +00:00
完善多版本更新机制...
Signed-off-by: 502647092 <jtb1@163.com>
This commit is contained in:
parent
63dda660c8
commit
34596e3b1d
5
pom.xml
5
pom.xml
@ -3,7 +3,7 @@
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<groupId>cn.citycraft</groupId>
|
||||
<artifactId>Yum</artifactId>
|
||||
<version>1.8.8</version>
|
||||
<version>1.8.9</version>
|
||||
<name>Yum</name>
|
||||
<description>Minecraft 服务器插件管理系统</description>
|
||||
<build>
|
||||
@ -55,7 +55,8 @@
|
||||
</build>
|
||||
<properties>
|
||||
<jenkins.url>http://ci.citycraft.cn:8080</jenkins.url>
|
||||
<update.description>&c临时兼容旧版本的全体更新...</update.description>
|
||||
<update.description>&a通过检测NMS版本实现多端兼容处理...</update.description>
|
||||
<env.BUILD_NUMBER>Debug</env.BUILD_NUMBER>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
</properties>
|
||||
<repositories>
|
||||
|
@ -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<TagInfo> 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;
|
||||
}
|
||||
}
|
||||
|
@ -32,7 +32,6 @@ public class RepoCache {
|
||||
}
|
||||
repos.put(repo, reposes);
|
||||
return reposes;
|
||||
|
||||
}
|
||||
|
||||
public List<String> getAllRepoInfo() {
|
||||
|
@ -18,7 +18,7 @@ public class RepoSerialization {
|
||||
public List<Plugin> 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<TagInfo> 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;
|
||||
}
|
||||
|
||||
|
@ -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<String> getAllPluginsInfo() {
|
||||
final List<String> li = new ArrayList<String>();
|
||||
li.add("§d仓库名称 §a插件名称 §e插件描述");
|
||||
for (final Entry<String, PluginInfo> 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);
|
||||
|
Loading…
Reference in New Issue
Block a user