Interface SenderMapper<B,M>

Type Parameters:
B - base command sender type
M - mapped command sender type

@API(status=STABLE) public interface SenderMapper<B,M>
Mapper than can transform command senders from a base type to another type and back.
  • Method Details

    • map

      @NonNull M map(@NonNull B base)
      Maps a command sender to another type.
      Parameters:
      base - base command sender
      Returns:
      mapped command sender
    • reverse

      @NonNull B reverse(@NonNull M mapped)
      Reverses a mapped command sender to it's base type.
      Parameters:
      mapped - mapped command sender
      Returns:
      base command sender
    • create

      static <B, M> @NonNull SenderMapper<B,M> create(@NonNull Function<@NonNull B,@NonNull M> map, @NonNull Function<@NonNull M,@NonNull B> reverse)
      Creates a new sender mapper from the provided functions.
      Type Parameters:
      B - base command sender type
      M - mapped command sender type
      Parameters:
      map - mapping function
      reverse - reverse mapping function
      Returns:
      new sender mapper
    • identity

      static <S> @NonNull SenderMapper<S,S> identity()
      Returns the identity mapper, a mapper that does not transform the sender.
      Type Parameters:
      S - base and mapped command sender type
      Returns:
      identity mapper