Interface RequirementBindings<C,R extends Requirement<C,R>>

Type Parameters:
C - command sender type
R - requirement type

@API(status=STABLE, since="1.0.0") public interface RequirementBindings<C,R extends Requirement<C,R>>
Utility for binding annotations to requirements.
Since:
1.0.0
  • Method Details

    • create

      static <C, R extends Requirement<C, R>> @NonNull RequirementBindings<C,R> create(@NonNull org.incendo.cloud.annotations.AnnotationParser<C> annotationParser, @NonNull org.incendo.cloud.key.CloudKey<Requirements<C,R>> requirementKey)
      Creates a new RequirementBindings instance.
      Type Parameters:
      C - command sender type
      R - requirement type
      Parameters:
      annotationParser - annotation parser
      requirementKey - key used to store the requirements in the command meta, should be the same as the key supplied to RequirementPostprocessor
      Returns:
      the bindings instance
    • register

      <A extends Annotation> @NonNull RequirementBindings<C,R> register(@NonNull Class<A> annotation, @NonNull Function<A,R> requirement)
      Registers a new binding for the given annotation to the given requirement.
      Type Parameters:
      A - annotation type
      Parameters:
      annotation - annotation class
      requirement - function that returns the requirement
      Returns:
      this