mirror of
https://e.coding.net/circlecloud/Yum.git
synced 2024-12-23 05:08:47 +00:00
run repo command async...
Signed-off-by: j502647092 <jtb1@163.com>
This commit is contained in:
parent
0f3aa5f0de
commit
f1b5551cf2
6
pom.xml
6
pom.xml
@ -64,8 +64,8 @@
|
||||
<url>https://hub.spigotmc.org/nexus/content/groups/public/</url>
|
||||
</repository>
|
||||
<repository>
|
||||
<id>citycraft-repo</id>
|
||||
<url>http://ci.citycraft.cn:8800/jenkins/plugin/repository/everything/</url>
|
||||
<id>sumcraft-repo</id>
|
||||
<url>http://ci.sumcraft.net:8080/plugin/repository/everything/</url>
|
||||
</repository>
|
||||
<repository>
|
||||
<id>Plugin Metrics</id>
|
||||
@ -77,7 +77,7 @@
|
||||
<groupId>org.spigotmc</groupId>
|
||||
<artifactId>spigot-api</artifactId>
|
||||
<type>jar</type>
|
||||
<version>1.8.3-R0.1-SNAPSHOT</version>
|
||||
<version>1.8.8-R0.1-SNAPSHOT</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>cn.citycraft</groupId>
|
||||
|
@ -37,38 +37,47 @@ public class CommandRepo extends BaseCommand {
|
||||
|
||||
@Override
|
||||
public void execute(final CommandSender sender, final Command command, final String label, final String[] args) throws CommandException {
|
||||
final String cmd = args[0];
|
||||
switch (cmd) {
|
||||
case "add":
|
||||
if (args.length == 2) {
|
||||
if (YumManager.repo.addRepositories(sender, args[1])) {
|
||||
sender.sendMessage("§6仓库: §a插件信息已缓存!");
|
||||
} else {
|
||||
sender.sendMessage("§6仓库: §c源地址未找到仓库信息或无法访问!");
|
||||
main.getServer().getScheduler().runTaskAsynchronously(main, new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
final String cmd = args[0];
|
||||
switch (cmd) {
|
||||
case "add":
|
||||
if (args.length == 2) {
|
||||
if (YumManager.repo.addRepositories(sender, args[1])) {
|
||||
sender.sendMessage("§6仓库: §a插件信息已缓存!");
|
||||
} else {
|
||||
sender.sendMessage("§6仓库: §c源地址未找到仓库信息或无法访问!");
|
||||
}
|
||||
} else {
|
||||
sender.sendMessage("§6仓库: §c请输入源地址!");
|
||||
}
|
||||
break;
|
||||
case "list":
|
||||
sender.sendMessage("§6仓库: §b缓存的插件信息如下 ");
|
||||
StringUtil.sendStringArray(sender, YumManager.repo.getAllPluginsInfo());
|
||||
break;
|
||||
case "clean":
|
||||
YumManager.repo.clean();
|
||||
sender.sendMessage("§6仓库: §a缓存的插件信息已清理!");
|
||||
break;
|
||||
case "update":
|
||||
YumManager.repo.updateRepositories(sender);
|
||||
sender.sendMessage("§6仓库: §a仓库缓存数据已更新!");
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
sender.sendMessage("§6仓库: §c请输入源地址!");
|
||||
}
|
||||
break;
|
||||
case "list":
|
||||
sender.sendMessage("§6仓库: §b缓存的插件信息如下 ");
|
||||
StringUtil.sendStringArray(sender, YumManager.repo.getAllPluginsInfo());
|
||||
break;
|
||||
case "clean":
|
||||
YumManager.repo.clean();
|
||||
sender.sendMessage("§6仓库: §a缓存的插件信息已清理!");
|
||||
break;
|
||||
case "update":
|
||||
YumManager.repo.updateRepositories(sender);
|
||||
sender.sendMessage("§6仓库: §a仓库缓存数据已更新!");
|
||||
break;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> onTabComplete(final CommandSender sender, final Command command, final String label, final String[] args) {
|
||||
if (args[0].equalsIgnoreCase("repo")) {
|
||||
return StringUtil.copyPartialMatches(args[1], Arrays.asList(new String[] { "add", "list", "clean", "update" }), new ArrayList<String>());
|
||||
return StringUtil.copyPartialMatches(args[1], Arrays.asList(new String[] { "add",
|
||||
"list",
|
||||
"clean",
|
||||
"update" }),
|
||||
new ArrayList<String>());
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user