package com.xfestudio.xfeservermanager.core.rollback;
/** Hard safety limits are four chunks and two milliseconds per server tick. */
public record TickBudget(int maxDistinctChunks, long maxNanos) {
public static final int HARD_MAX_CHUNKS = 4;
public static final long HARD_MAX_NANOS = 2_000_000L;
public TickBudget {
if (maxDistinctChunks < 1 || maxDistinctChunks > HARD_MAX_CHUNKS) {
throw new IllegalArgumentException("maxDistinctChunks must be between 1 and 4");
}
if (maxNanos < 1 || maxNanos > HARD_MAX_NANOS) {
throw new IllegalArgumentException("maxNanos must be between 1 and 2000000");
}
}
public static TickBudget safeDefault() {
return new TickBudget(HARD_MAX_CHUNKS, HARD_MAX_NANOS);
}
}
package com.xfestudio.xfeservermanager.core.rollback;
/** Hard safety limits are four chunks and two milliseconds per server tick. */
public record TickBudget(int maxDistinctChunks, long maxNanos) {
public static final int HARD_MAX_CHUNKS = 4;
public static final long HARD_MAX_NANOS = 2_000_000L;
public TickBudget {
if (maxDistinctChunks < 1 || maxDistinctChunks > HARD_MAX_CHUNKS) {
throw new IllegalArgumentException("maxDistinctChunks must be between 1 and 4");
}
if (maxNanos < 1 || maxNanos > HARD_MAX_NANOS) {
throw new IllegalArgumentException("maxNanos must be between 1 and 2000000");
}
}
public static TickBudget safeDefault() {
return new TickBudget(HARD_MAX_CHUNKS, HARD_MAX_NANOS);
}
}