mirror of
https://e.coding.net/circlecloud/YumCore.git
synced 2024-12-26 07:18:52 +00:00
feat: 添加根据命令名称排序
Signed-off-by: 502647092 <admin@yumc.pw>
This commit is contained in:
parent
56a6b0137b
commit
8914c7c12f
@ -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<? extends CommandInfo> 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<CommandInfo> {
|
||||
@Override
|
||||
public int compare(CommandInfo o1, CommandInfo o2) {
|
||||
return o1.getName().compareTo(o2.getName());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 命令排序比较器
|
||||
*
|
||||
|
Loading…
Reference in New Issue
Block a user