comeplete tabcomplete and update version...

Signed-off-by: 502647092 <jtb1@163.com>
This commit is contained in:
502647092 2015-09-30 13:58:08 +08:00
parent bf2a870984
commit 597d1337f1
4 changed files with 38 additions and 3 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.5</version> <version>1.6</version>
<name>Yum</name> <name>Yum</name>
<description>Minecraft 服务器插件管理系统</description> <description>Minecraft 服务器插件管理系统</description>
<build> <build>

View File

@ -3,6 +3,9 @@
*/ */
package cn.citycraft.Yum.commands; package cn.citycraft.Yum.commands;
import java.util.ArrayList;
import java.util.List;
import org.apache.commons.lang.StringUtils; import org.apache.commons.lang.StringUtils;
import org.bukkit.command.Command; import org.bukkit.command.Command;
import org.bukkit.command.CommandException; import org.bukkit.command.CommandException;
@ -52,5 +55,13 @@ public class CommandInfo extends BaseCommand {
} else { } else {
sender.sendMessage("§4错误: §c插件 " + pluginname + " 不存在或已卸载!"); sender.sendMessage("§4错误: §c插件 " + pluginname + " 不存在或已卸载!");
} }
}; }
@Override
public List<String> onTabComplete(final CommandSender sender, final Command command, final String label, final String[] args) {
if (!args[0].equalsIgnoreCase("install") && !args[0].equalsIgnoreCase("repo")) {
return StringUtil.copyPartialMatches(args[1], YumManager.plugman.getPluginNames(false), new ArrayList<String>());
}
return null;
}
} }

View File

@ -3,6 +3,9 @@
*/ */
package cn.citycraft.Yum.commands; package cn.citycraft.Yum.commands;
import java.util.ArrayList;
import java.util.List;
import org.bukkit.Bukkit; import org.bukkit.Bukkit;
import org.bukkit.command.Command; import org.bukkit.command.Command;
import org.bukkit.command.CommandException; import org.bukkit.command.CommandException;
@ -10,6 +13,7 @@ import org.bukkit.command.CommandSender;
import org.bukkit.plugin.Plugin; import org.bukkit.plugin.Plugin;
import cn.citycraft.PluginHelper.commands.BaseCommand; import cn.citycraft.PluginHelper.commands.BaseCommand;
import cn.citycraft.PluginHelper.utils.StringUtil;
import cn.citycraft.Yum.Yum; import cn.citycraft.Yum.Yum;
import cn.citycraft.Yum.manager.YumManager; import cn.citycraft.Yum.manager.YumManager;
@ -51,4 +55,12 @@ public class CommandInstall extends BaseCommand {
sender.sendMessage("§c插件" + pluginname + "已安装在服务器 需要更新请使用yum update " + pluginname + "!"); sender.sendMessage("§c插件" + pluginname + "已安装在服务器 需要更新请使用yum update " + pluginname + "!");
} }
} }
@Override
public List<String> onTabComplete(final CommandSender sender, final Command command, final String label, final String[] args) {
if (args[0].equalsIgnoreCase("install")) {
return StringUtil.copyPartialMatches(args[1], YumManager.repo.getAllPluginName(), new ArrayList<String>());
}
return null;
}
} }

View File

@ -3,6 +3,10 @@
*/ */
package cn.citycraft.Yum.commands; package cn.citycraft.Yum.commands;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import org.bukkit.command.Command; import org.bukkit.command.Command;
import org.bukkit.command.CommandException; import org.bukkit.command.CommandException;
import org.bukkit.command.CommandSender; import org.bukkit.command.CommandSender;
@ -59,5 +63,13 @@ public class CommandRepo extends BaseCommand {
sender.sendMessage("§6仓库: §a仓库缓存数据已更新!"); sender.sendMessage("§6仓库: §a仓库缓存数据已更新!");
break; 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 null;
}
} }