XFE Git
XFE Studio Git
Git 首页 全局搜索
XFE 主站 文档 NuGet

XFEServerManager

【Java】我的世界XFE服务器管理器

公开
关注 0 Fork 0 Star 0
UTF-8
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);
    }
}