Interface LegacyComponentSerializer
- All Superinterfaces:
Buildable<LegacyComponentSerializer,
,LegacyComponentSerializer.Builder> ComponentDecoder<String,
,TextComponent> ComponentEncoder<Component,
,String> ComponentSerializer<Component,
TextComponent, String>
public interface LegacyComponentSerializer
extends ComponentSerializer<Component,TextComponent,String>, Buildable<LegacyComponentSerializer,LegacyComponentSerializer.Builder>
A legacy component serializer.
Legacy does not support more complex features such as, but not limited
to, ClickEvent
and HoverEvent
.
- Since:
- 4.0.0
-
Nested Class Summary
Modifier and TypeInterfaceDescriptionstatic interface
A builder forLegacyComponentSerializer
.static interface
ALegacyComponentSerializer
service provider. -
Field Summary
Modifier and TypeFieldDescriptionstatic final char
The legacy character frequently used by configurations and commands.static final char
The legacy character used to prefix hex colors.static final char
The legacy character used by Minecraft. -
Method Summary
Modifier and TypeMethodDescriptionstatic @NotNull LegacyComponentSerializer.Builder
builder()
Creates a newLegacyComponentSerializer.Builder
.@NotNull TextComponent
deserialize
(@NotNull String input) Deserialize a component from a legacyString
.static @NotNull LegacyComponentSerializer
legacy
(char legacyCharacter) Gets a component serializer for legacy-based serialization and deserialization.static @NotNull LegacyComponentSerializer
Gets a component serializer for legacy-based serialization and deserialization.static @NotNull LegacyComponentSerializer
Gets a component serializer for legacy-based serialization and deserialization.static @Nullable LegacyFormat
parseChar
(char character) Converts a legacy character (0123456789abcdefklmnor
) to a legacy format, when possible.@NotNull String
Serializes a component into a legacyString
.Methods inherited from interface net.kyori.adventure.text.serializer.ComponentSerializer
deseializeOrNull, deserializeOr, deserializeOrNull, serializeOr, serializeOrNull
-
Field Details
-
SECTION_CHAR
static final char SECTION_CHARThe legacy character used by Minecraft. ('ยง')- Since:
- 4.0.0
- See Also:
-
AMPERSAND_CHAR
static final char AMPERSAND_CHARThe legacy character frequently used by configurations and commands. ('&')- Since:
- 4.0.0
- See Also:
-
HEX_CHAR
static final char HEX_CHARThe legacy character used to prefix hex colors. ('#')- Since:
- 4.0.0
- See Also:
-
-
Method Details
-
legacySection
Gets a component serializer for legacy-based serialization and deserialization. Note that this serializer works exactly like vanilla Minecraft and does not detect any links. If you want to detect and make URLs clickable, useLegacyComponentSerializer.Builder.extractUrls()
.The returned serializer uses the
section
character.- Returns:
- a component serializer for legacy serialization and deserialization
- Since:
- 4.0.0
-
legacyAmpersand
Gets a component serializer for legacy-based serialization and deserialization. Note that this serializer works exactly like vanilla Minecraft and does not detect any links. If you want to detect and make URLs clickable, useLegacyComponentSerializer.Builder.extractUrls()
.The returned serializer uses the
ampersand
character.- Returns:
- a component serializer for legacy serialization and deserialization
- Since:
- 4.0.0
-
legacy
Gets a component serializer for legacy-based serialization and deserialization. Note that this serializer works exactly like vanilla Minecraft and does not detect any links. If you want to detect and make URLs clickable, useLegacyComponentSerializer.Builder.extractUrls()
.- Parameters:
legacyCharacter
- the legacy character to use- Returns:
- a component serializer for legacy serialization and deserialization
- Since:
- 4.0.0
-
parseChar
Converts a legacy character (0123456789abcdefklmnor
) to a legacy format, when possible.- Parameters:
character
- the legacy character- Returns:
- the legacy format
- Since:
- 4.0.0
-
builder
Creates a newLegacyComponentSerializer.Builder
.- Returns:
- the builder
- Since:
- 4.0.0
-
deserialize
Deserialize a component from a legacyString
.- Specified by:
deserialize
in interfaceComponentDecoder<String,
TextComponent> - Specified by:
deserialize
in interfaceComponentSerializer<Component,
TextComponent, String> - Parameters:
input
- the input- Returns:
- the component
-
serialize
Serializes a component into a legacyString
.- Specified by:
serialize
in interfaceComponentEncoder<Component,
String> - Specified by:
serialize
in interfaceComponentSerializer<Component,
TextComponent, String> - Parameters:
component
- the component- Returns:
- the string
-