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
* @returnThis format builder
*/ + @NotNull public FormatBuilder replace(@NotNull ListThe replacement
* @returnThis 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 replacementThe replacement translatable message
* @returnThis 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 replacementsThe replacements
* @returnThis 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 stringReplacerThe string replacer used for replacement
* @returnThis 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 { * * @returnThis format builder
*/ + @NotNull public FormatBuilder color() { this.toFormat = stringFormatter.getUnFormattedColoredMessage(this.toFormat); return this; } + /** + * Appends the given string to this format builder + * + * @param inputThe input to append
+ * @returnThis format builder
+ */ + @NotNull + public FormatBuilder append(@NotNull String input) { + this.toFormat += input; + return this; + } + + /** + * Appends the given translatable message to this format builder + * + * @param translatableMessageThe translatable message to append
+ * @returnThis 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 *