mirror of
https://e.coding.net/circlecloud/Yum.git
synced 2024-11-22 06:18:46 +00:00
add tip color and fix command args...
Signed-off-by: j502647092 <jtb1@163.com>
This commit is contained in:
parent
3140f532dc
commit
ce1dab38cc
@ -25,30 +25,15 @@ import cn.citycraft.Yum.manager.YumManager;
|
||||
* @author 蒋天蓓 2015年8月22日上午8:29:44
|
||||
*/
|
||||
public class CommandHandler implements CommandExecutor, TabCompleter {
|
||||
/**
|
||||
* 转移数组
|
||||
*
|
||||
* @param args
|
||||
* - 原数组
|
||||
* @param start
|
||||
* - 数组开始位置
|
||||
* @return 转移后的数组字符串
|
||||
*/
|
||||
public static String[] moveStrings(String[] args, int start) {
|
||||
String[] ret = new String[args.length - start];
|
||||
System.arraycopy(args, start, ret, 0, ret.length);
|
||||
return ret;
|
||||
}
|
||||
|
||||
/**
|
||||
* 已注册命令列表(包括别名)
|
||||
*/
|
||||
List<String> RegisterCommandList = new ArrayList<String>();;
|
||||
List<String> RegisterCommandList = new ArrayList<String>();
|
||||
|
||||
/**
|
||||
* 命令监听类列表
|
||||
*/
|
||||
private List<BaseCommand> commandlist = new ArrayList<BaseCommand>();
|
||||
|
||||
private List<BaseCommand> commandlist = new ArrayList<BaseCommand>();;
|
||||
/**
|
||||
* 插件主类
|
||||
*/
|
||||
@ -76,6 +61,21 @@ public class CommandHandler implements CommandExecutor, TabCompleter {
|
||||
RegisterCommandList = getRegisterCommands();
|
||||
}
|
||||
|
||||
/**
|
||||
* 转移数组
|
||||
*
|
||||
* @param args
|
||||
* - 原数组
|
||||
* @param start
|
||||
* - 数组开始位置
|
||||
* @return 转移后的数组字符串
|
||||
*/
|
||||
public static String[] moveStrings(String[] args, int start) {
|
||||
String[] ret = new String[args.length - start];
|
||||
System.arraycopy(args, start, ret, 0, ret.length);
|
||||
return ret;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获得已注册的命令列表
|
||||
*
|
||||
@ -97,11 +97,11 @@ public class CommandHandler implements CommandExecutor, TabCompleter {
|
||||
for (BaseCommand command : commandlist)
|
||||
if (command.isValidTrigger(subcmd)) {
|
||||
if (!command.hasPermission(sender)) {
|
||||
sender.sendMessage("你没有此命令的权限!");
|
||||
sender.sendMessage("§c你没有此命令的权限!");
|
||||
return true;
|
||||
}
|
||||
if (command.isOnlyPlayerExecutable() && !(sender instanceof Player)) {
|
||||
sender.sendMessage("控制台无法使用此命令!");
|
||||
sender.sendMessage("§c控制台无法使用此命令!");
|
||||
return true;
|
||||
}
|
||||
if (subargs.length >= command.getMinimumArguments())
|
||||
@ -112,7 +112,7 @@ public class CommandHandler implements CommandExecutor, TabCompleter {
|
||||
sender.sendMessage(e.getMessage());
|
||||
}
|
||||
else
|
||||
sender.sendMessage("错误的参数 /yum " + command.getName() + command.getPossibleArguments());
|
||||
sender.sendMessage("§c错误的参数 §e使用方法 /yum " + command.getName() + command.getPossibleArguments());
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
@ -43,7 +43,7 @@ public class CommandUpgrade extends BaseCommand {
|
||||
|
||||
@Override
|
||||
public int getMinimumArguments() {
|
||||
return 1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
Loading…
Reference in New Issue
Block a user