Interface ContextResolver<T>

Type Parameters:
T - The resolved type

public interface ContextResolver<T>
A resolver for resolving values that are, by default, resolvable through the command invocation context, and do not need any data from the arguments to find the value. An example context resolver is finding the sender's world.
  • Method Details

    • resolve

      T resolve(@NotNull @NotNull ContextResolver.ContextResolverContext context) throws Throwable
      Resolves the value of this resolver
      Parameters:
      context - The command resolving context.
      Returns:
      The resolved value. May or may not be null.
      Throws:
      Throwable
    • of

      static <T> ContextResolver<T> of(@NotNull T value)
      Returns a context resolver that returns a static value. This is a simpler way for adding constant values without having to deal with lambdas.
      Type Parameters:
      T - The value type
      Parameters:
      value - The value to return
      Returns:
      The context resolver
      Since:
      1.3.0
    • of

      static <T> ContextResolver<T> of(@NotNull @NotNull Supplier<T> value)
      Returns a context resolver that returns a supplier value. This is a simpler way for adding values without having to deal with lambdas.
      Type Parameters:
      T - The value type
      Parameters:
      value - The value supplier
      Returns:
      The context resolver
      Since:
      1.3.0