package ar.com.companeros.tools; import com.google.gson.JsonObject; import java.util.UUID; /** * Puente hacia acciones autorizadas de Minecraft. La implementación comprueba * alcance, materiales, dimensión, protección y pertenencia al jugador real. * No recibe nombres de clases, comandos, rutas ni código ejecutable. */ public interface PrimitiveExecutor { PrimitiveTask begin(UUID actorId, UUID invocationId, String primitive, JsonObject arguments); interface PrimitiveTask { Result tick(long gameTick); void cancel(); } enum State { RUNNING, SUCCEEDED, FAILED } record Result(State state, double progress, String message) { public Result { if (state == null || !Double.isFinite(progress) || progress < 0 || progress > 1) throw new IllegalArgumentException("Resultado inválido de una acción"); message = message == null ? "" : message; if (message.length() > 512) message = message.substring(0, 512); } public static Result running(double progress) { return new Result(State.RUNNING, progress, ""); } public static Result success() { return new Result(State.SUCCEEDED, 1, ""); } public static Result failure(String message) { return new Result(State.FAILED, 0, message); } } }