Class AdventureComponentConverter

java.lang.Object
com.comphenix.protocol.wrappers.AdventureComponentConverter

public class AdventureComponentConverter extends Object
Utility class for converting between the Adventure API Component and ProtocolLib's wrapper

Note: The Adventure API Component is not included in CraftBukkit, Bukkit or Spigot and but is present in PaperMC.

  • Method Details

    • fromWrapper

      public static net.kyori.adventure.text.Component fromWrapper(WrappedChatComponent wrapper)
      Converts a WrappedChatComponent into a Component
      Parameters:
      wrapper - ProtocolLib wrapper
      Returns:
      Component
    • fromWrapperAsObject

      public static Object fromWrapperAsObject(WrappedChatComponent wrapper)
      Converts a WrappedChatComponent into a Component
      Parameters:
      wrapper - ProtocolLib wrapper
      Returns:
      Component
    • fromJson

      public static net.kyori.adventure.text.Component fromJson(String json)
      Converts a JSON String into a Component
      Parameters:
      json - Json String
      Returns:
      Component
    • fromJsonAsObject

      public static Object fromJsonAsObject(String json)
      Converts a JSON String into a Component object
      Parameters:
      json - Json String
      Returns:
      Component object
    • fromComponent

      public static WrappedChatComponent fromComponent(net.kyori.adventure.text.Component component)
      Converts a Component into a ProtocolLib wrapper
      Parameters:
      component - Component
      Returns:
      ProtocolLib wrapper
    • fromComponentObject

      public static WrappedChatComponent fromComponentObject(Object component)
      Converts an object that is instance of Component into a ProtocolLib wrapper
      Parameters:
      component - Component
      Returns:
      ProtocolLib wrapper
    • fromWrapper

      public static net.kyori.adventure.text.format.Style fromWrapper(WrappedComponentStyle wrapper)
      Converts a WrappedComponentStyle into a Style
      Parameters:
      wrapper - ProtocolLib wrapper
      Returns:
      Style
    • fromStyle

      public static WrappedComponentStyle fromStyle(net.kyori.adventure.text.format.Style style)
      Converts a Style into a ProtocolLib wrapper
      Parameters:
      style - Style
      Returns:
      ProtocolLib wrapper
    • getComponentClass

      public static Class<?> getComponentClass()
    • clone

      public static net.kyori.adventure.text.Component clone(Object component)