reworked parsing
This commit is contained in:
parent
8897579a12
commit
ac6a95232e
22 changed files with 360 additions and 441 deletions
|
|
@ -3,8 +3,7 @@ package de.kentoj.kencommandapi;
|
|||
import com.velocitypowered.api.command.CommandSource;
|
||||
import com.velocitypowered.api.proxy.ProxyServer;
|
||||
import de.kentoj.kencommandapi.api.CommandHandler;
|
||||
import de.kentoj.kencommandapi.api.node.RootCommandNode;
|
||||
import de.kentoj.kencommandapi.api.parser.CommandParser;
|
||||
import de.kentoj.kencommandapi.api.literal.RootLiteral;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
|
||||
import java.util.Arrays;
|
||||
|
|
@ -13,13 +12,10 @@ import java.util.Arrays;
|
|||
public class CommandAPI {
|
||||
|
||||
private final ProxyServer server;
|
||||
private final CommandHandler<CommandSource> commandHandler = new CommandHandler<>(
|
||||
new CommandParser<>(CommandSource::hasPermission),
|
||||
CommandSource::sendMessage,
|
||||
CommandSource::hasPermission
|
||||
);
|
||||
private final CommandHandler<CommandSource> commandHandler =
|
||||
new CommandHandler<>(CommandSource::sendMessage, CommandSource::hasPermission);
|
||||
|
||||
public void register(RootCommandNode<CommandSource> rootNode) {
|
||||
public void register(RootLiteral<CommandSource> rootNode) {
|
||||
var cm = server.getCommandManager();
|
||||
var meta = cm.metaBuilder(rootNode.getNames()[0])
|
||||
.aliases(Arrays.copyOfRange(rootNode.getNames(), 1, rootNode.getNames().length))
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@ package de.kentoj.kencommandapi;
|
|||
import com.velocitypowered.api.command.CommandSource;
|
||||
import com.velocitypowered.api.command.SimpleCommand;
|
||||
import de.kentoj.kencommandapi.api.CommandHandler;
|
||||
import de.kentoj.kencommandapi.api.node.RootCommandNode;
|
||||
import de.kentoj.kencommandapi.api.literal.RootLiteral;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
|
||||
import java.util.List;
|
||||
|
|
@ -12,7 +12,7 @@ import java.util.List;
|
|||
public class VelocityCommand implements SimpleCommand {
|
||||
|
||||
private final CommandHandler<CommandSource> commandHandler;
|
||||
private final RootCommandNode<CommandSource> rootNode;
|
||||
private final RootLiteral<CommandSource> rootNode;
|
||||
|
||||
@Override
|
||||
public void execute(Invocation invocation) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue