mirror of
https://e.coding.net/circlecloud/Yum.git
synced 2024-11-22 14:28:46 +00:00
update BaseCommand...
Signed-off-by: 502647092 <jtb1@163.com>
This commit is contained in:
parent
8c17dd8908
commit
39f72995a2
@ -20,17 +20,18 @@ public abstract class BaseCommand {
|
||||
private String name;
|
||||
private String permission;
|
||||
private String[] aliases;
|
||||
private String description = "无";
|
||||
private String description;
|
||||
private int minimumArguments = 0;
|
||||
private String possibleArguments = "";
|
||||
private boolean onlyPlayerExecutable = false;
|
||||
|
||||
public BaseCommand(String name) {
|
||||
this(name, new String[0]);
|
||||
public BaseCommand(String name, String description) {
|
||||
this(name, description, new String[0]);
|
||||
}
|
||||
|
||||
public BaseCommand(String name, String... aliases) {
|
||||
public BaseCommand(String name, String description, String... aliases) {
|
||||
this.name = name;
|
||||
this.description = description;
|
||||
this.aliases = aliases;
|
||||
}
|
||||
|
||||
@ -48,6 +49,11 @@ public abstract class BaseCommand {
|
||||
*/
|
||||
public abstract void execute(CommandSender sender, String label, String[] args) throws CommandException;
|
||||
|
||||
/**
|
||||
* 获得当前命令的别名
|
||||
*
|
||||
* @return 当前命令的别名
|
||||
*/
|
||||
public List<String> getCommandList() {
|
||||
List<String> cmds = new ArrayList<String>();
|
||||
cmds.add(name);
|
||||
@ -139,16 +145,6 @@ public abstract class BaseCommand {
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置命令的描述信息
|
||||
*
|
||||
* @param description
|
||||
* - 命令描述
|
||||
*/
|
||||
public void setDescription(String description) {
|
||||
this.description = description;
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置命令的最小参数个数
|
||||
*
|
||||
@ -181,7 +177,7 @@ public abstract class BaseCommand {
|
||||
|
||||
/**
|
||||
* 设置可能的命令参数
|
||||
*
|
||||
*
|
||||
* @param possibleArguments
|
||||
* - 可能的命令参数
|
||||
*/
|
||||
|
@ -23,9 +23,8 @@ public class CommandDelete extends BaseCommand {
|
||||
* @param name
|
||||
*/
|
||||
public CommandDelete(Yum main) {
|
||||
super("delete");
|
||||
super("delete", "删除插件");
|
||||
this.main = main;
|
||||
setDescription("删除插件");
|
||||
setMinimumArguments(1);
|
||||
setPossibleArguments("<插件名称>");
|
||||
}
|
||||
|
@ -25,9 +25,8 @@ public class CommandInfo extends BaseCommand {
|
||||
* @param name
|
||||
*/
|
||||
public CommandInfo(Yum main) {
|
||||
super("info");
|
||||
super("info", "查看插件详情");
|
||||
this.main = main;
|
||||
setDescription("查看插件详情");
|
||||
setPossibleArguments("<插件名称>");
|
||||
}
|
||||
|
||||
|
@ -23,9 +23,8 @@ public class CommandInstall extends BaseCommand {
|
||||
* @param name
|
||||
*/
|
||||
public CommandInstall(Yum main) {
|
||||
super("install");
|
||||
super("install", "安装插件");
|
||||
this.main = main;
|
||||
setDescription("安装插件");
|
||||
setMinimumArguments(1);
|
||||
setPossibleArguments("<插件名称>");
|
||||
}
|
||||
|
@ -23,9 +23,8 @@ public class CommandList extends BaseCommand {
|
||||
* @param name
|
||||
*/
|
||||
public CommandList(Yum main) {
|
||||
super("list");
|
||||
super("list", "列出已安装插件列表");
|
||||
this.main = main;
|
||||
setDescription("列出已安装插件列表");
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -23,9 +23,8 @@ public class CommandLoad extends BaseCommand {
|
||||
* @param name
|
||||
*/
|
||||
public CommandLoad(Yum main) {
|
||||
super("load");
|
||||
super("load", "载入插件");
|
||||
this.main = main;
|
||||
setDescription("载入插件");
|
||||
setMinimumArguments(1);
|
||||
setPossibleArguments("<插件名称>");
|
||||
}
|
||||
|
@ -23,9 +23,8 @@ public class CommandReload extends BaseCommand {
|
||||
* @param name
|
||||
*/
|
||||
public CommandReload(Yum main) {
|
||||
super("reload");
|
||||
super("reload", "重载插件");
|
||||
this.main = main;
|
||||
setDescription("重载插件");
|
||||
setMinimumArguments(1);
|
||||
setPossibleArguments("<插件名称|all|*>");
|
||||
}
|
||||
|
@ -22,9 +22,8 @@ public class CommandRepo extends BaseCommand {
|
||||
* @param name
|
||||
*/
|
||||
public CommandRepo(Yum main) {
|
||||
super("repo");
|
||||
super("repo", "插件源命令");
|
||||
this.main = main;
|
||||
setDescription("插件源命令");
|
||||
setMinimumArguments(1);
|
||||
setPossibleArguments("<add|del|clean|list> <仓库名称>");
|
||||
}
|
||||
|
@ -23,9 +23,8 @@ public class CommandUnload extends BaseCommand {
|
||||
* @param name
|
||||
*/
|
||||
public CommandUnload(Yum main) {
|
||||
super("unload");
|
||||
super("unload", "卸载插件");
|
||||
this.main = main;
|
||||
setDescription("卸载插件");
|
||||
setMinimumArguments(1);
|
||||
setPossibleArguments("<插件名称>");
|
||||
}
|
||||
|
@ -21,9 +21,8 @@ public class CommandUpdate extends BaseCommand {
|
||||
* @param name
|
||||
*/
|
||||
public CommandUpdate(Yum main) {
|
||||
super("update");
|
||||
super("update", "更新插件");
|
||||
this.main = main;
|
||||
setDescription("更新插件");
|
||||
setMinimumArguments(1);
|
||||
setPossibleArguments("<插件名称> [插件版本]");
|
||||
}
|
||||
|
@ -21,9 +21,8 @@ public class CommandUpgrade extends BaseCommand {
|
||||
* @param name
|
||||
*/
|
||||
public CommandUpgrade(Yum main) {
|
||||
super("upgrade");
|
||||
super("upgrade", "升级插件");
|
||||
this.main = main;
|
||||
setDescription("升级插件");
|
||||
setMinimumArguments(1);
|
||||
setPossibleArguments("<插件名称>");
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user