diff --git a/src/main/java/pw/yumc/YumCore/commands/CommandHelp.java b/src/main/java/pw/yumc/YumCore/commands/CommandHelp.java index 865300e..2626267 100644 --- a/src/main/java/pw/yumc/YumCore/commands/CommandHelp.java +++ b/src/main/java/pw/yumc/YumCore/commands/CommandHelp.java @@ -1,15 +1,14 @@ package pw.yumc.YumCore.commands; -import java.util.*; - import org.bukkit.command.Command; import org.bukkit.command.CommandSender; - import pw.yumc.YumCore.bukkit.P; import pw.yumc.YumCore.commands.annotation.Help; import pw.yumc.YumCore.commands.info.CommandInfo; import pw.yumc.YumCore.commands.interfaces.CommandHelpParse; +import java.util.*; + /** * 命令帮助生成类 * @@ -72,6 +71,7 @@ public class CommandHelp { public CommandHelp(CommandInfo defCmd, Collection list) { this.defCmd = defCmd; cmdlist = new LinkedList<>(list); + Collections.sort(cmdlist, new CommandNameComparator()); Collections.sort(cmdlist, new CommandComparator()); HELPPAGECOUNT = (int) Math.ceil((double) cmdlist.size() / LINES_PER_PAGE); } @@ -167,6 +167,19 @@ public class CommandHelp { this.helpParse = helpParse; } + /** + * 命令名称比较器 + * + * @since 2016年7月23日 下午4:17:18 + * @author 喵♂呜 + */ + static class CommandNameComparator implements Comparator { + @Override + public int compare(CommandInfo o1, CommandInfo o2) { + return o1.getName().compareTo(o2.getName()); + } + } + /** * 命令排序比较器 *