From 25b18a1670cd1ff00acf0a102ef97c9e94859a6f Mon Sep 17 00:00:00 2001 From: EpicKnarvik97 Date: Sat, 13 Sep 2025 17:43:38 +0200 Subject: [PATCH] Adds new methods for outputting the result of the format builder --- .../knarlib/formatting/FormatBuilder.java | 20 ++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/src/main/java/net/knarcraft/knarlib/formatting/FormatBuilder.java b/src/main/java/net/knarcraft/knarlib/formatting/FormatBuilder.java index 3db6e9d..26e6c3b 100644 --- a/src/main/java/net/knarcraft/knarlib/formatting/FormatBuilder.java +++ b/src/main/java/net/knarcraft/knarlib/formatting/FormatBuilder.java @@ -236,6 +236,24 @@ public class FormatBuilder { FormatBuilder.stringFormatter.displayNeutralMessage(commandSender, getCurrentString()); } + /** + * Displays the result a colored message with no prefix to the specified command sender + * + * @param commandSender

The recipient

+ */ + public void displayColored(@NotNull CommandSender commandSender) { + commandSender.sendMessage(color().getCurrentString()); + } + + /** + * Displays the result as-is to the specified command sender + * + * @param commandSender

The recipient

+ */ + public void displayRaw(@NotNull CommandSender commandSender) { + commandSender.sendMessage(getCurrentString()); + } + @NotNull @Override public String toString() { @@ -264,7 +282,7 @@ public class FormatBuilder { * @throws IllegalStateException

If the string formatter has not been set, and the input is a translatable message.

*/ @NotNull - protected String asString(@NotNull K input, @NotNull String delimiter) { + protected String asString(@NotNull K input, @NotNull String delimiter) { if (input instanceof String string) { return string; } else if (input instanceof TranslatableMessage translatableMessage) {