Adds new methods for outputting the result of the format builder
All checks were successful
KnarCraft/KnarLib/pipeline/head This commit looks good

This commit is contained in:
2025-09-13 17:43:38 +02:00
parent f3c010934b
commit 25b18a1670

View File

@@ -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 <p>The recipient</p>
*/
public void displayColored(@NotNull CommandSender commandSender) {
commandSender.sendMessage(color().getCurrentString());
}
/**
* Displays the result as-is to the specified command sender
*
* @param commandSender <p>The recipient</p>
*/
public void displayRaw(@NotNull CommandSender commandSender) {
commandSender.sendMessage(getCurrentString());
}
@NotNull
@Override
public String toString() {
@@ -264,7 +282,7 @@ public class FormatBuilder {
* @throws IllegalStateException <p>If the string formatter has not been set, and the input is a translatable message.</p>
*/
@NotNull
protected <K> String asString(@NotNull K input, @NotNull String delimiter) {
protected <K> String asString(@NotNull K input, @NotNull String delimiter) {
if (input instanceof String string) {
return string;
} else if (input instanceof TranslatableMessage translatableMessage) {