mirror of
https://e.coding.net/circlecloud/YumCore.git
synced 2024-11-22 01:48:50 +00:00
fix: 修复一般错误
Signed-off-by: 502647092 <admin@yumc.pw>
This commit is contained in:
parent
89c7a89df2
commit
5a5c01153f
@ -31,6 +31,10 @@ public class CommandHelp {
|
||||
private final static String helpTitle = String.format("§6========= %s §6插件帮助列表=========", prefix);
|
||||
private final static String helpBody = "§6/%1$s §a%2$s §e%3$s §6- §b%4$s";
|
||||
private final static String helpFooter = "§6查看更多的帮助页面 §b请输入 /%s help §e1-%s";
|
||||
/**
|
||||
* 帮助页面每页行数
|
||||
*/
|
||||
private final static int LINES_PER_PAGE = 7;
|
||||
/**
|
||||
* 默认命令
|
||||
*/
|
||||
@ -47,10 +51,6 @@ public class CommandHelp {
|
||||
* 帮助页面数量
|
||||
*/
|
||||
private final int HELPPAGECOUNT;
|
||||
/**
|
||||
* 帮助页面每页行数
|
||||
*/
|
||||
private final int LINES_PER_PAGE = 7;
|
||||
/**
|
||||
* 帮助列表缓存
|
||||
*/
|
||||
@ -133,6 +133,7 @@ public class CommandHelp {
|
||||
page = Integer.parseInt(args[1]);
|
||||
page = page == 0 ? 1 : page;
|
||||
} catch (final Exception e) {
|
||||
// Ignore
|
||||
}
|
||||
final String helpkey = label + page;
|
||||
if (!cacheHelp.containsKey(helpkey)) {
|
||||
|
@ -234,7 +234,7 @@ public class CommandInfo {
|
||||
}
|
||||
|
||||
private String eS(final List<Executor> executors) {
|
||||
final StringBuffer str = new StringBuffer();
|
||||
final StringBuilder str = new StringBuilder();
|
||||
for (final Executor executor : executors) {
|
||||
str.append(executor.getName());
|
||||
str.append(", ");
|
||||
|
@ -29,12 +29,12 @@ import pw.yumc.YumCore.bukkit.compatible.C;
|
||||
* @author 喵♂呜
|
||||
*/
|
||||
public class CommandManager implements TabExecutor {
|
||||
private final String argumentTypeError = "注解命令方法 %s 位于 %s 的参数错误 应只有 CommandArgument 参数!";
|
||||
private final String returnTypeError = "注解命令补全 %s 位于 %s 的返回值错误 应实现 List 接口!";
|
||||
private final static String argumentTypeError = "注解命令方法 %s 位于 %s 的参数错误 应只有 CommandArgument 参数!";
|
||||
private final static String returnTypeError = "注解命令补全 %s 位于 %s 的返回值错误 应实现 List 接口!";
|
||||
/**
|
||||
* 插件实例类
|
||||
*/
|
||||
private final JavaPlugin plugin = P.instance;
|
||||
private final static JavaPlugin plugin = P.instance;
|
||||
/**
|
||||
* 默认命令
|
||||
*/
|
||||
@ -207,7 +207,7 @@ public class CommandManager implements TabExecutor {
|
||||
private List<String> getPlayerTabComplete(final CommandSender sender, final Command command, final String alias, final String[] args) {
|
||||
final String lastWord = args[args.length - 1];
|
||||
final Player senderPlayer = sender instanceof Player ? (Player) sender : null;
|
||||
final ArrayList<String> matchedPlayers = new ArrayList<>();
|
||||
final List<String> matchedPlayers = new ArrayList<>();
|
||||
for (final Player player : C.Player.getOnlinePlayers()) {
|
||||
final String name = player.getName();
|
||||
if ((senderPlayer == null || senderPlayer.canSee(player)) && StringUtil.startsWithIgnoreCase(name, lastWord)) {
|
||||
|
@ -9,6 +9,7 @@ import org.bukkit.command.CommandSender;
|
||||
|
||||
import pw.yumc.YumCore.bukkit.P;
|
||||
import pw.yumc.YumCore.commands.annotation.Tab;
|
||||
import pw.yumc.YumCore.commands.exception.CommandException;
|
||||
|
||||
/**
|
||||
* Tab补全
|
||||
@ -72,7 +73,7 @@ public class TabInfo {
|
||||
try {
|
||||
return (List<String>) method.invoke(origin, cmdArgs);
|
||||
} catch (IllegalAccessException | IllegalArgumentException | InvocationTargetException e) {
|
||||
throw new RuntimeException("调用Tab自动补全发生错误 请反馈给开发者 " + Arrays.toString(P.instance.getDescription().getAuthors().toArray()) + " !", e);
|
||||
throw new CommandException("调用Tab自动补全发生错误 请反馈给开发者 " + Arrays.toString(P.instance.getDescription().getAuthors().toArray()) + " !", e);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -16,4 +16,8 @@ public class CommandException extends RuntimeException {
|
||||
super(string);
|
||||
}
|
||||
|
||||
public CommandException(final String string, final Exception e) {
|
||||
super(string, e);
|
||||
}
|
||||
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user