Search in sources :

Example 1 with MetaCache

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

the class LuckPermsVaultChat method getUserChatPrefix.

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

Example 2 with MetaCache

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

the class PermissionHolderSubject method getOption.

@Override
public Optional<String> getOption(ImmutableContextSet contexts, String s) {
    MetaCache data = this.parent.getCachedData().getMetaData(this.plugin.getContextManager().formQueryOptions(contexts));
    if (s.equalsIgnoreCase(Prefix.NODE_KEY)) {
        String prefix = data.getPrefix(CheckOrigin.PLATFORM_API).result();
        if (prefix != null) {
            return Optional.of(prefix);
        }
    }
    if (s.equalsIgnoreCase(Suffix.NODE_KEY)) {
        String suffix = data.getSuffix(CheckOrigin.PLATFORM_API).result();
        if (suffix != null) {
            return Optional.of(suffix);
        }
    }
    String val = data.getMetaValue(s, CheckOrigin.PLATFORM_API).result();
    if (val != null) {
        return Optional.of(val);
    }
    Optional<String> v = getParentCollection().getDefaults().getOption(contexts, s);
    if (v.isPresent()) {
        return v;
    }
    return this.plugin.getService().getRootDefaults().getOption(contexts, s);
}
Also used : MetaCache(me.lucko.luckperms.common.cacheddata.type.MetaCache)

Example 3 with MetaCache

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

the class LuckPermsVaultChat method getUserChatSuffix.

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

Aggregations

MetaCache (me.lucko.luckperms.common.cacheddata.type.MetaCache)3 MonitoredMetaCache (me.lucko.luckperms.common.cacheddata.type.MonitoredMetaCache)2 PermissionHolder (me.lucko.luckperms.common.model.PermissionHolder)2 QueryOptions (net.luckperms.api.query.QueryOptions)2