perf(bukkit): 优化代码

This commit is contained in:
2023-02-25 09:19:33 +08:00
parent 6eef5a0f46
commit ebb145d141

View File

@@ -102,7 +102,7 @@ public abstract class ParentCommand extends ChildCommand {
} }
public void sendHelp(@NotNull CommandSender sender) { public void sendHelp(@NotNull CommandSender sender) {
sender.sendMessage("§e==================== [" + name + "使用帮助] ===================="); sender.sendMessage("§e==================== [ " + name + " 使用帮助] ====================");
Map<String, String> helpMap = getCommandHelp(sender); Map<String, String> helpMap = getCommandHelp(sender);
int maxLength = helpMap.keySet().stream() int maxLength = helpMap.keySet().stream()
.map(String::length) .map(String::length)
@@ -161,7 +161,7 @@ public abstract class ParentCommand extends ChildCommand {
return childCommands.stream() return childCommands.stream()
.filter(o -> o.hasPermission(sender)) .filter(o -> o.hasPermission(sender))
.map(ChildCommand::getName) .map(ChildCommand::getName)
.filter(o -> o.toLowerCase().startsWith(args[0])) .filter(o -> o.toLowerCase().startsWith(args[0].toLowerCase()))
.collect(Collectors.toList()); .collect(Collectors.toList());
} }
} }