Search in sources :

Example 1 with MonitoredMetaCache

use of me.lucko.luckperms.common.cacheddata.type.MonitoredMetaCache in project LuckPerms by lucko.

the class LuckPermsVaultChat method getUserMeta.

@Override
public String getUserMeta(String world, UUID uuid, String key) {
    Objects.requireNonNull(uuid, "uuid");
    Objects.requireNonNull(key, "key");
    PermissionHolder user = this.vaultPermission.lookupUser(uuid);
    QueryOptions queryOptions = this.vaultPermission.getQueryOptions(uuid, world);
    MonitoredMetaCache metaData = user.getCachedData().getMetaData(queryOptions);
    return metaData.getMetaValue(key, CheckOrigin.THIRD_PARTY_API).result();
}
Also used : MonitoredMetaCache(me.lucko.luckperms.common.cacheddata.type.MonitoredMetaCache) PermissionHolder(me.lucko.luckperms.common.model.PermissionHolder) QueryOptions(net.luckperms.api.query.QueryOptions)

Example 2 with MonitoredMetaCache

use of me.lucko.luckperms.common.cacheddata.type.MonitoredMetaCache in project LuckPerms by lucko.

the class LuckPermsVaultChat method getGroupMeta.

@Override
public String getGroupMeta(String world, String name, String key) {
    Objects.requireNonNull(name, "name");
    Objects.requireNonNull(key, "key");
    MonitoredMetaCache metaData = getGroupMetaCache(name, world);
    if (metaData == null) {
        return null;
    }
    return metaData.getMetaValue(key, CheckOrigin.THIRD_PARTY_API).result();
}
Also used : MonitoredMetaCache(me.lucko.luckperms.common.cacheddata.type.MonitoredMetaCache)

Example 3 with MonitoredMetaCache

use of me.lucko.luckperms.common.cacheddata.type.MonitoredMetaCache in project LuckPerms by lucko.

the class AbstractCachedDataManager method calculateMeta.

private MonitoredMetaCache calculateMeta(QueryOptions queryOptions) {
    Objects.requireNonNull(queryOptions, "queryOptions");
    CacheMetadata metadata = getMetadataForQueryOptions(queryOptions);
    MetaAccumulator accumulator = newAccumulator(queryOptions);
    resolveMeta(accumulator, queryOptions);
    return new MonitoredMetaCache(this.plugin, queryOptions, metadata, accumulator);
}
Also used : MetaAccumulator(me.lucko.luckperms.common.cacheddata.type.MetaAccumulator) MonitoredMetaCache(me.lucko.luckperms.common.cacheddata.type.MonitoredMetaCache)

Example 4 with MonitoredMetaCache

use of me.lucko.luckperms.common.cacheddata.type.MonitoredMetaCache in project LuckPerms by lucko.

the class LuckPermsVaultPermission method userGetPrimaryGroup.

@Override
public String userGetPrimaryGroup(String world, UUID uuid) {
    Objects.requireNonNull(uuid, "uuid");
    PermissionHolder user = lookupUser(uuid);
    if (user instanceof Group) {
        // npc
        return this.plugin.getConfiguration().get(ConfigKeys.VAULT_NPC_GROUP);
    }
    QueryOptions queryOptions = getQueryOptions(uuid, world);
    MonitoredMetaCache metaData = user.getCachedData().getMetaData(queryOptions);
    String value = metaData.getPrimaryGroup(CheckOrigin.THIRD_PARTY_API);
    if (value == null) {
        return null;
    }
    Group group = getGroup(value);
    return group != null ? groupName(group) : value;
}
Also used : Group(me.lucko.luckperms.common.model.Group) MonitoredMetaCache(me.lucko.luckperms.common.cacheddata.type.MonitoredMetaCache) PermissionHolder(me.lucko.luckperms.common.model.PermissionHolder) QueryOptions(net.luckperms.api.query.QueryOptions)

Example 5 with MonitoredMetaCache

use of me.lucko.luckperms.common.cacheddata.type.MonitoredMetaCache in project LuckPerms by lucko.

the class LuckPermsVaultChat method getGroupChatSuffix.

@Override
public String getGroupChatSuffix(String world, String name) {
    Objects.requireNonNull(name, "name");
    MonitoredMetaCache metaData = getGroupMetaCache(name, world);
    if (metaData == null) {
        return null;
    }
    return Strings.nullToEmpty(metaData.getSuffix(CheckOrigin.THIRD_PARTY_API).result());
}
Also used : MonitoredMetaCache(me.lucko.luckperms.common.cacheddata.type.MonitoredMetaCache)

Aggregations

MonitoredMetaCache (me.lucko.luckperms.common.cacheddata.type.MonitoredMetaCache)8 QueryOptions (net.luckperms.api.query.QueryOptions)4 List (java.util.List)2 ArgumentList (me.lucko.luckperms.common.command.utils.ArgumentList)2 PermissionHolder (me.lucko.luckperms.common.model.PermissionHolder)2 InheritanceNode (net.luckperms.api.node.types.InheritanceNode)2 MetaAccumulator (me.lucko.luckperms.common.cacheddata.type.MetaAccumulator)1 Group (me.lucko.luckperms.common.model.Group)1 ContextSet (net.luckperms.api.context.ContextSet)1