update version and add repo info ...

Signed-off-by: 502647092 <jtb1@163.com>
This commit is contained in:
502647092 2015-09-01 13:58:15 +08:00
parent 18fe06b1cc
commit 7845a8ace5
4 changed files with 13 additions and 6 deletions

View File

@ -3,7 +3,7 @@
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>
<groupId>cn.citycraft</groupId> <groupId>cn.citycraft</groupId>
<artifactId>Yum</artifactId> <artifactId>Yum</artifactId>
<version>1.3-bate1</version> <version>1.3.2</version>
<name>Yum</name> <name>Yum</name>
<description>Minecraft 服务器插件管理系统</description> <description>Minecraft 服务器插件管理系统</description>
<build> <build>

View File

@ -31,13 +31,18 @@ public class CommandRepo extends BaseCommand {
switch (cmd) { switch (cmd) {
case "add": case "add":
if (args.length == 2) { if (args.length == 2) {
main.repo.addRepositories(args[1]); if (main.repo.addRepositories(args[1])) {
}
sender.sendMessage("§6仓库: §a插件信息已缓存!"); sender.sendMessage("§6仓库: §a插件信息已缓存!");
} else {
sender.sendMessage("§6仓库: §c源地址未找到仓库信息或无法访问!");
}
} else {
sender.sendMessage("§6仓库: §c请输入源地址!");
}
break; break;
case "list": case "list":
sender.sendMessage("§6仓库: §b缓存的插件信息如下 "); sender.sendMessage("§6仓库: §b缓存的插件信息如下 ");
StringUtil.sendStringArray(sender, main.repo.getAllPluginString()); StringUtil.sendStringArray(sender, main.repo.getAllPluginsInfo());
break; break;
case "clean": case "clean":
main.repo.clean(); main.repo.clean();

View File

@ -9,6 +9,7 @@ package cn.citycraft.Yum.repository;
public class PluginInfo { public class PluginInfo {
public Plugin plugin; public Plugin plugin;
public String url; public String url;
public String repo;
public String getMavenUrl() { public String getMavenUrl() {
return String.format(url + "/%1$s/%2$s/%3$s/%2$s-%3$s.jar", plugin.groupId.replace(".", "/"), plugin.artifactId, plugin.version); return String.format(url + "/%1$s/%2$s/%3$s/%2$s-%3$s.jar", plugin.groupId.replace(".", "/"), plugin.artifactId, plugin.version);

View File

@ -45,6 +45,7 @@ public class RepositoryManager {
PluginInfo pi = new PluginInfo(); PluginInfo pi = new PluginInfo();
pi.plugin = plugin; pi.plugin = plugin;
pi.url = pkg.url; pi.url = pkg.url;
pi.repo = pkg.name;
plugins.put(plugin.groupId + "." + plugin.artifactId, pi); plugins.put(plugin.groupId + "." + plugin.artifactId, pi);
} }
} }
@ -138,11 +139,11 @@ public class RepositoryManager {
return li; return li;
} }
public List<String> getAllPluginString() { public List<String> getAllPluginsInfo() {
List<String> li = new ArrayList<String>(); List<String> li = new ArrayList<String>();
for (Entry<String, PluginInfo> plugin : plugins.entrySet()) { for (Entry<String, PluginInfo> plugin : plugins.entrySet()) {
Plugin pl = plugin.getValue().plugin; Plugin pl = plugin.getValue().plugin;
li.add(String.format("%s %s(%s) - %s", pl.groupId, pl.artifactId, pl.version, pl.description)); li.add(String.format("%s %s(%s) - %s", plugin.getValue().repo, pl.artifactId, pl.version, pl.description));
} }
return li; return li;
} }