mirror of
				https://e.coding.net/circlecloud/YumCore.git
				synced 2025-11-03 23:06:02 +00:00 
			
		
		
		
	@@ -31,6 +31,10 @@ public class CommandHelp {
 | 
				
			|||||||
    private final static String helpTitle = String.format("§6========= %s §6插件帮助列表=========", prefix);
 | 
					    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 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 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 HELPPAGECOUNT;
 | 
				
			||||||
    /**
 | 
					 | 
				
			||||||
     * 帮助页面每页行数
 | 
					 | 
				
			||||||
     */
 | 
					 | 
				
			||||||
    private final int LINES_PER_PAGE = 7;
 | 
					 | 
				
			||||||
    /**
 | 
					    /**
 | 
				
			||||||
     * 帮助列表缓存
 | 
					     * 帮助列表缓存
 | 
				
			||||||
     */
 | 
					     */
 | 
				
			||||||
@@ -133,6 +133,7 @@ public class CommandHelp {
 | 
				
			|||||||
            page = Integer.parseInt(args[1]);
 | 
					            page = Integer.parseInt(args[1]);
 | 
				
			||||||
            page = page == 0 ? 1 : page;
 | 
					            page = page == 0 ? 1 : page;
 | 
				
			||||||
        } catch (final Exception e) {
 | 
					        } catch (final Exception e) {
 | 
				
			||||||
 | 
					            // Ignore
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
        final String helpkey = label + page;
 | 
					        final String helpkey = label + page;
 | 
				
			||||||
        if (!cacheHelp.containsKey(helpkey)) {
 | 
					        if (!cacheHelp.containsKey(helpkey)) {
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -234,7 +234,7 @@ public class CommandInfo {
 | 
				
			|||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    private String eS(final List<Executor> executors) {
 | 
					    private String eS(final List<Executor> executors) {
 | 
				
			||||||
        final StringBuffer str = new StringBuffer();
 | 
					        final StringBuilder str = new StringBuilder();
 | 
				
			||||||
        for (final Executor executor : executors) {
 | 
					        for (final Executor executor : executors) {
 | 
				
			||||||
            str.append(executor.getName());
 | 
					            str.append(executor.getName());
 | 
				
			||||||
            str.append(", ");
 | 
					            str.append(", ");
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -29,12 +29,12 @@ import pw.yumc.YumCore.bukkit.compatible.C;
 | 
				
			|||||||
 * @author 喵♂呜
 | 
					 * @author 喵♂呜
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
public class CommandManager implements TabExecutor {
 | 
					public class CommandManager implements TabExecutor {
 | 
				
			||||||
    private final String argumentTypeError = "注解命令方法 %s 位于 %s 的参数错误 应只有 CommandArgument 参数!";
 | 
					    private final static String argumentTypeError = "注解命令方法 %s 位于 %s 的参数错误 应只有 CommandArgument 参数!";
 | 
				
			||||||
    private final String returnTypeError = "注解命令补全 %s 位于 %s 的返回值错误 应实现 List 接口!";
 | 
					    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) {
 | 
					    private List<String> getPlayerTabComplete(final CommandSender sender, final Command command, final String alias, final String[] args) {
 | 
				
			||||||
        final String lastWord = args[args.length - 1];
 | 
					        final String lastWord = args[args.length - 1];
 | 
				
			||||||
        final Player senderPlayer = sender instanceof Player ? (Player) sender : null;
 | 
					        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()) {
 | 
					        for (final Player player : C.Player.getOnlinePlayers()) {
 | 
				
			||||||
            final String name = player.getName();
 | 
					            final String name = player.getName();
 | 
				
			||||||
            if ((senderPlayer == null || senderPlayer.canSee(player)) && StringUtil.startsWithIgnoreCase(name, lastWord)) {
 | 
					            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.bukkit.P;
 | 
				
			||||||
import pw.yumc.YumCore.commands.annotation.Tab;
 | 
					import pw.yumc.YumCore.commands.annotation.Tab;
 | 
				
			||||||
 | 
					import pw.yumc.YumCore.commands.exception.CommandException;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/**
 | 
					/**
 | 
				
			||||||
 * Tab补全
 | 
					 * Tab补全
 | 
				
			||||||
@@ -72,7 +73,7 @@ public class TabInfo {
 | 
				
			|||||||
        try {
 | 
					        try {
 | 
				
			||||||
            return (List<String>) method.invoke(origin, cmdArgs);
 | 
					            return (List<String>) method.invoke(origin, cmdArgs);
 | 
				
			||||||
        } catch (IllegalAccessException | IllegalArgumentException | InvocationTargetException e) {
 | 
					        } 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);
 | 
					        super(string);
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    public CommandException(final String string, final Exception e) {
 | 
				
			||||||
 | 
					        super(string, e);
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user