personthecat.catlib.command.PendingMessageWrapper Maven / Gradle / Ivy
package personthecat.catlib.command;
import static personthecat.catlib.util.Shorthand.f;
import net.minecraft.class_2561;
import net.minecraft.class_2583;
import net.minecraft.class_2585;
@SuppressWarnings({"unused", "UnusedReturnValue"})
public class PendingMessageWrapper {
final CommandContextWrapper ctx;
final class_2585 msg;
protected PendingMessageWrapper(final CommandContextWrapper ctx, final class_2585 msg) {
this.ctx = ctx;
this.msg = msg;
}
public PendingMessageWrapper append(final String msg) {
this.msg.method_10852(new class_2585(msg));
return this;
}
public PendingMessageWrapper append(final String msg, final Object... args) {
return this.append(f(msg, args));
}
public PendingMessageWrapper append(final String msg, final class_2583 style) {
this.msg.method_10852(new class_2585(msg).method_10862(style));
return this;
}
public PendingMessageWrapper append(final class_2561 component) {
this.msg.method_10852(component);
return this;
}
public CommandContextWrapper sendMessage() {
this.ctx.sendMessage(this.msg);
return this.ctx;
}
public CommandContextWrapper sendError() {
this.ctx.sendError(this.msg);
return this.ctx;
}
}