New Run Command Task
build / build (push) Failing after 2s

This commit is contained in:
2026-07-04 05:34:38 -07:00
parent c534cc67a8
commit 18d594c02c
@@ -0,0 +1,31 @@
package skybot.controller.task;
import net.minecraft.client.MinecraftClient;
/** Runs a Minecraft command (e.g. "/help"), the same as typing it in chat. */
public class RunCommandTask implements Task {
private final String command;
private boolean ran = false;
public RunCommandTask(String command) {
this.command = command.startsWith("/") ? command.substring(1) : command;
}
@Override
public void start() {
MinecraftClient client = MinecraftClient.getInstance();
if (client.player != null) {
client.player.networkHandler.sendChatCommand(command);
}
ran = true;
}
@Override
public void tick() {
}
@Override
public boolean isDone() {
return ran;
}
}