Interface LegacyComponentSerializer.Builder
-
- All Superinterfaces:
AbstractBuilder<LegacyComponentSerializer>
,Buildable.Builder<LegacyComponentSerializer>
- Enclosing interface:
- LegacyComponentSerializer
public static interface LegacyComponentSerializer.Builder extends AbstractBuilder<LegacyComponentSerializer>, Buildable.Builder<LegacyComponentSerializer>
A builder forLegacyComponentSerializer
.- Since:
- 4.0.0
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description @NotNull LegacyComponentSerializer
build()
Builds the serializer.@NotNull LegacyComponentSerializer.Builder
character(char legacyCharacter)
Sets the legacy character used by the serializer.@NotNull LegacyComponentSerializer.Builder
extractUrls()
Sets that the serializer should extract URLs intoClickEvent
s when deserializing.@NotNull LegacyComponentSerializer.Builder
extractUrls(@NotNull java.util.regex.Pattern pattern)
Sets that the serializer should extract URLs intoClickEvent
s when deserializing.@NotNull LegacyComponentSerializer.Builder
extractUrls(@NotNull java.util.regex.Pattern pattern, @Nullable Style style)
Sets that the serializer should extract URLs intoClickEvent
s when deserializing.@NotNull LegacyComponentSerializer.Builder
extractUrls(@Nullable Style style)
Sets that the serializer should extract URLs intoClickEvent
s when deserializing.@NotNull LegacyComponentSerializer.Builder
flattener(@NotNull ComponentFlattener flattener)
Use this component flattener to convert components into plain text.@NotNull LegacyComponentSerializer.Builder
hexCharacter(char legacyHexCharacter)
Sets the legacy hex character used by the serializer.@NotNull LegacyComponentSerializer.Builder
hexColors()
Sets that the serializer should support hex colors.@NotNull LegacyComponentSerializer.Builder
useUnusualXRepeatedCharacterHexFormat()
Sets that the serializer should use the '&x' repeated code format when serializing hex colors.
-
-
-
Method Detail
-
character
@NotNull @NotNull LegacyComponentSerializer.Builder character(char legacyCharacter)
Sets the legacy character used by the serializer.- Parameters:
legacyCharacter
- the legacy character- Returns:
- this builder
- Since:
- 4.0.0
-
hexCharacter
@NotNull @NotNull LegacyComponentSerializer.Builder hexCharacter(char legacyHexCharacter)
Sets the legacy hex character used by the serializer.- Parameters:
legacyHexCharacter
- the legacy hex character.- Returns:
- this builder
- Since:
- 4.0.0
-
extractUrls
@NotNull @NotNull LegacyComponentSerializer.Builder extractUrls()
Sets that the serializer should extract URLs intoClickEvent
s when deserializing.- Returns:
- this builder
- Since:
- 4.0.0
-
extractUrls
@NotNull @NotNull LegacyComponentSerializer.Builder extractUrls(@NotNull @NotNull java.util.regex.Pattern pattern)
Sets that the serializer should extract URLs intoClickEvent
s when deserializing.- Parameters:
pattern
- the url pattern- Returns:
- this builder
- Since:
- 4.2.0
-
extractUrls
@NotNull @NotNull LegacyComponentSerializer.Builder extractUrls(@Nullable @Nullable Style style)
Sets that the serializer should extract URLs intoClickEvent
s when deserializing.- Parameters:
style
- the style to use for extracted links- Returns:
- this builder
- Since:
- 4.0.0
-
extractUrls
@NotNull @NotNull LegacyComponentSerializer.Builder extractUrls(@NotNull @NotNull java.util.regex.Pattern pattern, @Nullable @Nullable Style style)
Sets that the serializer should extract URLs intoClickEvent
s when deserializing.- Parameters:
pattern
- the url patternstyle
- the style to apply to indicate that text is a link- Returns:
- this builder
- Since:
- 4.2.0
-
hexColors
@NotNull @NotNull LegacyComponentSerializer.Builder hexColors()
Sets that the serializer should support hex colors.Otherwise, hex colors are downsampled to the nearest named color.
- Returns:
- this builder
- Since:
- 4.0.0
-
useUnusualXRepeatedCharacterHexFormat
@NotNull @NotNull LegacyComponentSerializer.Builder useUnusualXRepeatedCharacterHexFormat()
Sets that the serializer should use the '&x' repeated code format when serializing hex colors. Note that messages in this format can still be deserialized, even with this option disabled.This is the format adopted by the BungeeCord (and by usage, Spigot) text API.
The format is difficult to manipulate and read, and its use is not recommended. Support is provided for it only to allow plugin developers to use this library alongside parts of the Spigot API which expect legacy strings in this format.
It is recommended to use only when absolutely necessary, and when no better alternatives are available.
- Returns:
- this builder
- Since:
- 4.0.0
-
flattener
@NotNull @NotNull LegacyComponentSerializer.Builder flattener(@NotNull @NotNull ComponentFlattener flattener)
Use this component flattener to convert components into plain text.By default, this serializer will use
ComponentFlattener.basic()
- Parameters:
flattener
- the flattener to use- Returns:
- this builder
- Since:
- 4.7.0
-
build
@NotNull @NotNull LegacyComponentSerializer build()
Builds the serializer.- Specified by:
build
in interfaceAbstractBuilder<LegacyComponentSerializer>
- Specified by:
build
in interfaceBuildable.Builder<LegacyComponentSerializer>
- Returns:
- the built serializer
-
-