package com.xfestudio.xfeservermanager.core.policy;
import com.xfestudio.xfeservermanager.api.policy.CommandConstraints;
import com.xfestudio.xfeservermanager.api.policy.CommandMatcher;
import com.xfestudio.xfeservermanager.api.policy.DecisionEffect;
import com.xfestudio.xfeservermanager.api.policy.ItemConstraint;
import com.xfestudio.xfeservermanager.api.policy.PolicyRule;
import com.xfestudio.xfeservermanager.api.policy.RuleTier;
import com.xfestudio.xfeservermanager.api.policy.SelectorConstraint;
import com.xfestudio.xfeservermanager.api.policy.SubjectMatcher;
import java.util.List;
import java.util.Set;
/** Safe draft defaults. They have no effect until explicitly staged and published. */
public final class SafePolicyPreset {
private SafePolicyPreset() {
}
public static List<PolicyRule> rules() {
CommandConstraints functionConstraints = new CommandConstraints(
SelectorConstraint.unrestricted(), ItemConstraint.unrestricted(), Set.of(), true);
PolicyRule indirectFunctions = new PolicyRule(
"hard-safety-function-allow-list",
true,
RuleTier.HARD_SAFETY,
SubjectMatcher.any(),
new CommandMatcher(Set.of("minecraft:function", "minecraft:schedule"), List.of()),
DecisionEffect.CONSTRAIN,
functionConstraints,
"Functions must be explicitly allow-listed before policy-controlled execution"
);
return List.of(indirectFunctions);
}
}
package com.xfestudio.xfeservermanager.core.policy;
import com.xfestudio.xfeservermanager.api.policy.CommandConstraints;
import com.xfestudio.xfeservermanager.api.policy.CommandMatcher;
import com.xfestudio.xfeservermanager.api.policy.DecisionEffect;
import com.xfestudio.xfeservermanager.api.policy.ItemConstraint;
import com.xfestudio.xfeservermanager.api.policy.PolicyRule;
import com.xfestudio.xfeservermanager.api.policy.RuleTier;
import com.xfestudio.xfeservermanager.api.policy.SelectorConstraint;
import com.xfestudio.xfeservermanager.api.policy.SubjectMatcher;
import java.util.List;
import java.util.Set;
/** Safe draft defaults. They have no effect until explicitly staged and published. */
public final class SafePolicyPreset {
private SafePolicyPreset() {
}
public static List<PolicyRule> rules() {
CommandConstraints functionConstraints = new CommandConstraints(
SelectorConstraint.unrestricted(), ItemConstraint.unrestricted(), Set.of(), true);
PolicyRule indirectFunctions = new PolicyRule(
"hard-safety-function-allow-list",
true,
RuleTier.HARD_SAFETY,
SubjectMatcher.any(),
new CommandMatcher(Set.of("minecraft:function", "minecraft:schedule"), List.of()),
DecisionEffect.CONSTRAIN,
functionConstraints,
"Functions must be explicitly allow-listed before policy-controlled execution"
);
return List.of(indirectFunctions);
}
}