Class TextParagraph
java.lang.Object
io.github.somesourcecode.someguiapi.scene.lore.TextParagraph
- All Implemented Interfaces:
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 Summary
FieldsModifier and TypeFieldDescriptionstatic final WrapTypeThe default type of wrapping.static final intThe default width at which the text should be wrapped. -
Constructor Summary
ConstructorsConstructorDescriptionConstructs a new empty text paragraph.TextParagraph(net.kyori.adventure.text.Component content) Constructs a new text paragraph with the given content. -
Method Summary
Modifier and TypeMethodDescriptionappend(net.kyori.adventure.text.Component component) Appends a component to the content of the paragraph.net.kyori.adventure.text.ComponentReturns the content of the paragraph.List<net.kyori.adventure.text.Component>getLines()Returns a list representing the lines of the paragraph.Returns the type of wrapping that is applied to the paragraph.intReturns the width at which the text should be wrapped.setContent(net.kyori.adventure.text.Component content) Sets the content of the paragraph.setWrapType(WrapType wrapType) Sets the type of wrapping that should be applied to the paragraph.setWrapWidth(int wrapWidth) Sets the width at which the text should be wrapped.
-
Field Details
-
DEFAULT_WRAP_WIDTH
public static final int DEFAULT_WRAP_WIDTHThe default width at which the text should be wrapped.- Since:
- 2.0.0
- See Also:
-
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
Sets the content of the paragraph. Previous content will be overwritten. To append content, useappend(Component).- Parameters:
content- the content of the paragraph- Returns:
- the paragraph for method chaining
- Since:
- 2.0.0
-
append
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
Returns the type of wrapping that is applied to the paragraph.- Returns:
- the type of wrapping
- Since:
- 2.0.0
-
setWrapType
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
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
Description copied from interface:ParagraphReturns a list representing the lines of the paragraph.
-