Interface MiniMessage

    • Method Detail

      • miniMessage

        @NotNull
        static @NotNull MiniMessage miniMessage()
        Gets a simple instance with default settings.
        Returns:
        a simple instance
        Since:
        4.10.0
      • escapeTags

        @NotNull
        @NotNull String escapeTags​(@NotNull
                                   @NotNull String input)
        Escapes all known tags in the input message, so that they are ignored in deserialization.

        Useful for untrusted input.

        Only globally known tags will be escaped. Use the overload that takes a TagResolver if any custom tags should be handled.

        Parameters:
        input - the input message, with potential tags
        Returns:
        the output, with escaped tags
        Since:
        4.10.0
      • escapeTags

        @NotNull
        @NotNull String escapeTags​(@NotNull
                                   @NotNull String input,
                                   @NotNull
                                   @NotNull TagResolver tagResolver)
        Escapes all known tags in the input message, so that they are ignored in deserialization.

        Useful for untrusted input.

        Parameters:
        input - the input message, with potential tags
        tagResolver - the tag resolver for any additional tags to handle
        Returns:
        the output, with escaped tags
        Since:
        4.10.0
      • escapeTags

        @NotNull
        default @NotNull String escapeTags​(@NotNull
                                           @NotNull String input,
                                           @NotNull
                                           @NotNull TagResolver... tagResolvers)
        Escapes all known tags in the input message, so that they are ignored in deserialization.

        Useful for untrusted input.

        Parameters:
        input - the input message, with potential tags
        tagResolvers - a series of tag resolvers to apply extra tags from, last specified taking priority
        Returns:
        the output, with escaped tags
        Since:
        4.10.0
      • stripTags

        @NotNull
        @NotNull String stripTags​(@NotNull
                                  @NotNull String input)
        Removes all supported tags in the input message.

        Useful for untrusted input.

        Only globally known tags will be stripped. Use the overload that takes a TagResolver if any custom tags should be handled.

        Parameters:
        input - the input message, with potential tags
        Returns:
        the output, without tags
        Since:
        4.10.0
      • stripTags

        @NotNull
        @NotNull String stripTags​(@NotNull
                                  @NotNull String input,
                                  @NotNull
                                  @NotNull TagResolver tagResolver)
        Removes all known tags in the input message, so that they are ignored in deserialization.

        Useful for untrusted input.

        Parameters:
        input - the input message, with tags
        tagResolver - the tag resolver for any additional tags to handle
        Returns:
        the output, without tags
        Since:
        4.10.0
      • stripTags

        @NotNull
        default @NotNull String stripTags​(@NotNull
                                          @NotNull String input,
                                          @NotNull
                                          @NotNull TagResolver... tagResolvers)
        Removes all known tags in the input message, so that they are ignored in deserialization.

        Useful for untrusted input.

        Parameters:
        input - the input message, with tags
        tagResolvers - a series of tag resolvers to apply extra tags from, last specified taking priority
        Returns:
        the output, without tags
        Since:
        4.10.0
      • deserialize

        @NotNull
        @NotNull Component deserialize​(@NotNull
                                       @NotNull String input,
                                       @NotNull
                                       @NotNull TagResolver tagResolver)
        Deserializes a string into a component, with a tag resolver to parse tags of the form <key>.

        Tags will be resolved from the resolver parameter before the resolver provided in the builder is used.

        Parameters:
        input - the input string
        tagResolver - the tag resolver for any additional tags to handle
        Returns:
        the output component
        Since:
        4.10.0
      • deserialize

        @NotNull
        default @NotNull Component deserialize​(@NotNull
                                               @NotNull String input,
                                               @NotNull
                                               @NotNull TagResolver... tagResolvers)
        Deserializes a string into a component, with a tag resolver to parse tags of the form <key>.

        Tags will be resolved from the resolver parameters before the resolver provided in the builder is used.

        Parameters:
        input - the input string
        tagResolvers - a series of tag resolvers to apply extra tags from, last specified taking priority
        Returns:
        the output component
        Since:
        4.10.0
      • deserializeToTree

        @NotNull Node.Root deserializeToTree​(@NotNull
                                             @NotNull String input)
        Deserializes a string into a tree of parsed elements, This is intended for inspecting the output of the parser for debugging purposes.
        Parameters:
        input - the input string
        Returns:
        the root of the resulting tree
        Since:
        4.10.0
      • deserializeToTree

        @NotNull Node.Root deserializeToTree​(@NotNull
                                             @NotNull String input,
                                             @NotNull
                                             @NotNull TagResolver tagResolver)
        Deserializes a string into a tree of parsed elements, with a tag resolver to parse tags of the form <key>. This is intended for inspecting the output of the parser for debugging purposes.

        Tags will be resolved from the resolver parameter before the resolver provided in the builder is used.

        Parameters:
        input - the input string
        tagResolver - the tag resolver for any additional tags to handle
        Returns:
        the root of the resulting tree
        Since:
        4.10.0
      • deserializeToTree

        default @NotNull Node.Root deserializeToTree​(@NotNull
                                                     @NotNull String input,
                                                     @NotNull
                                                     @NotNull TagResolver... tagResolvers)
        Deserializes a string into a tree of parsed elements, with a tag resolver to parse tags of the form <key>. This is intended for inspecting the output of the parser for debugging purposes.

        Tags will be resolved from the resolver parameter before the resolver provided in the builder is used.

        Parameters:
        input - the input string
        tagResolvers - a series of tag resolvers to apply extra tags from, last specified taking priority
        Returns:
        the root of the resulting tree
        Since:
        4.10.0