<commit_before>package com.simonorj.mc.getmehome.config;

import jdk.nashorn.internal.ir.annotations.Immutable;
import org.bukkit.configuration.ConfigurationSection;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Map;

public class PermValue {
    private static final String VALUE_CHILD_NODE = "value";
    private static final String OPERATION_CHILD_NODE = "operation";
    private static final String WORLDS_CHILD_NODE = "worlds";

    public final String perm;
    public final Value[] vals;

    @Immutable
    public static class Value {
        public final int val;
        public final Operation oper;
        public final List<String> worlds;

        private Value(int val) {
            this(val, Operation.SET, null);
        }

        private Value(int val, Operation oper, List<String> worlds) {
            this.val = val;
            this.oper = oper;
            this.worlds = worlds;
        }
    }

    private PermValue(String perm, Value val) {
        this.perm = perm;
        this.vals = new Value[]{val};
    }

    private PermValue(String perm, Value[] vals) {
        this.perm = perm;
        this.vals = vals;
    }

    enum Operation {
        SET, WORLD, ADD, SUB;

        private static Operation fromString(String input) {
            switch (input.toLowerCase()) {
                case "set":
                    return SET;
                case "world":
                case "worlds":
                    return WORLD;
                case "add":
                case "plus":
                    return ADD;
                case "sub":
                case "subtract":
                case "minus":
                    return SUB;
            }
            return SET;
        }
    }

    static List<PermValue> toList(ConfigurationSection cs) {
        ArrayList<PermValue> ret = new ArrayList<>();
        for (String perm : cs.getKeys(true)) {
            if ((cs.isInt(perm) && perm.endsWith('.' + VALUE_CHILD_NODE))
                    && !cs.isList(perm)
                    && !cs.isInt(perm + '.' + VALUE_CHILD_NODE)
            ) continue;

            ret.add(parsePermissionGroup(perm, cs));
        }
        return ret;
    }

    static PermValue parsePermissionGroup(String perm, ConfigurationSection cs) {
        if (cs.isInt(perm))
            return new PermValue(perm, new Value(cs.getInt(perm)));
        else if (cs.isInt(perm + "." + VALUE_CHILD_NODE))
            return new PermValue(perm, parseValue(cs.getConfigurationSection(perm)));
        else if (cs.isList(perm))
            return new PermValue(perm, parseValues(cs.getMapList(perm)));
        else
            return new PermValue(perm, new Value(1));
    }
<commit_msg>Actually Fix PermValue permission condition in list creation<commit_after>package com.simonorj.mc.getmehome.config;

import jdk.nashorn.internal.ir.annotations.Immutable;
import org.bukkit.configuration.ConfigurationSection;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Map;

public class PermValue {
    private static final String VALUE_CHILD_NODE = "value";
    private static final String OPERATION_CHILD_NODE = "operation";
    private static final String WORLDS_CHILD_NODE = "worlds";

    public final String perm;
    public final Value[] vals;

    @Immutable
    public static class Value {
        public final int val;
        public final Operation oper;
        public final List<String> worlds;

        private Value(int val) {
            this(val, Operation.SET, null);
        }

        private Value(int val, Operation oper, List<String> worlds) {
            this.val = val;
            this.oper = oper;
            this.worlds = worlds;
        }
    }

    private PermValue(String perm, Value val) {
        this.perm = perm;
        this.vals = new Value[]{val};
    }

    private PermValue(String perm, Value[] vals) {
        this.perm = perm;
        this.vals = vals;
    }

    enum Operation {
        SET, WORLD, ADD, SUB;

        private static Operation fromString(String input) {
            switch (input.toLowerCase()) {
                case "set":
                    return SET;
                case "world":
                case "worlds":
                    return WORLD;
                case "add":
                case "plus":
                    return ADD;
                case "sub":
                case "subtract":
                case "minus":
                    return SUB;
            }
            return SET;
        }
    }

    static List<PermValue> toList(ConfigurationSection cs) {
        ArrayList<PermValue> ret = new ArrayList<>();
        for (String perm : cs.getKeys(true)) {
            if (cs.isInt(perm) && !perm.endsWith('.' + VALUE_CHILD_NODE)
                    || cs.isList(perm)
                    || cs.isInt(perm + '.' + VALUE_CHILD_NODE)
            ) ret.add(parsePermissionGroup(perm, cs));
        }
        return ret;
    }

    static PermValue parsePermissionGroup(String perm, ConfigurationSection cs) {
        if (cs.isInt(perm))
            return new PermValue(perm, new Value(cs.getInt(perm)));
        else if (cs.isInt(perm + "." + VALUE_CHILD_NODE))
            return new PermValue(perm, parseValue(cs.getConfigurationSection(perm)));
        else if (cs.isList(perm))
            return new PermValue(perm, parseValues(cs.getMapList(perm)));
        else
            return new PermValue(perm, new Value(1));
    }

{'fraction_non_alphanumeric': 0.10019967326193502, 'fraction_numerical': 0.0003630422944273008, 'mean_word_length': 1.8697916666666667, 'pattern_counts': {'":': 16, '<': 13, '<?xml version=': 0, '>': 13, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '416161', 'n_tokens_mistral': 1544, 'n_tokens_neox': 1491, 'n_words': 396}