Interface MiniMessage

    • Method Summary

      All Methods Static Methods Instance Methods Abstract Methods Default Methods 
      Modifier and Type Method Description
      static MiniMessage.Builder builder()
      Creates a new MiniMessage.Builder.
      @NotNull Component deserialize​(@NotNull java.lang.String input, @NotNull Pointered target)
      Deserializes a string into a component, with a target.
      @NotNull Component deserialize​(@NotNull java.lang.String input, @NotNull Pointered target, @NotNull TagResolver tagResolver)
      Deserializes a string into a component, with a tag resolver to parse tags of the form <key> and a target.
      default @NotNull Component deserialize​(@NotNull java.lang.String input, @NotNull Pointered target, @NotNull TagResolver... tagResolvers)
      Deserializes a string into a component, with tag resolvers to parse tags of the form <key> and a target.
      @NotNull Component deserialize​(@NotNull java.lang.String input, @NotNull TagResolver tagResolver)
      Deserializes a string into a component, with a tag resolver to parse tags of the form <key>.
      default @NotNull Component deserialize​(@NotNull java.lang.String input, @NotNull TagResolver... tagResolvers)
      Deserializes a string into a component, with tag resolvers to parse tags of the form <key>.
      @NotNull Node.Root deserializeToTree​(@NotNull java.lang.String input)
      Deserializes a string into a tree of parsed elements.
      @NotNull Node.Root deserializeToTree​(@NotNull java.lang.String input, @NotNull Pointered target)
      Deserializes a string into a tree of parsed elements, with a target.
      @NotNull Node.Root deserializeToTree​(@NotNull java.lang.String input, @NotNull Pointered target, @NotNull TagResolver tagResolver)
      Deserializes a string into a tree of parsed elements, with a tag resolver to parse tags of the form <key> and a target.
      default @NotNull Node.Root deserializeToTree​(@NotNull java.lang.String input, @NotNull Pointered target, @NotNull TagResolver... tagResolvers)
      Deserializes a string into a tree of parsed elements, with a tag resolver to parse tags of the form <key>.
      @NotNull Node.Root deserializeToTree​(@NotNull java.lang.String input, @NotNull TagResolver tagResolver)
      Deserializes a string into a tree of parsed elements, with a tag resolver to parse tags of the form <key>.
      default @NotNull Node.Root deserializeToTree​(@NotNull java.lang.String input, @NotNull TagResolver... tagResolvers)
      Deserializes a string into a tree of parsed elements, with a tag resolver to parse tags of the form <key>.
      @NotNull java.lang.String escapeTags​(@NotNull java.lang.String input)
      Escapes all known tags in the input message, so that they are ignored in deserialization.
      @NotNull java.lang.String escapeTags​(@NotNull java.lang.String input, @NotNull TagResolver tagResolver)
      Escapes all known tags in the input message, so that they are ignored in deserialization.
      default @NotNull java.lang.String escapeTags​(@NotNull java.lang.String input, @NotNull TagResolver... tagResolvers)
      Escapes all known tags in the input message, so that they are ignored in deserialization.
      static @NotNull MiniMessage miniMessage()
      Gets a simple instance with default settings.
      boolean strict()
      Returns if this MiniMessage instance is in strict mode.
      @NotNull java.lang.String stripTags​(@NotNull java.lang.String input)
      Removes all supported tags in the input message.
      @NotNull java.lang.String stripTags​(@NotNull java.lang.String input, @NotNull TagResolver tagResolver)
      Removes all known tags in the input message, so that they are ignored in deserialization.
      default @NotNull java.lang.String stripTags​(@NotNull java.lang.String input, @NotNull TagResolver... tagResolvers)
      Removes all known tags in the input message, so that they are ignored in deserialization.
      @NotNull TagResolver tags()
      Returns the base tag resolver of this MiniMessage instance.
    • 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 java.lang.String escapeTags​(@NotNull
                                             @NotNull java.lang.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 java.lang.String escapeTags​(@NotNull
                                             @NotNull java.lang.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 java.lang.String escapeTags​(@NotNull
                                                     @NotNull java.lang.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 java.lang.String stripTags​(@NotNull
                                            @NotNull java.lang.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 java.lang.String stripTags​(@NotNull
                                            @NotNull java.lang.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 java.lang.String stripTags​(@NotNull
                                                    @NotNull java.lang.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 java.lang.String input,
                                       @NotNull
                                       @NotNull Pointered target)
        Deserializes a string into a component, with a target.
        Parameters:
        input - the input string
        target - the target of the deserialization
        Returns:
        the output component
        Since:
        4.17.0
      • deserialize

        @NotNull
        @NotNull Component deserialize​(@NotNull
                                       @NotNull java.lang.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
        @NotNull Component deserialize​(@NotNull
                                       @NotNull java.lang.String input,
                                       @NotNull
                                       @NotNull Pointered target,
                                       @NotNull
                                       @NotNull TagResolver tagResolver)
        Deserializes a string into a component, with a tag resolver to parse tags of the form <key> and a target.

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

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

        @NotNull
        default @NotNull Component deserialize​(@NotNull
                                               @NotNull java.lang.String input,
                                               @NotNull
                                               @NotNull TagResolver... tagResolvers)
        Deserializes a string into a component, with tag resolvers 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
      • deserialize

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

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

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

        @NotNull Node.Root deserializeToTree​(@NotNull
                                             @NotNull java.lang.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 java.lang.String input,
                                             @NotNull
                                             @NotNull Pointered target)
        Deserializes a string into a tree of parsed elements, with a target. This is intended for inspecting the output of the parser for debugging purposes.
        Parameters:
        input - the input string
        target - the target of the deserialization
        Returns:
        the root of the resulting tree
        Since:
        4.17.0
      • deserializeToTree

        @NotNull Node.Root deserializeToTree​(@NotNull
                                             @NotNull java.lang.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

        @NotNull Node.Root deserializeToTree​(@NotNull
                                             @NotNull java.lang.String input,
                                             @NotNull
                                             @NotNull Pointered target,
                                             @NotNull
                                             @NotNull TagResolver tagResolver)
        Deserializes a string into a tree of parsed elements, with a tag resolver to parse tags of the form <key> and a target. 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
        target - the target of the deserialization
        tagResolver - the tag resolver for any additional tags to handle
        Returns:
        the root of the resulting tree
        Since:
        4.17.0
      • deserializeToTree

        default @NotNull Node.Root deserializeToTree​(@NotNull
                                                     @NotNull java.lang.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
      • deserializeToTree

        default @NotNull Node.Root deserializeToTree​(@NotNull
                                                     @NotNull java.lang.String input,
                                                     @NotNull
                                                     @NotNull Pointered target,
                                                     @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
        target - the target of the deserialization
        tagResolvers - a series of tag resolvers to apply extra tags from, last specified taking priority
        Returns:
        the root of the resulting tree
        Since:
        4.17.0
      • strict

        boolean strict()
        Returns if this MiniMessage instance is in strict mode.
        Returns:
        if the instance is in strict mode
        Since:
        4.15.0
        See Also:
        MiniMessage.Builder.strict(boolean)
      • tags

        @NotNull
        @NotNull TagResolver tags()
        Returns the base tag resolver of this MiniMessage instance.
        Returns:
        the base tag resolver
        Since:
        4.15.0