Interface LegacyHoverEventSerializer


public interface LegacyHoverEventSerializer
Adapter to convert between modern and legacy hover event formats.
Since:
4.0.0
  • Method Summary

    Modifier and Type Method Description
    @NonNull net.kyori.adventure.text.event.HoverEvent.ShowEntity deserializeShowEntity​(@NonNull net.kyori.adventure.text.Component input, net.kyori.adventure.util.Codec.Decoder<net.kyori.adventure.text.Component,​String,​? extends RuntimeException> componentDecoder)
    Convert a legacy hover event show_entity value to its modern format.
    @NonNull net.kyori.adventure.text.event.HoverEvent.ShowItem deserializeShowItem​(@NonNull net.kyori.adventure.text.Component input)
    Convert a legacy hover event show_item value to its modern format.
    @NonNull net.kyori.adventure.text.Component serializeShowEntity​(@NonNull net.kyori.adventure.text.event.HoverEvent.ShowEntity input, net.kyori.adventure.util.Codec.Encoder<net.kyori.adventure.text.Component,​String,​? extends RuntimeException> componentEncoder)
    Convert a modern hover event show_entity value to its legacy format.
    @NonNull net.kyori.adventure.text.Component serializeShowItem​(@NonNull net.kyori.adventure.text.event.HoverEvent.ShowItem input)
    Convert a modern hover event show_item value to its legacy format.
  • Method Details

    • deserializeShowItem

      @NonNull net.kyori.adventure.text.event.HoverEvent.ShowItem deserializeShowItem​(@NonNull net.kyori.adventure.text.Component input) throws IOException
      Convert a legacy hover event show_item value to its modern format.
      Parameters:
      input - component whose plain-text value is a SNBT string
      Returns:
      the deserialized event
      Throws:
      IOException - if the input is improperly formatted
      Since:
      4.0.0
    • deserializeShowEntity

      @NonNull net.kyori.adventure.text.event.HoverEvent.ShowEntity deserializeShowEntity​(@NonNull net.kyori.adventure.text.Component input, net.kyori.adventure.util.Codec.Decoder<net.kyori.adventure.text.Component,​String,​? extends RuntimeException> componentDecoder) throws IOException
      Convert a legacy hover event show_entity value to its modern format.
      Parameters:
      input - component whose plain-text value is a SNBT string
      componentDecoder - A decoder that can take a JSON string and return a deserialized component
      Returns:
      the deserialized event
      Throws:
      IOException - if the input is improperly formatted
      Since:
      4.0.0
    • serializeShowItem

      @NonNull net.kyori.adventure.text.Component serializeShowItem​(@NonNull net.kyori.adventure.text.event.HoverEvent.ShowItem input) throws IOException
      Convert a modern hover event show_item value to its legacy format.
      Parameters:
      input - modern hover event
      Returns:
      component with the legacy value as a SNBT string
      Throws:
      IOException - if the input is improperly formatted
      Since:
      4.0.0
    • serializeShowEntity

      @NonNull net.kyori.adventure.text.Component serializeShowEntity​(@NonNull net.kyori.adventure.text.event.HoverEvent.ShowEntity input, net.kyori.adventure.util.Codec.Encoder<net.kyori.adventure.text.Component,​String,​? extends RuntimeException> componentEncoder) throws IOException
      Convert a modern hover event show_entity value to its legacy format.
      Parameters:
      input - modern hover event
      componentEncoder - An encoder that can take a Component and return a JSON string
      Returns:
      component with the legacy value as a SNBT string
      Throws:
      IOException - if the input is improperly formatted
      Since:
      4.0.0