ru.cwcode.commands.extra.builder.CreateCommandBuilder Maven / Gradle / Ivy
package ru.cwcode.commands.extra.builder;
import ru.cwcode.commands.Argument;
import ru.cwcode.commands.ArgumentParser;
import ru.cwcode.commands.ArgumentSet;
import ru.cwcode.commands.Command;
import ru.cwcode.commands.api.Sender;
import ru.cwcode.commands.arguments.ExactStringArg;
import ru.cwcode.commands.extra.RepositoryAccessor;
import ru.cwcode.commands.extra.command.executor.SimpleExecutor;
import java.util.function.BiConsumer;
public class CreateCommandBuilder extends CommandBuilder {
BiConsumer onExecute;
private Argument[] arguments;
public CreateCommandBuilder(RepositoryAccessor builder) {
super(builder);
}
public CreateCommandBuilder fields(A... arguments) {
this.arguments = arguments;
return this;
}
public CreateCommandBuilder onExecute(BiConsumer onExecute) {
this.onExecute = onExecute;
return this;
}
@Override
public void register(Command command) {
command.arguments(
new ArgumentSet(new SimpleExecutor((s, argumentParser) -> onExecute.accept(argumentParser, s)),
new ExactStringArg("create"),
arguments));
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy