Search in sources :

Example 31 with MutableContextSet

use of me.lucko.luckperms.api.context.MutableContextSet in project LuckPerms by lucko.

the class ContextSetConfigurateSerializer method deserializeContextSet.

public static ContextSet deserializeContextSet(ConfigurationNode data) {
    Preconditions.checkArgument(data.hasMapChildren());
    Map<Object, ? extends ConfigurationNode> dataMap = data.getChildrenMap();
    if (dataMap.isEmpty()) {
        return ContextSet.empty();
    }
    MutableContextSet map = MutableContextSet.create();
    for (Map.Entry<Object, ? extends ConfigurationNode> e : dataMap.entrySet()) {
        String k = e.getKey().toString();
        ConfigurationNode v = e.getValue();
        if (v.hasListChildren()) {
            List<? extends ConfigurationNode> values = v.getChildrenList();
            for (ConfigurationNode value : values) {
                map.add(k, value.getString());
            }
        } else {
            map.add(k, v.getString());
        }
    }
    return map;
}
Also used : ConfigurationNode(ninja.leaping.configurate.ConfigurationNode) SimpleConfigurationNode(ninja.leaping.configurate.SimpleConfigurationNode) MutableContextSet(me.lucko.luckperms.api.context.MutableContextSet) Map(java.util.Map)

Aggregations

MutableContextSet (me.lucko.luckperms.api.context.MutableContextSet)31 DataMutateResult (me.lucko.luckperms.api.DataMutateResult)12 Node (me.lucko.luckperms.api.Node)7 Group (me.lucko.luckperms.common.model.Group)6 TextComponent (net.kyori.text.TextComponent)6 HoverEvent (net.kyori.text.event.HoverEvent)6 Map (java.util.Map)5 TemporaryModifier (me.lucko.luckperms.common.model.TemporaryModifier)4 Track (me.lucko.luckperms.common.model.Track)4 User (me.lucko.luckperms.common.model.User)4 List (java.util.List)2 Set (java.util.Set)2 Collectors (java.util.stream.Collectors)2 ExtendedLogEntry (me.lucko.luckperms.common.actionlog.ExtendedLogEntry)2 CommandResult (me.lucko.luckperms.common.command.CommandResult)2 CommandException (me.lucko.luckperms.common.command.abstraction.CommandException)2 SubCommand (me.lucko.luckperms.common.command.abstraction.SubCommand)2 ArgumentPermissions (me.lucko.luckperms.common.command.access.ArgumentPermissions)2 CommandPermission (me.lucko.luckperms.common.command.access.CommandPermission)2 ArgumentParser (me.lucko.luckperms.common.command.utils.ArgumentParser)2