public class PrioritizingStringFormat extends StringFormat
StringFormat implementation that delegates to multiple other StringFormat implementations.StringFormat that matches will be used.colorChar| Constructor and Description |
|---|
PrioritizingStringFormat(StringFormat... matchers) |
| Modifier and Type | Method and Description |
|---|---|
boolean |
canRead(TextStringReader reader)
Check if the reader can read the color character of this format.
It is recommended to check this before calling StringFormat.matches(TextStringReader). |
boolean |
canWrite(TextFormatting formatting)
Check if this format can write the given text formatting.
|
boolean |
matches(TextStringReader reader)
Check if the reader matches the format of this string format.
This method is allowed to modify the current position of the reader. |
TextFormatting |
read(TextStringReader reader)
Read the next formatting code from the reader.
The reader should be at the start of the formatting code when this method is called. |
void |
write(java.lang.StringBuilder builder,
TextFormatting formatting)
Write the given text formatting to the builder.
This method should only be called if StringFormat.canWrite(TextFormatting) returns true. |
adventure, adventure, ansi, ansi, bungee, bungee, convertTo, fromString, fromString, init, prependStyle, resolve, shouldResetAtEnd, split, styleAt, toString, toString, vanilla, vanilla, vanilla, vanillapublic PrioritizingStringFormat(StringFormat... matchers)
public boolean canRead(TextStringReader reader)
StringFormatStringFormat.matches(TextStringReader).canRead in class StringFormatreader - The reader to checkpublic boolean matches(TextStringReader reader)
StringFormatTextStringReader.mark() and TextStringReader.reset().matches in class StringFormatreader - The reader to check@Nullable public TextFormatting read(TextStringReader reader)
StringFormatStringFormat.matches(TextStringReader) before calling this method.null should be returned.read in class StringFormatreader - The reader to read fromnull if the formatting code is invalidpublic boolean canWrite(TextFormatting formatting)
StringFormatcanWrite in class StringFormatformatting - The formatting to checkpublic void write(java.lang.StringBuilder builder,
TextFormatting formatting)
StringFormatStringFormat.canWrite(TextFormatting) returns true.write in class StringFormatbuilder - The builder to write toformatting - The formatting to write