public static interface TextService.Builder<TString,TCommandSource>
| Modifier and Type | Method and Description |
|---|---|
TextService.Builder<TString,TCommandSource> |
append(java.lang.CharSequence... contents)
Append the provided contents to this builder
|
TextService.Builder<TString,TCommandSource> |
append(java.lang.Object... contents)
Append the provided contents to this builder
|
TextService.Builder<TString,TCommandSource> |
appendCount(int count,
java.lang.CharSequence... contents)
Append the provided contents to this builder
count times. |
TextService.Builder<TString,TCommandSource> |
appendCount(int count,
java.lang.Object... contents)
Append the provided contents to this builder
count times. |
TextService.Builder<TString,TCommandSource> |
appendIf(boolean condition,
java.lang.CharSequence... contents)
Append the provided contents if
condition is true. |
TextService.Builder<TString,TCommandSource> |
appendIf(boolean condition,
java.lang.Object... contents)
Append the provided contents if
condition is true. |
TextService.Builder<TString,TCommandSource> |
appendJoining(java.lang.Object delimiter,
java.lang.CharSequence... contents)
Append the provided contents, putting the
provided delimiter between each element
|
TextService.Builder<TString,TCommandSource> |
appendJoining(java.lang.Object delimiter,
java.lang.Object... contents)
Append the provided contents, putting the
provided delimiter between each element
|
TextService.Builder<TString,TCommandSource> |
appendJoiningIf(boolean condition,
java.lang.Object delimiter,
java.lang.CharSequence... contents)
Append the provided contents if
condition is true,
putting the provided delimiter between each element |
TextService.Builder<TString,TCommandSource> |
appendJoiningIf(boolean condition,
java.lang.Object delimiter,
java.lang.Object... contents)
Append the provided contents if
condition is true,
putting the provided delimiter between each element |
TextService.Builder<TString,TCommandSource> |
appendWithPaddingAround(int width,
java.lang.Object padding,
java.lang.CharSequence... contents)
Append the provided contents to this builder
and add the provided padding on both the left and right side
until the result is at most
width wide. |
TextService.Builder<TString,TCommandSource> |
appendWithPaddingAround(int width,
java.lang.Object padding,
java.lang.Object... contents)
Append the provided contents to this builder
and add the provided padding on both the left and right side
until the result is at most
width wide. |
TextService.Builder<TString,TCommandSource> |
appendWithPaddingLeft(int width,
java.lang.Object padding,
java.lang.CharSequence... contents)
Append the provided contents to this builder
and add the provided padding on the left side
until the result is at most
width wide. |
TextService.Builder<TString,TCommandSource> |
appendWithPaddingLeft(int width,
java.lang.Object padding,
java.lang.Object... contents)
Append the provided contents to this builder
and add the provided padding on the left side
until the result is at most
width wide. |
TextService.Builder<TString,TCommandSource> |
appendWithPaddingRight(int width,
java.lang.Object padding,
java.lang.CharSequence... contents)
Append the provided contents to this builder
and add the provided padding on the right side
until the result is at most
width wide. |
TextService.Builder<TString,TCommandSource> |
appendWithPaddingRight(int width,
java.lang.Object padding,
java.lang.Object... contents)
Append the provided contents to this builder
and add the provided padding on the right side
until the result is at most
width wide. |
TextService.Builder<TString,TCommandSource> |
aqua()
Sets the current color to aqua.
|
TextService.Builder<TString,TCommandSource> |
black()
Sets the current color to black.
|
TextService.Builder<TString,TCommandSource> |
blue()
Sets the current color to blue.
|
TextService.Builder<TString,TCommandSource> |
bold()
Sets the current style to bold.
|
TString |
build()
Creates a
TString from this builder. |
TextService.Builder<TString,TCommandSource> |
dark_aqua()
Sets the current color to dark aqua.
|
TextService.Builder<TString,TCommandSource> |
dark_blue()
Sets the current color to dark blue.
|
TextService.Builder<TString,TCommandSource> |
dark_gray()
Sets the current color to dark gray.
|
TextService.Builder<TString,TCommandSource> |
dark_green()
Sets the current color to dark green.
|
TextService.Builder<TString,TCommandSource> |
dark_purple()
Sets the current color to dark purple.
|
TextService.Builder<TString,TCommandSource> |
dark_red()
Sets the current color to dark red.
|
TextService.Builder<TString,TCommandSource> |
gold()
Sets the current color to gold.
|
TextService.Builder<TString,TCommandSource> |
gray()
Sets the current color to gray.
|
TextService.Builder<TString,TCommandSource> |
green()
Sets the current color to green.
|
TextService.Builder<TString,TCommandSource> |
italic()
Sets the current style to italic.
|
TextService.Builder<TString,TCommandSource> |
light_purple()
Sets the current color to light purple.
|
TextService.Builder<TString,TCommandSource> |
obfuscated()
Sets the current style to obfuscated.
|
TextService.Builder<TString,TCommandSource> |
onClickExecuteCallback(java.util.function.Consumer<TCommandSource> callback)
Run the provided callback, passing the provided
TCommandSource, when they click. |
TextService.Builder<TString,TCommandSource> |
onClickOpenUrl(java.lang.String url)
Open a url in a browser when this text is clicked.
|
TextService.Builder<TString,TCommandSource> |
onClickOpenUrl(java.net.URL url)
Open a url in a browser when this text is clicked.
|
TextService.Builder<TString,TCommandSource> |
onClickRunCommand(java.lang.String command)
Run the provided command as the provided
TCommandSource when they click. |
TextService.Builder<TString,TCommandSource> |
onClickSuggestCommand(java.lang.String command)
Suggest the provided command to the provided
TCommandSource when
they click This puts it in their chat bar but does not run the command. |
TextService.Builder<TString,TCommandSource> |
onHoverShowText(TextService.Builder<TString,TCommandSource> builder)
Show the provided text as a tooltip while
the mouse is hovering over this text
|
TextService.Builder<TString,TCommandSource> |
onHoverShowText(TString text)
Show the provided text as a tooltip while
the mouse is hovering over this text
|
TextService.Builder<TString,TCommandSource> |
red()
Sets the current color to red.
|
TextService.Builder<TString,TCommandSource> |
reset()
Resets the current style to default.
|
void |
sendTo(TCommandSource commandSource)
Creates a
TString from this builder and sends
it to the provided TCommandSource |
void |
sendToConsole()
Creates a
TString from this builder and sends
it to the console |
TextService.Builder<TString,TCommandSource> |
strikethrough()
Sets the current style to strikethrough.
|
TextService.Builder<TString,TCommandSource> |
underlined()
Sets the current style to underlined.
|
TextService.Builder<TString,TCommandSource> |
white()
Sets the current color to white.
|
TextService.Builder<TString,TCommandSource> |
yellow()
Sets the current color to yellow.
|
TextService.Builder<TString,TCommandSource> aqua()
thisTextService.Builder<TString,TCommandSource> black()
thisTextService.Builder<TString,TCommandSource> blue()
thisTextService.Builder<TString,TCommandSource> dark_aqua()
thisTextService.Builder<TString,TCommandSource> dark_blue()
thisTextService.Builder<TString,TCommandSource> dark_gray()
thisTextService.Builder<TString,TCommandSource> dark_green()
thisTextService.Builder<TString,TCommandSource> dark_purple()
thisTextService.Builder<TString,TCommandSource> dark_red()
thisTextService.Builder<TString,TCommandSource> gold()
thisTextService.Builder<TString,TCommandSource> gray()
thisTextService.Builder<TString,TCommandSource> green()
thisTextService.Builder<TString,TCommandSource> light_purple()
thisTextService.Builder<TString,TCommandSource> red()
thisTextService.Builder<TString,TCommandSource> reset()
thisTextService.Builder<TString,TCommandSource> white()
thisTextService.Builder<TString,TCommandSource> yellow()
thisTextService.Builder<TString,TCommandSource> bold()
thisTextService.Builder<TString,TCommandSource> italic()
thisTextService.Builder<TString,TCommandSource> obfuscated()
thisTextService.Builder<TString,TCommandSource> strikethrough()
thisTextService.Builder<TString,TCommandSource> underlined()
thisTextService.Builder<TString,TCommandSource> append(java.lang.Object... contents)
contents - Object contents to appendthisTextService.Builder<TString,TCommandSource> append(java.lang.CharSequence... contents)
contents - CharSequence contents to appendthisTextService.Builder<TString,TCommandSource> appendCount(int count, java.lang.Object... contents)
count times.
This method is the same as:
for (int i = 0; i < count; i++) {
builder.append(contents);
}
count - number of times to append the provided contentscontents - Object contents to appendthisTextService.Builder<TString,TCommandSource> appendCount(int count, java.lang.CharSequence... contents)
count times.
This method is the same as:
for (int i = 0; i < count; i++) {
builder.append(contents);
}
count - number of times to append the provided contentscontents - CharSequence contents to appendthisTextService.Builder<TString,TCommandSource> appendWithPaddingLeft(int width, java.lang.Object padding, java.lang.Object... contents)
width wide.
An example of usage is:
builder.appendWithPaddingLeft(15, '-', "hello");
which appends the result "----------hello"
If the value for padding is longer than one character,
the appended result may not reach the full provided width.
This can be seen in the following example:
builder.appendWithPaddingLeft(15, "abc", "hello");
which appends the result "abcabcabchello" (14 characters instead of 15)
This happens because the remaining width is not a multiple of the length of the provided padding, which makes it impossible fill the full length of the appended result.
Note: The appended result will be at most width wide, or
an exception will be thrown
width - The maximum total width after paddingpadding - The padding to fill the left side withcontents - The contents to appendthisjava.lang.IllegalArgumentException - If width < 1java.lang.IllegalArgumentException - If padding length < 1java.lang.IllegalArgumentException - If padding length > widthjava.lang.IllegalArgumentException - If contents length > widthTextService.Builder<TString,TCommandSource> appendWithPaddingLeft(int width, java.lang.Object padding, java.lang.CharSequence... contents)
width wide.
An example of usage is:
builder.appendWithPaddingLeft(15, '-', "hello");
which appends the result "----------hello"
If the value for padding is longer than one character,
the appended result may not reach the full provided width.
This can be seen in the following example:
builder.appendWithPaddingLeft(15, "abc", "hello");
which appends the result "abcabcabchello" (14 characters instead of 15)
This happens because the remaining width is not a multiple of the length of the provided padding, which makes it impossible fill the full length of the appended result.
Note: The appended result will be at most width wide, or
an exception will be thrown
width - The maximum total width after paddingpadding - The padding to fill the left side withcontents - The contents to appendthisjava.lang.IllegalArgumentException - If width < 1java.lang.IllegalArgumentException - If padding length < 1java.lang.IllegalArgumentException - If padding length > widthjava.lang.IllegalArgumentException - If contents length > widthTextService.Builder<TString,TCommandSource> appendWithPaddingAround(int width, java.lang.Object padding, java.lang.Object... contents)
width wide.
An example of usage is:
builder.appendWithPaddingAround(15, '-', "hello");
which appends the result "-----hello-----"
If the value for padding is longer than one character,
the appended result may not reach the full provided width.
This can be seen in the following example:
builder.appendWithPaddingAround(15, "abc", "hello");
which appends the result "abchelloabc" (11 characters instead of 15)
This happens because the remaining width is not a multiple of the length of the provided padding, which makes it impossible fill the full length of the appended result.
Note: The appended result will be at most width wide, or
an exception will be thrown
Note: The amount of padding on the left and right side will
always be the same
width - The maximum total width after paddingpadding - The padding to fill the left and right side withcontents - The contents to appendthisjava.lang.IllegalArgumentException - If width < 1java.lang.IllegalArgumentException - If padding length < 1java.lang.IllegalArgumentException - If padding length > widthjava.lang.IllegalArgumentException - If contents length > widthTextService.Builder<TString,TCommandSource> appendWithPaddingAround(int width, java.lang.Object padding, java.lang.CharSequence... contents)
width wide.
An example of usage is:
builder.appendWithPaddingAround(15, '-', "hello");
which appends the result "-----hello-----"
If the value for padding is longer than one character,
the appended result may not reach the full provided width.
This can be seen in the following example:
builder.appendWithPaddingAround(15, "abc", "hello");
which appends the result "abchelloabc" (11 characters instead of 15)
This happens because the remaining width is not a multiple of the length of the provided padding, which makes it impossible fill the full length of the appended result.
Note: The appended result will be at most width wide, or
an exception will be thrown
Note: The amount of padding on the left and right side will
always be the same
width - The maximum total width after paddingpadding - The padding to fill the left and right side withcontents - The contents to appendthisjava.lang.IllegalArgumentException - If width < 1java.lang.IllegalArgumentException - If padding length < 1java.lang.IllegalArgumentException - If padding length > widthjava.lang.IllegalArgumentException - If contents length > widthTextService.Builder<TString,TCommandSource> appendWithPaddingRight(int width, java.lang.Object padding, java.lang.Object... contents)
width wide.
An example of usage is:
builder.appendWithPaddingRight(15, '-', "hello");
which appends the result "hello----------"
If the value for padding is longer than one character,
the appended result may not reach the full provided width.
This can be seen in the following example:
builder.appendWithPaddingRight(15, "abc", "hello");
which appends the result "helloabcabcabc" (14 characters instead of 15)
This happens because the remaining width is not a multiple of the length of the provided padding, which makes it impossible fill the full length of the appended result.
Note: The appended result will be at most width wide, or
an exception will be thrown
width - The maximum total width after paddingpadding - The padding to fill the right side withcontents - The contents to appendthisjava.lang.IllegalArgumentException - If width < 1java.lang.IllegalArgumentException - If padding length < 1java.lang.IllegalArgumentException - If padding length > widthjava.lang.IllegalArgumentException - If contents length > widthTextService.Builder<TString,TCommandSource> appendWithPaddingRight(int width, java.lang.Object padding, java.lang.CharSequence... contents)
width wide.
An example of usage is:
builder.appendWithPaddingRight(15, '-', "hello");
which appends the result "hello----------"
If the value for padding is longer than one character,
the appended result may not reach the full provided width.
This can be seen in the following example:
builder.appendWithPaddingRight(15, "abc", "hello");
which appends the result "helloabcabcabc" (14 characters instead of 15)
This happens because the remaining width is not a multiple of the length of the provided padding, which makes it impossible fill the full length of the appended result.
Note: The appended result will be at most width wide, or
an exception will be thrown
width - The maximum total width after paddingpadding - The padding to fill the right side withcontents - The contents to appendthisjava.lang.IllegalArgumentException - If width < 1java.lang.IllegalArgumentException - If padding length < 1java.lang.IllegalArgumentException - If padding length > widthjava.lang.IllegalArgumentException - If contents length > widthTextService.Builder<TString,TCommandSource> appendIf(boolean condition, java.lang.Object... contents)
condition is true.
This method is the same as:
if (condition) {
builder.append(contents);
}
condition - The condition to checkcontents - The contents to appendthisTextService.Builder<TString,TCommandSource> appendIf(boolean condition, java.lang.CharSequence... contents)
condition is true.
This method is the same as:
if (condition) {
builder.append(contents);
}
condition - The condition to checkcontents - The contents to appendthisTextService.Builder<TString,TCommandSource> appendJoining(java.lang.Object delimiter, java.lang.Object... contents)
builder.appendJoining(", ", "Bob", "Alice", "Steven");
is the same as
builder.append("Bob", ", ", "Alice", ", ", "Steven");
They both append: "Bob, Alice, Steven"
delimiter - The delimiter to put between each elementcontents - The contents to appendthisTextService.Builder<TString,TCommandSource> appendJoining(java.lang.Object delimiter, java.lang.CharSequence... contents)
builder.appendJoining(", ", "Bob", "Alice", "Steven");
is the same as
builder.append("Bob", ", ", "Alice", ", ", "Steven");
They both append: "Bob, Alice, Steven"
delimiter - The delimiter to put between each elementcontents - The contents to appendthisTextService.Builder<TString,TCommandSource> appendJoiningIf(boolean condition, java.lang.Object delimiter, java.lang.Object... contents)
condition is true,
putting the provided delimiter between each element
This is a combination of appendIf(boolean, Object...)
and appendJoining(Object, Object...)
builder.appendJoiningIf(condition, ", ", "Bob", "Alice", "Steven");
is the same as
if (condition) {
builder.append("Bob", ", ", "Alice", ", ", "Steven");
}
They both append: "Bob, Alice, Steven" if condition is true
condition - The condition to check before appendingdelimiter - The delimiter to put between each elementcontents - The contents to appendthisTextService.Builder<TString,TCommandSource> appendJoiningIf(boolean condition, java.lang.Object delimiter, java.lang.CharSequence... contents)
condition is true,
putting the provided delimiter between each element
This is a combination of appendIf(boolean, CharSequence...)
and appendJoining(Object, CharSequence...)
builder.appendJoiningIf(condition, ", ", "Bob", "Alice", "Steven");
is the same as
if (condition) {
builder.append("Bob", ", ", "Alice", ", ", "Steven");
}
They both append: "Bob, Alice, Steven" if condition is true
condition - The condition to check before appendingdelimiter - The delimiter to put between each elementcontents - The contents to appendthisTextService.Builder<TString,TCommandSource> onHoverShowText(TString text)
text - The text to show on hoverthisTextService.Builder<TString,TCommandSource> onHoverShowText(TextService.Builder<TString,TCommandSource> builder)
builder - The text to show on hoverthisTextService.Builder<TString,TCommandSource> onClickSuggestCommand(java.lang.String command)
TCommandSource when
they click This puts it in their chat bar but does not run the command.command - The command to suggestthisTextService.Builder<TString,TCommandSource> onClickRunCommand(java.lang.String command)
TCommandSource when they click.command - The command to runthisTextService.Builder<TString,TCommandSource> onClickExecuteCallback(java.util.function.Consumer<TCommandSource> callback)
TCommandSource, when they click.callback - The callback to runthisTextService.Builder<TString,TCommandSource> onClickOpenUrl(java.net.URL url)
url - The url to openthisTextService.Builder<TString,TCommandSource> onClickOpenUrl(java.lang.String url)
url - The url to openthisTString build()
TString from this builder.TStringvoid sendTo(TCommandSource commandSource)
TString from this builder and sends
it to the provided TCommandSourcecommandSource - The TCommandSource to send the TString tovoid sendToConsole()
TString from this builder and sends
it to the console