diff --git a/src/main/java/net/knarcraft/knarlib/formatting/FormatBuilder.java b/src/main/java/net/knarcraft/knarlib/formatting/FormatBuilder.java index 80062b0..8230ba5 100644 --- a/src/main/java/net/knarcraft/knarlib/formatting/FormatBuilder.java +++ b/src/main/java/net/knarcraft/knarlib/formatting/FormatBuilder.java @@ -49,6 +49,7 @@ public final class FormatBuilder { * @param replacements

The replacements

* @return

This format builder

*/ + @NotNull public FormatBuilder replace(@NotNull List placeholders, @NotNull List replacements) { this.toFormat = StringFormatter.replacePlaceholders(this.toFormat, placeholders, replacements); return this; @@ -61,6 +62,7 @@ public final class FormatBuilder { * @param replacement

The replacement

* @return

This format builder

*/ + @NotNull public FormatBuilder replace(@NotNull String placeholder, @NotNull String replacement) { this.toFormat = StringFormatter.replacePlaceholder(this.toFormat, placeholder, replacement); return this; @@ -73,8 +75,9 @@ public final class FormatBuilder { * @param replacement

The replacement translatable message

* @return

This format builder

*/ + @NotNull public FormatBuilder replace(@NotNull String placeholder, @NotNull TranslatableMessage replacement) { - this.toFormat = StringFormatter.replacePlaceholder(this.toFormat, placeholder, + this.toFormat = StringFormatter.replacePlaceholder(this.toFormat, placeholder, stringFormatter.getUnFormattedMessage(replacement)); return this; } @@ -86,6 +89,7 @@ public final class FormatBuilder { * @param replacements

The replacements

* @return

This format builder

*/ + @NotNull public FormatBuilder replace(@NotNull String[] placeholders, @NotNull String[] replacements) { this.toFormat = StringFormatter.replacePlaceholders(this.toFormat, placeholders, replacements); return this; @@ -97,6 +101,7 @@ public final class FormatBuilder { * @param stringReplacer

The string replacer used for replacement

* @return

This format builder

*/ + @NotNull public FormatBuilder replace(@NotNull StringReplacer stringReplacer) { this.toFormat = stringReplacer.replace(this.toFormat); return this; @@ -110,11 +115,36 @@ public final class FormatBuilder { * * @return

This format builder

*/ + @NotNull public FormatBuilder color() { this.toFormat = stringFormatter.getUnFormattedColoredMessage(this.toFormat); return this; } + /** + * Appends the given string to this format builder + * + * @param input

The input to append

+ * @return

This format builder

+ */ + @NotNull + public FormatBuilder append(@NotNull String input) { + this.toFormat += input; + return this; + } + + /** + * Appends the given translatable message to this format builder + * + * @param translatableMessage

The translatable message to append

+ * @return

This format builder

+ */ + @NotNull + public FormatBuilder append(@NotNull TranslatableMessage translatableMessage) { + this.toFormat += stringFormatter.getUnFormattedMessage(translatableMessage); + return this; + } + /** * Builds the output of the performed replacements and formatting *