All Downloads are FREE. Search and download functionalities are using the official Maven repository.

ru.cwcode.commands.extra.builder.DeleteCommandBuilder Maven / Gradle / Ivy

package ru.cwcode.commands.extra.builder;

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.ExtraExecutor;

import java.util.function.BiConsumer;

public class DeleteCommandBuilder extends CommandBuilder {
  BiConsumer onExecute;
  
  public DeleteCommandBuilder(RepositoryAccessor builder) {
    super(builder);
  }
  
  public DeleteCommandBuilder onExecute(BiConsumer onExecute) {
    this.onExecute = onExecute;
    return this;
  }
  
  @Override
  public void register(Command command) {
    command.arguments(
       new ArgumentSet(new ExtraExecutor<>(repositoryAccessor, (s, e, __) -> onExecute.accept(s, e), 1),
                       new ExactStringArg("delete"),
                       repositoryAccessor.keyArgument()));
  }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy