package com.ptsmods.morecommands.api.util.text;

import com.ptsmods.morecommands.api.util.compat.Compat;
import lombok.AccessLevel;
import lombok.NonNull;
import lombok.RequiredArgsConstructor;
import net.minecraft.text.MutableText;
import net.minecraft.text.Style;

public interface LiteralTextBuilder extends TextBuilder<LiteralTextBuilder> {

    String getLiteral();

    void setLiteral(String literal);

    static LiteralTextBuilder builder(@NonNull String literal) {
        return new LiteralTextBuilderImpl(literal);
    }

    static LiteralTextBuilder builder(@NonNull String literal, Style style) {
        return new LiteralTextBuilderImpl(literal, style);
    }

    static MutableText literal(String literal) {
        return builder(literal).build();
    }

    static MutableText literal(String literal, Style style) {
        return builder(literal, style).build();
    }

    @RequiredArgsConstructor(access = AccessLevel.PACKAGE)
    class LiteralTextBuilderImpl extends TextBuilderImpl<LiteralTextBuilder> implements LiteralTextBuilder {
        private @NonNull String literal;

        LiteralTextBuilderImpl(@NonNull String literal, Style style) {
            this(literal);
            withStyle(style);
        }

        @Override
        public MutableText build() {
            return Compat.get().buildText(this);
        }

        @Override
        public LiteralTextBuilder copy() {
            return builder(getLiteral())
                    .withStyle(getStyle())
                    .withChildren(getChildren());
        }

        @Override
        public final LiteralTextBuilder upcast() {
            return this;
        }

        @NonNull
        @Override
        public String getLiteral() {
            return literal;
        }

        @Override
        public void setLiteral(@NonNull String literal) {
            this.literal = literal;
        }
    }
}

@@ -369,20 +369,34 @@
 );%0A%0A    
-void
+LiteralTextBuilder
  setLite
@@ -413,24 +413,181 @@
  literal);%0A%0A
+    default LiteralTextBuilder format(Object... formattings) %7B%0A        setLiteral(String.format(getLiteral(), formattings));%0A        return upcast();%0A    %7D%0A%0A
     static L
@@ -765,285 +765,887 @@
 al, 
-Style style) %7B%0A        return new LiteralTextBuilderImpl(literal, style);%0A    %7D%0A%0A    static MutableText literal(String literal) %7B%0A        return builder(literal).build();%0A    %7D%0A%0A    static MutableText literal(String literal, Style style) %7B%0A        return builder(literal, style
+Object... formattings) %7B%0A        return builder(literal).format(formattings);%0A    %7D%0A%0A    static LiteralTextBuilder builder(@NonNull String literal, Style style) %7B%0A        return new LiteralTextBuilderImpl(literal, style);%0A    %7D%0A%0A    static LiteralTextBuilder builder(@NonNull String literal, Style style, Object... formattings) %7B%0A        return builder(literal, style).format(formattings);%0A    %7D%0A%0A    static MutableText literal(String literal) %7B%0A        return builder(literal).build();%0A    %7D%0A%0A    static MutableText literal(String literal, Object... formattings) %7B%0A        return builder(literal, formattings).build();%0A    %7D%0A%0A    static MutableText literal(String literal, Style style) %7B%0A        return builder(literal, style).build();%0A    %7D%0A%0A    static MutableText literal(String literal, Style style, Object... formattings) %7B%0A        return builder(literal, style, formattings
 ).bu
@@ -2581,12 +2581,26 @@
 lic 
-void
+LiteralTextBuilder
  set
@@ -2662,32 +2662,61 @@
 eral = literal;%0A
+            return upcast();%0A
         %7D%0A    %7D%0A

Add formattings