Allows the format builder to be extended
All checks were successful
KnarCraft/KnarLib/pipeline/head This commit looks good

This commit is contained in:
2025-09-13 16:48:28 +02:00
parent 16bd04f865
commit f3c010934b

View File

@@ -15,13 +15,13 @@ import java.util.List;
* A builder for making a replaced and formatted string
*/
@SuppressWarnings("unused")
public final class FormatBuilder {
public class FormatBuilder {
private static @Nullable StringFormatter stringFormatter = null;
private static final IllegalStateException NOT_SETUP_EXCEPTION = new IllegalStateException("String formatter has not been set!");
private static final String LIST_DELIMITER = ",";
private StringBuilder stringBuilder = null;
private @NotNull String stringToFormat;
protected StringBuilder stringBuilder = null;
protected @NotNull String stringToFormat;
/**
* Instantiates a new format builder
@@ -247,7 +247,7 @@ public final class FormatBuilder {
*
* @return <p>The current string</p>
*/
private String getCurrentString() {
protected String getCurrentString() {
if (this.stringBuilder != null) {
this.stringToFormat += this.stringBuilder.toString();
this.stringBuilder = null;
@@ -264,7 +264,7 @@ public final class FormatBuilder {
* @throws IllegalStateException <p>If the string formatter has not been set, and the input is a translatable message.</p>
*/
@NotNull
private <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) {