Interface MiniMessage
- All Superinterfaces:
ComponentDecoder<String,
,Component> ComponentEncoder<Component,
,String> ComponentSerializer<Component,
Component, String>
This class allows you to serialize and deserialize them, strip or escape them.
- Since:
- 4.10.0
-
Nested Class Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic MiniMessage.Builder
builder()
Creates a newMiniMessage.Builder
.@NotNull Component
deserialize
(@NotNull String input, @NotNull Pointered target) Deserializes a string into a component, with a target.@NotNull Component
deserialize
(@NotNull 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 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 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 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 String input) Deserializes a string into a tree of parsed elements.@NotNull Node.Root
deserializeToTree
(@NotNull String input, @NotNull Pointered target) Deserializes a string into a tree of parsed elements, with a target.@NotNull Node.Root
deserializeToTree
(@NotNull 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 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 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 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 String
escapeTags
(@NotNull String input) Escapes all known tags in the input message, so that they are ignored in deserialization.@NotNull String
escapeTags
(@NotNull String input, @NotNull TagResolver tagResolver) Escapes all known tags in the input message, so that they are ignored in deserialization.default @NotNull String
escapeTags
(@NotNull String input, @NotNull TagResolver... tagResolvers) Escapes all known tags in the input message, so that they are ignored in deserialization.static @NotNull MiniMessage
Gets a simple instance with default settings.boolean
strict()
Returns if this MiniMessage instance is in strict mode.@NotNull String
Removes all supported tags in the input message.@NotNull String
stripTags
(@NotNull String input, @NotNull TagResolver tagResolver) Removes all known tags in the input message, so that they are ignored in deserialization.default @NotNull String
stripTags
(@NotNull 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.Methods inherited from interface net.kyori.adventure.text.serializer.ComponentSerializer
deseializeOrNull, deserialize, deserializeOr, deserializeOrNull, serialize, serializeOr, serializeOrNull
-
Method Details
-
miniMessage
Gets a simple instance with default settings.- Returns:
- a simple instance
- Since:
- 4.10.0
-
escapeTags
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 tagstagResolver
- 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 tagstagResolvers
- 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
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 tagstagResolver
- 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 tagstagResolvers
- 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 Pointered target) Deserializes a string into a component, with a target.- Parameters:
input
- the input stringtarget
- the target of the deserialization- Returns:
- the output component
- Since:
- 4.17.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 stringtagResolver
- the tag resolver for any additional tags to handle- Returns:
- the output component
- Since:
- 4.10.0
-
deserialize
@NotNull @NotNull Component deserialize(@NotNull @NotNull 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 stringtarget
- the target of the deserializationtagResolver
- 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 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 stringtagResolvers
- 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 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 stringtarget
- the target of the deserializationtagResolvers
- a series of tag resolvers to apply extra tags from, last specified taking priority- Returns:
- the output component
- Since:
- 4.17.0
-
deserializeToTree
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 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 stringtarget
- the target of the deserialization- Returns:
- the root of the resulting tree
- Since:
- 4.17.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 stringtagResolver
- 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 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 stringtarget
- the target of the deserializationtagResolver
- 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 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 stringtagResolvers
- 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 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 stringtarget
- the target of the deserializationtagResolvers
- 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:
-
tags
Returns the base tag resolver of this MiniMessage instance.- Returns:
- the base tag resolver
- Since:
- 4.15.0
-
builder
Creates a newMiniMessage.Builder
.- Returns:
- a builder
- Since:
- 4.10.0
-