This commit is contained in:
kento2 2026-06-29 18:49:42 +02:00
parent 254af80fde
commit 72f7625b19
53 changed files with 679 additions and 756 deletions

View file

@ -0,0 +1,24 @@
package de.kentoj.kencommandapi;
import com.velocitypowered.api.command.CommandSource;
import com.velocitypowered.api.proxy.ProxyServer;
import de.kentoj.kencommandapi.api.CommandNode;
import de.kentoj.kencommandapi.internal.parser.CommandParser;
import lombok.RequiredArgsConstructor;
import java.util.Arrays;
@RequiredArgsConstructor
public class CommandAPI {
private final ProxyServer server;
private final CommandParser<CommandSource> commandParser = new CommandParser<>(CommandSource::hasPermission);
public void register(CommandNode<CommandSource> rootNode) {
var cm = server.getCommandManager();
var meta = cm.metaBuilder(rootNode.getNames()[0])
.aliases(Arrays.copyOfRange(rootNode.getNames(), 1, rootNode.getNames().length - 1))
.build();
cm.register(meta, new VelocityCommand(commandParser, rootNode));
}
}