Interface DurationFunction<C>

Type Parameters:
C - command sender type
Functional Interface:
This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.

@FunctionalInterface @API(status=STABLE, since="1.0.0") public interface DurationFunction<C>
A function that generates a duration from a command context.
Since:
1.0.0
  • Method Details

    • constant

      static <C> @NonNull DurationFunction<C> constant(@NonNull Duration duration)
      Creates a new duration function that always returns duration.
      Type Parameters:
      C - command sender type
      Parameters:
      duration - constant duration
      Returns:
      the duration function
    • getDuration

      @NonNull Duration getDuration(@NonNull CommandContext<C> context)
      Returns the duration for the given context.
      Parameters:
      context - the context to get the duration for
      Returns:
      the duration