2016-07-07 02:23:26 +00:00
|
|
|
package pw.yumc.Yum.commands;
|
|
|
|
|
|
|
|
import java.util.ArrayList;
|
|
|
|
import java.util.Arrays;
|
|
|
|
import java.util.List;
|
|
|
|
|
|
|
|
import pw.yumc.Yum.api.YumAPI;
|
2016-07-26 12:17:37 +00:00
|
|
|
import pw.yumc.YumCore.commands.CommandArgument;
|
|
|
|
import pw.yumc.YumCore.commands.annotation.Tab;
|
2016-10-25 07:03:21 +00:00
|
|
|
import pw.yumc.YumCore.commands.interfaces.CommandExecutor;
|
|
|
|
import pw.yumc.YumCore.kit.StrKit;
|
2016-07-07 02:23:26 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
*
|
|
|
|
* @since 2016年7月7日 上午8:36:47
|
|
|
|
* @author 喵♂呜
|
|
|
|
*/
|
2016-07-26 12:17:37 +00:00
|
|
|
public class PluginTabComplete implements CommandExecutor {
|
2016-07-07 02:23:26 +00:00
|
|
|
public static PluginTabComplete instence = new PluginTabComplete();
|
|
|
|
|
2016-07-26 12:17:37 +00:00
|
|
|
@Tab
|
2016-10-25 07:03:21 +00:00
|
|
|
public List<String> listtab(CommandArgument e) {
|
|
|
|
String[] args = e.getArgs();
|
2016-07-07 02:23:26 +00:00
|
|
|
if (args[0].equalsIgnoreCase("install") || args[0].equalsIgnoreCase("i")) {
|
|
|
|
return StrKit.copyPartialMatches(args[1], YumAPI.getRepo().getAllPluginName(), new ArrayList<String>());
|
2016-07-19 05:46:36 +00:00
|
|
|
} else if (args[0].equalsIgnoreCase("repo") || args[0].equalsIgnoreCase("r")) {
|
2016-10-25 07:03:21 +00:00
|
|
|
if (args.length == 2) { return StrKit.copyPartialMatches(args[1],
|
|
|
|
Arrays.asList(new String[] { "add", "all", "list", "delall", "clean", "update", "del" }),
|
|
|
|
new ArrayList<String>()); }
|
|
|
|
if (args.length == 3 && (args[1] == "add" || args[1] == "del")) { return StrKit.copyPartialMatches(args[2],
|
|
|
|
YumAPI.getRepo().getRepos().keySet(),
|
|
|
|
new ArrayList<String>()); }
|
2016-07-19 05:46:36 +00:00
|
|
|
} else if (args[0].equalsIgnoreCase("bukkitrepo") || args[0].equalsIgnoreCase("br")) {
|
2016-10-25 07:03:21 +00:00
|
|
|
return StrKit.copyPartialMatches(args[1],
|
|
|
|
Arrays.asList(new String[] { "look", "install" }),
|
|
|
|
new ArrayList<String>());
|
2016-07-07 02:23:26 +00:00
|
|
|
} else {
|
2016-10-25 07:03:21 +00:00
|
|
|
return StrKit.copyPartialMatches(args[1],
|
|
|
|
YumAPI.getPlugman().getPluginNames(false),
|
|
|
|
new ArrayList<String>());
|
2016-07-07 02:23:26 +00:00
|
|
|
}
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
}
|