Skip to content

Commit

Permalink
feat: 优化litecommands的别名注册
Browse files Browse the repository at this point in the history
  • Loading branch information
huanmeng-qwq committed Aug 19, 2024
1 parent 4647454 commit eedbc14
Showing 1 changed file with 9 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -52,15 +52,16 @@ protected KookLitePlatform(@NotNull LiteKookSettings settings, Plugin plugin, Co

@Override
protected void hook(CommandRoute<CommandSender> commandRoute, PlatformInvocationListener<CommandSender> platformInvocationListener, PlatformSuggestionListener<CommandSender> platformSuggestionListener) {
for (String label : commandRoute.names()) {
List<String> desc = commandRoute.meta().get(Meta.DESCRIPTION);
Set<String> prefixes = commandRoute.meta().get(PREFIX);
// List<String> perms = commandRoute.meta().get(Meta.PERMISSIONS);
JKookCommand command = new JKookCommand(label, prefixes)
.setDescription(String.join("\n", desc))
.setExecutor(new LiteKookCommandExecutor(plugin.getCore(), settings, commandRoute, label, platformInvocationListener, platformSuggestionListener));
commandMap.register(plugin, command);
List<String> desc = commandRoute.meta().get(Meta.DESCRIPTION);
Set<String> prefixes = commandRoute.meta().get(PREFIX);
// List<String> perms = commandRoute.meta().get(Meta.PERMISSIONS);
JKookCommand command = new JKookCommand(commandRoute.getName(), prefixes)
.setDescription(String.join("\n", desc))
.setExecutor(new LiteKookCommandExecutor(plugin.getCore(), settings, commandRoute, commandRoute.getName(), platformInvocationListener, platformSuggestionListener));
for (String alias : commandRoute.getAliases()) {
command.addAlias(alias);
}
commandMap.register(plugin, command);
}

@Override
Expand Down

0 comments on commit eedbc14

Please sign in to comment.