Makes the format builder accept anything when creating a new format builder
This commit is contained in:
@@ -32,32 +32,24 @@ public final class FormatBuilder {
|
||||
/**
|
||||
* Instantiates a new format builder
|
||||
*
|
||||
* @param stringBuilder <p>The string builder to use output from</p>
|
||||
* <p>If the input is a list, it will be joined using the default delimiter: ",".</p>
|
||||
*
|
||||
* @param input <p>The input to use as the initial string of this format builder</p>
|
||||
* @throws IllegalStateException <p>If the string formatter has not been set, and the input is a translatable message</p>
|
||||
*/
|
||||
public FormatBuilder(@NotNull StringBuilder stringBuilder) {
|
||||
this.toFormat = stringBuilder.toString();
|
||||
public <K> FormatBuilder(@NotNull K input) throws IllegalStateException {
|
||||
this.toFormat = asString(input, LIST_DELIMITER);
|
||||
}
|
||||
|
||||
/**
|
||||
* Instantiates a new format builder
|
||||
*
|
||||
* @param translatableMessage <p>The translatable message to format</p>
|
||||
* @throws IllegalStateException <p>If the string formatter has not been set</p>
|
||||
* @param input <p>The input to use as the initial string of this format builder</p>
|
||||
* @param delimiter <p>The delimiter used for joining if the input is some kind of list</p>
|
||||
* @throws IllegalStateException <p>If the string formatter has not been set, and the input is a translatable message</p>
|
||||
*/
|
||||
public FormatBuilder(@NotNull TranslatableMessage translatableMessage) throws IllegalStateException {
|
||||
if (FormatBuilder.stringFormatter == null) {
|
||||
throw NOT_SETUP_EXCEPTION;
|
||||
}
|
||||
this.toFormat = FormatBuilder.stringFormatter.getUnFormattedMessage(translatableMessage);
|
||||
}
|
||||
|
||||
/**
|
||||
* Instantiates a new format builder
|
||||
*
|
||||
* @param toFormat <p>The string to format</p>
|
||||
*/
|
||||
public FormatBuilder(@NotNull String toFormat) {
|
||||
this.toFormat = toFormat;
|
||||
public <K> FormatBuilder(@NotNull K input, @NotNull String delimiter) throws IllegalStateException {
|
||||
this.toFormat = asString(input, delimiter);
|
||||
}
|
||||
|
||||
/**
|
||||
|
Reference in New Issue
Block a user