23 lines
735 B
Java
23 lines
735 B
Java
package de.kentoj.kencommandapi;
|
|
|
|
import com.velocitypowered.api.command.CommandSource;
|
|
import com.velocitypowered.api.command.SimpleCommand;
|
|
import de.kentoj.kencommandapi.api.nodes.CommandNode;
|
|
import lombok.RequiredArgsConstructor;
|
|
|
|
@RequiredArgsConstructor
|
|
public class VelocityCommand implements SimpleCommand {
|
|
|
|
private final VelocityKenCommandApi commandApi;
|
|
private final CommandNode<CommandSource, VelocityCommandContext> rootNode;
|
|
|
|
@Override
|
|
public void execute(Invocation ctx) {
|
|
commandApi.invoke(rootNode, ctx.source(), ctx.arguments());
|
|
}
|
|
|
|
@Override
|
|
public boolean hasPermission(Invocation ctx) {
|
|
return commandApi.hasPermission(ctx.source(), rootNode.getPermission());
|
|
}
|
|
}
|