java.lang.Object
com.github.stefvanschie.inventoryframework.adventuresupport.TextHolder
com.github.stefvanschie.inventoryframework.adventuresupport.ComponentHolder

public abstract class ComponentHolder extends TextHolder
Wrapper of an Adventure Component.
Since:
0.10.0
  • Field Details

    • value

      @NotNull protected final @NotNull Component value
      The Adventure component this instance wraps.
  • Method Details

    • of

      @NotNull @Contract(pure=true) public static @NotNull ComponentHolder of(@NotNull @NotNull Component value)
      Wraps the specified Adventure component.
      Parameters:
      value - the value to wrap
      Returns:
      an instance that wraps the specified value
      Since:
      0.10.0
    • getComponent

      @NotNull @Contract(pure=true) public @NotNull Component getComponent()
      Gets the Adventure component this instance wraps.
      Returns:
      the contained Adventure component
      Since:
      0.10.0
    • asJson

      @NotNull @Contract(pure=true) public @NotNull com.google.gson.JsonElement asJson()
      Gets the wrapped Adventure component in a JSON representation.
      Returns:
      the contained Adventure component as JSON
      Since:
      0.10.0
    • toString

      @NotNull @Contract(pure=true) public @NotNull String toString()
      Specified by:
      toString in class TextHolder
    • hashCode

      public int hashCode()
      Specified by:
      hashCode in class TextHolder
    • equals

      public boolean equals(Object other)
      Specified by:
      equals in class TextHolder
    • asLegacyString

      @NotNull @Contract(pure=true) public @NotNull String asLegacyString()
      Description copied from class: TextHolder
      Converts the text wrapped by this class instance to a legacy string, keeping the original formatting.
      Specified by:
      asLegacyString in class TextHolder
      Returns:
      the wrapped value represented as a legacy string