.
This commit is contained in:
parent
254af80fde
commit
72f7625b19
53 changed files with 679 additions and 756 deletions
|
|
@ -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));
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue