Interface JSONComponentSerializer.Builder
- Enclosing interface:
- JSONComponentSerializer
public static interface JSONComponentSerializer.Builder
A builder for
JSONComponentSerializer instances that delegates to the active serializer.- Since:
- 4.14.0
-
Method Summary
Modifier and TypeMethodDescription@NotNull JSONComponentSerializerbuild()Create a finished serializer instance.@NotNull JSONComponentSerializer.BuilderDeprecated.@NotNull JSONComponentSerializer.BuildereditOptions(@NotNull Consumer<net.kyori.option.OptionState.Builder> optionEditor) Edit the active set of serializer options.@NotNull JSONComponentSerializer.BuilderDeprecated.for removal since 4.15.0, change theJSONOptions.EMIT_HOVER_EVENT_TYPEflag instead@NotNull JSONComponentSerializer.BuilderlegacyHoverEventSerializer(@Nullable LegacyHoverEventSerializer serializer) Sets a serializer that will be used to interpret legacy hover eventvaluepayloads.@NotNull JSONComponentSerializer.Builderoptions(@NotNull net.kyori.option.OptionState flags) Set the option state to apply on this serializer.
-
Method Details
-
options
@NotNull @NotNull JSONComponentSerializer.Builder options(@NotNull @NotNull net.kyori.option.OptionState flags) Set the option state to apply on this serializer.This controls how the serializer emits and interprets components.
- Parameters:
flags- the flag set to use- Returns:
- this builder
- Since:
- 4.15.0
- See Also:
-
editOptions
@NotNull @NotNull JSONComponentSerializer.Builder editOptions(@NotNull @NotNull Consumer<net.kyori.option.OptionState.Builder> optionEditor) Edit the active set of serializer options.- Parameters:
optionEditor- the consumer operating on the existing flag set- Returns:
- this builder
- Since:
- 4.15.0
- See Also:
-
downsampleColors
Deprecated.for removal since 4.15.0, change theJSONOptions.EMIT_RGBflag insteadSets that the serializer should downsample hex colors to named colors.- Returns:
- this builder
- Since:
- 4.14.0
-
legacyHoverEventSerializer
@NotNull @NotNull JSONComponentSerializer.Builder legacyHoverEventSerializer(@Nullable @Nullable LegacyHoverEventSerializer serializer) Sets a serializer that will be used to interpret legacy hover eventvaluepayloads. If the serializer isnull, then onlyHoverEvent.Action.SHOW_TEXTlegacy hover events can be deserialized.- Parameters:
serializer- serializer- Returns:
- this builder
- Since:
- 4.14.0
-
emitLegacyHoverEvent
Deprecated.for removal since 4.15.0, change theJSONOptions.EMIT_HOVER_EVENT_TYPEflag insteadOutput a legacy hover eventvaluein addition to the moderncontents.A
legacy hover serializermust also be set to serialize any hover events beyond those with actionHoverEvent.Action.SHOW_TEXT- Returns:
- this builder
- Since:
- 4.14.0
-
build
Create a finished serializer instance.- Returns:
- the new serializer
- Since:
- 4.14.0
-
JSONOptions.EMIT_RGBflag instead