Class ImmutableMinecraftHelp<C>

java.lang.Object
org.incendo.cloud.minecraft.extras.MinecraftHelp<C>
org.incendo.cloud.minecraft.extras.ImmutableMinecraftHelp<C>

@Generated(from="MinecraftHelp", generator="Immutables") @Generated("org.immutables.processor.ProxyProcessor") @API(status=STABLE, consumers="org.incendo.cloud.*") public final class ImmutableMinecraftHelp<C> extends MinecraftHelp<C>
Immutable implementation of MinecraftHelp.

Use the builder to create immutable instances: ImmutableMinecraftHelp.builder(). Use the static factory method to create immutable instances: ImmutableMinecraftHelp.of().

  • Method Details

    • commandManager

      public @NonNull CommandManager<C> commandManager()
      Returns the command manager instance.
      Specified by:
      commandManager in class MinecraftHelp<C>
      Returns:
      command manager
    • audienceProvider

      public @NonNull AudienceProvider<C> audienceProvider()
      Returns the audience provider that was used to create this instance.
      Specified by:
      audienceProvider in class MinecraftHelp<C>
      Returns:
      audience provider
    • commandPrefix

      public @NonNull String commandPrefix()
      Returns the command prefix.
      Specified by:
      commandPrefix in class MinecraftHelp<C>
      Returns:
      command prefix
      Since:
      2.0.0
    • helpHandler

      public @NonNull HelpHandler<C> helpHandler()
      Returns the help handler.
      Overrides:
      helpHandler in class MinecraftHelp<C>
      Returns:
      the help handler
      Since:
      2.0.0
    • commandFilter

      public @NonNull CommandPredicate<C> commandFilter()
      Returns the filter that determines what commands are visible inside the help menu.

      The default filter is CommandPredicate.acceptAll().

      Overrides:
      commandFilter in class MinecraftHelp<C>
      Returns:
      the filter
      Since:
      2.0.0
    • descriptionDecorator

      public @NonNull MinecraftHelp.DescriptionDecorator<C> descriptionDecorator()
      Returns the description decorator which turns descriptions into components.

      The default decorator is MinecraftHelp.DescriptionDecorator.text().

      Overrides:
      descriptionDecorator in class MinecraftHelp<C>
      Returns:
      the decorator
      Since:
      2.0.0
    • messages

      public @NonNull Map<String,String> messages()
      Returns the messages which are used by the default MinecraftHelp.MessageProvider.

      Placeholders in the format <name> will be replaced.

      Specified by:
      messages in class MinecraftHelp<C>
      Returns:
      the messages
      Since:
      2.0.0
    • messageProvider

      public @NonNull MinecraftHelp.MessageProvider<C> messageProvider()
      Returns the message provider which is used to retrieve messages from message keys.

      The keys are constants in MinecraftHelp.

      Overrides:
      messageProvider in class MinecraftHelp<C>
      Returns:
      the message provider
      Since:
      2.0.0
    • colors

      Returns the colors used for help messages.

      Defaults to MinecraftHelp.DEFAULT_HELP_COLORS.

      Overrides:
      colors in class MinecraftHelp<C>
      Returns:
      the active MinecraftHelp.HelpColors
      Since:
      2.0.0
    • headerFooterLength

      public @org.checkerframework.checker.index.qual.NonNegative int headerFooterLength()
      Returns the length of the header/footer of help menus.

      Defaults to MinecraftHelp.DEFAULT_HEADER_FOOTER_LENGTH.

      Overrides:
      headerFooterLength in class MinecraftHelp<C>
      Returns:
      the length
      Since:
      2.0.0
    • maxResultsPerPage

      public @org.checkerframework.checker.index.qual.NonNegative int maxResultsPerPage()
      Returns the maximum number of help results to display on a page.

      Defaults to MinecraftHelp.DEFAULT_MAX_RESULTS_PER_PAGE.

      Overrides:
      maxResultsPerPage in class MinecraftHelp<C>
      Returns:
      the maximum number of results
      Since:
      2.0.0
    • withCommandManager

      public final ImmutableMinecraftHelp<C> withCommandManager(@NonNull CommandManager<C> value)
      Copy the current immutable object by setting a value for the commandManager attribute. A shallow reference equality check is used to prevent copying of the same value by returning this.
      Parameters:
      value - A new value for commandManager
      Returns:
      A modified copy or the this object
    • withAudienceProvider

      public final ImmutableMinecraftHelp<C> withAudienceProvider(@NonNull AudienceProvider<C> value)
      Copy the current immutable object by setting a value for the audienceProvider attribute. A shallow reference equality check is used to prevent copying of the same value by returning this.
      Parameters:
      value - A new value for audienceProvider
      Returns:
      A modified copy or the this object
    • withCommandPrefix

      public final ImmutableMinecraftHelp<C> withCommandPrefix(@NonNull String value)
      Copy the current immutable object by setting a value for the commandPrefix attribute. An equals check used to prevent copying of the same value by returning this.
      Parameters:
      value - A new value for commandPrefix
      Returns:
      A modified copy or the this object
    • withCommandFilter

      public final ImmutableMinecraftHelp<C> withCommandFilter(@NonNull CommandPredicate<C> value)
      Copy the current immutable object by setting a value for the commandFilter attribute. A shallow reference equality check is used to prevent copying of the same value by returning this.
      Parameters:
      value - A new value for commandFilter
      Returns:
      A modified copy or the this object
    • withDescriptionDecorator

      public final ImmutableMinecraftHelp<C> withDescriptionDecorator(@NonNull MinecraftHelp.DescriptionDecorator<C> value)
      Copy the current immutable object by setting a value for the descriptionDecorator attribute. A shallow reference equality check is used to prevent copying of the same value by returning this.
      Parameters:
      value - A new value for descriptionDecorator
      Returns:
      A modified copy or the this object
    • withMessages

      public final ImmutableMinecraftHelp<C> withMessages(Map<String,? extends String> entries)
      Copy the current immutable object by replacing the messages map with the specified map. Nulls are not permitted as keys or values. A shallow reference equality check is used to prevent copying of the same value by returning this.
      Parameters:
      entries - The entries to replace the messages map
      Returns:
      A modified copy or this if not changed
    • withMessageProvider

      public final ImmutableMinecraftHelp<C> withMessageProvider(@NonNull MinecraftHelp.MessageProvider<C> value)
      Copy the current immutable object by setting a value for the messageProvider attribute. A shallow reference equality check is used to prevent copying of the same value by returning this.
      Parameters:
      value - A new value for messageProvider
      Returns:
      A modified copy or the this object
    • withColors

      public final ImmutableMinecraftHelp<C> withColors(@NonNull MinecraftHelp.HelpColors value)
      Copy the current immutable object by setting a value for the colors attribute. A shallow reference equality check is used to prevent copying of the same value by returning this.
      Parameters:
      value - A new value for colors
      Returns:
      A modified copy or the this object
    • withHeaderFooterLength

      public final ImmutableMinecraftHelp<C> withHeaderFooterLength(@org.checkerframework.checker.index.qual.NonNegative int value)
      Copy the current immutable object by setting a value for the headerFooterLength attribute. A value equality check is used to prevent copying of the same value by returning this.
      Parameters:
      value - A new value for headerFooterLength
      Returns:
      A modified copy or the this object
    • withMaxResultsPerPage

      public final ImmutableMinecraftHelp<C> withMaxResultsPerPage(@org.checkerframework.checker.index.qual.NonNegative int value)
      Copy the current immutable object by setting a value for the maxResultsPerPage attribute. A value equality check is used to prevent copying of the same value by returning this.
      Parameters:
      value - A new value for maxResultsPerPage
      Returns:
      A modified copy or the this object
    • equals

      public boolean equals(Object another)
      This instance is equal to all instances of ImmutableMinecraftHelp that have equal attribute values.
      Overrides:
      equals in class Object
      Returns:
      true if this is equal to another instance
    • hashCode

      public int hashCode()
      Computes a hash code from attributes: commandManager, audienceProvider, commandPrefix, helpHandler, commandFilter, descriptionDecorator, messages, messageProvider, colors, headerFooterLength, maxResultsPerPage.
      Overrides:
      hashCode in class Object
      Returns:
      hashCode value
    • toString

      public String toString()
      Prints the immutable value MinecraftHelp with attribute values.
      Overrides:
      toString in class Object
      Returns:
      A string representation of the value
    • of

      public static <C> ImmutableMinecraftHelp<C> of(@NonNull CommandManager<C> commandManager, @NonNull AudienceProvider<C> audienceProvider, @NonNull String commandPrefix, @NonNull CommandPredicate<C> commandFilter, @NonNull MinecraftHelp.DescriptionDecorator<C> descriptionDecorator, Map<String,? extends String> messages, @NonNull MinecraftHelp.MessageProvider<C> messageProvider, @NonNull MinecraftHelp.HelpColors colors, @org.checkerframework.checker.index.qual.NonNegative int headerFooterLength, @org.checkerframework.checker.index.qual.NonNegative int maxResultsPerPage)
      Construct a new immutable MinecraftHelp instance.
      Type Parameters:
      C - generic parameter C
      Parameters:
      commandManager - The value for the commandManager attribute
      audienceProvider - The value for the audienceProvider attribute
      commandPrefix - The value for the commandPrefix attribute
      commandFilter - The value for the commandFilter attribute
      descriptionDecorator - The value for the descriptionDecorator attribute
      messages - The value for the messages attribute
      messageProvider - The value for the messageProvider attribute
      colors - The value for the colors attribute
      headerFooterLength - The value for the headerFooterLength attribute
      maxResultsPerPage - The value for the maxResultsPerPage attribute
      Returns:
      An immutable MinecraftHelp instance
    • copyOf

      public static <C> ImmutableMinecraftHelp<C> copyOf(MinecraftHelp<C> instance)
      Creates an immutable copy of a MinecraftHelp value. Uses accessors to get values to initialize the new immutable instance. If an instance is already immutable, it is returned as is.
      Type Parameters:
      C - generic parameter C
      Parameters:
      instance - The instance to copy
      Returns:
      A copied immutable MinecraftHelp instance
    • builder

      public static <C> ImmutableMinecraftHelp.CommandManagerBuildStage<C> builder()
      Creates a builder for ImmutableMinecraftHelp.
       ImmutableMinecraftHelp.<C>builder()
          .commandManager(org.incendo.cloud.CommandManager<C>) // required commandManager
          .audienceProvider(org.incendo.cloud.minecraft.extras.AudienceProvider<C>) // required audienceProvider
          .commandPrefix(String) // required commandPrefix
          .commandFilter(org.incendo.cloud.help.CommandPredicate<C>) // optional commandFilter
          .descriptionDecorator(org.incendo.cloud.minecraft.extras.MinecraftHelp.DescriptionDecorator<C>) // optional descriptionDecorator
          .messages|messages(String => String) // messages mappings
          .messageProvider(org.incendo.cloud.minecraft.extras.MinecraftHelp.MessageProvider<C>) // optional messageProvider
          .colors(org.incendo.cloud.minecraft.extras.MinecraftHelp.HelpColors) // optional colors
          .headerFooterLength(int) // optional headerFooterLength
          .maxResultsPerPage(int) // optional maxResultsPerPage
          .build();
       
      Type Parameters:
      C - generic parameter C
      Returns:
      A new ImmutableMinecraftHelp builder