Class TextParagraph

java.lang.Object
io.github.somesourcecode.someguiapi.scene.lore.TextParagraph
All Implemented Interfaces:
Paragraph

public class TextParagraph extends Object implements Paragraph
A paragraph that contains text in form of a component. The content of the paragraph can be wrapped to fit a certain width.
Since:
2.0.0
  • Field Details

    • DEFAULT_WRAP_WIDTH

      public static final int DEFAULT_WRAP_WIDTH
      The default width at which the text should be wrapped.
      Since:
      2.0.0
      See Also:
    • DEFAULT_WRAP_TYPE

      public static final WrapType DEFAULT_WRAP_TYPE
      The default type of wrapping.
      Since:
      2.0.0
  • Constructor Details

    • TextParagraph

      public TextParagraph()
      Constructs a new empty text paragraph.
      Since:
      2.0.0
    • TextParagraph

      public TextParagraph(net.kyori.adventure.text.Component content)
      Constructs a new text paragraph with the given content.
      Parameters:
      content - the content of the paragraph
      Since:
      2.0.0
  • Method Details

    • getContent

      public net.kyori.adventure.text.Component getContent()
      Returns the content of the paragraph.
      Returns:
      the content of the paragraph
      Since:
      2.0.0
    • setContent

      public TextParagraph setContent(net.kyori.adventure.text.Component content)
      Sets the content of the paragraph. Previous content will be overwritten. To append content, use append(Component).
      Parameters:
      content - the content of the paragraph
      Returns:
      the paragraph for method chaining
      Since:
      2.0.0
    • append

      public TextParagraph append(net.kyori.adventure.text.Component component)
      Appends a component to the content of the paragraph.
      Parameters:
      component - the component to append
      Returns:
      the paragraph for method chaining
      Since:
      2.0.0
    • getWrapType

      public WrapType getWrapType()
      Returns the type of wrapping that is applied to the paragraph.
      Returns:
      the type of wrapping
      Since:
      2.0.0
    • setWrapType

      public TextParagraph setWrapType(WrapType wrapType)
      Sets the type of wrapping that should be applied to the paragraph.
      Parameters:
      wrapType - the type of wrapping
      Returns:
      the paragraph for method chaining
      Since:
      2.0.0
    • getWrapWidth

      public int getWrapWidth()
      Returns the width at which the text should be wrapped.
      Returns:
      the wrap width
      Since:
      2.0.0
    • setWrapWidth

      public TextParagraph setWrapWidth(int wrapWidth)
      Sets the width at which the text should be wrapped.
      Parameters:
      wrapWidth - the wrap width
      Returns:
      the paragraph for method chaining
      Since:
      2.0.0
    • getLines

      public List<net.kyori.adventure.text.Component> getLines()
      Description copied from interface: Paragraph
      Returns a list representing the lines of the paragraph.
      Specified by:
      getLines in interface Paragraph
      Returns:
      the lines of the paragraph