Class JSONOptions


  • public final class JSONOptions
    extends java.lang.Object
    Options that can apply to JSON serializers.

    See serializer documentation for specific details on which flags are supported.

    Since:
    4.15.0
    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
      static class  JSONOptions.HoverEventValueMode
      Configure how to emit hover event values.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      static net.kyori.option.Option<java.lang.Boolean> EMIT_COMPACT_TEXT_COMPONENT
      Whether to emit text components with no style and no children as plain text.
      static net.kyori.option.Option<JSONOptions.HoverEventValueMode> EMIT_HOVER_EVENT_TYPE
      Control how hover event values should be emitted.
      static net.kyori.option.Option<java.lang.Boolean> EMIT_HOVER_SHOW_ENTITY_ID_AS_INT_ARRAY
      Whether to emit the hover event show entity action's entity UUID as an int array, as understood by 1.20.3+, or as a string as understood by previous versions.
      static net.kyori.option.Option<java.lang.Boolean> EMIT_RGB
      Whether to emit RGB text.
      static net.kyori.option.Option<java.lang.Boolean> VALIDATE_STRICT_EVENTS
      Whether to be strict about accepting invalid hover/click events.
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static @NotNull net.kyori.option.OptionState.Versioned byDataVersion()
      Get JSON flags delineated by world data version.
      static @NotNull net.kyori.option.OptionState compatibility()
      The combination of flags that can be understood by modern clients, as well as as far back as possible.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • EMIT_RGB

        public static final net.kyori.option.Option<java.lang.Boolean> EMIT_RGB
        Whether to emit RGB text.

        If this attribute is disabled, colors in styles will be downsampled to the classic 16 colors.

        Since:
        4.15.0
        Since Minecraft:
        1.16
      • EMIT_HOVER_EVENT_TYPE

        public static final net.kyori.option.Option<JSONOptions.HoverEventValueMode> EMIT_HOVER_EVENT_TYPE
        Control how hover event values should be emitted.
        Since:
        4.15.0
      • EMIT_COMPACT_TEXT_COMPONENT

        public static final net.kyori.option.Option<java.lang.Boolean> EMIT_COMPACT_TEXT_COMPONENT
        Whether to emit text components with no style and no children as plain text.
        Since:
        4.15.0
        Since Minecraft:
        1.20.3
      • EMIT_HOVER_SHOW_ENTITY_ID_AS_INT_ARRAY

        public static final net.kyori.option.Option<java.lang.Boolean> EMIT_HOVER_SHOW_ENTITY_ID_AS_INT_ARRAY
        Whether to emit the hover event show entity action's entity UUID as an int array, as understood by 1.20.3+, or as a string as understood by previous versions.
        Since:
        4.15.0
      • VALIDATE_STRICT_EVENTS

        public static final net.kyori.option.Option<java.lang.Boolean> VALIDATE_STRICT_EVENTS
        Whether to be strict about accepting invalid hover/click events.

        When enabled, this matches Vanilla as of 1.20.3.

        Since:
        4.15.0
    • Method Detail

      • byDataVersion

        public static @NotNull net.kyori.option.OptionState.Versioned byDataVersion()
        Get JSON flags delineated by world data version.
        Returns:
        the versioned flag set
        Since:
        4.15.0
      • compatibility

        @NotNull
        public static @NotNull net.kyori.option.OptionState compatibility()
        The combination of flags that can be understood by modern clients, as well as as far back as possible.

        This may provide a less efficient representation of components.

        Returns:
        the most widely compatible feature flag set
        Since:
        4.15.0