Search in sources :

Example 6 with MetaCache

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

the class VaultChatHook method getGroupChatSuffix.

@Override
public String getGroupChatSuffix(String world, String name) {
    Objects.requireNonNull(name, "name");
    Group group = getGroup(name);
    if (group == null) {
        return null;
    }
    Contexts contexts = this.permissionHook.contextForLookup(null, world);
    MetaCache metaData = group.getCachedData().getMetaData(contexts);
    String ret = metaData.getSuffix();
    if (log()) {
        logMsg("#getGroupSuffix: %s - %s - %s", group.getName(), contexts.getContexts().toMultimap(), ret);
    }
    return Strings.nullToEmpty(ret);
}
Also used : Group(me.lucko.luckperms.common.model.Group) Contexts(me.lucko.luckperms.api.Contexts) MetaCache(me.lucko.luckperms.common.caching.type.MetaCache)

Example 7 with MetaCache

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

the class VaultChatHook method getUserChatPrefix.

@Override
public String getUserChatPrefix(String world, UUID uuid) {
    if (uuid == null) {
        return null;
    }
    User user = getUser(uuid);
    if (user == null) {
        return null;
    }
    Contexts contexts = this.permissionHook.contextForLookup(user, world);
    MetaCache metaData = user.getCachedData().getMetaData(contexts);
    String ret = metaData.getPrefix();
    if (log()) {
        logMsg("#getUserChatPrefix: %s - %s - %s", user.getFriendlyName(), contexts.getContexts().toMultimap(), ret);
    }
    return Strings.nullToEmpty(ret);
}
Also used : User(me.lucko.luckperms.common.model.User) Contexts(me.lucko.luckperms.api.Contexts) MetaCache(me.lucko.luckperms.common.caching.type.MetaCache)

Example 8 with MetaCache

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

the class VaultChatHook method getUserChatSuffix.

@Override
public String getUserChatSuffix(String world, UUID uuid) {
    if (uuid == null) {
        return null;
    }
    User user = getUser(uuid);
    if (user == null) {
        return null;
    }
    Contexts contexts = this.permissionHook.contextForLookup(user, world);
    MetaCache metaData = user.getCachedData().getMetaData(contexts);
    String ret = metaData.getSuffix();
    if (log()) {
        logMsg("#getUserChatSuffix: %s - %s - %s", user.getFriendlyName(), contexts.getContexts().toMultimap(), ret);
    }
    return Strings.nullToEmpty(ret);
}
Also used : User(me.lucko.luckperms.common.model.User) Contexts(me.lucko.luckperms.api.Contexts) MetaCache(me.lucko.luckperms.common.caching.type.MetaCache)

Aggregations

MetaCache (me.lucko.luckperms.common.caching.type.MetaCache)8 Contexts (me.lucko.luckperms.api.Contexts)7 Group (me.lucko.luckperms.common.model.Group)3 User (me.lucko.luckperms.common.model.User)3 MetaAccumulator (me.lucko.luckperms.common.caching.type.MetaAccumulator)2 CacheLoader (com.github.benmanes.caffeine.cache.CacheLoader)1 Caffeine (com.github.benmanes.caffeine.cache.Caffeine)1 LoadingCache (com.github.benmanes.caffeine.cache.LoadingCache)1 HashSet (java.util.HashSet)1 Map (java.util.Map)1 Objects (java.util.Objects)1 Set (java.util.Set)1 CompletableFuture (java.util.concurrent.CompletableFuture)1 TimeUnit (java.util.concurrent.TimeUnit)1 Nonnull (javax.annotation.Nonnull)1 ChatMetaType (me.lucko.luckperms.api.ChatMetaType)1 FullySatisfiedContexts (me.lucko.luckperms.api.FullySatisfiedContexts)1 CachedData (me.lucko.luckperms.api.caching.CachedData)1 MetaContexts (me.lucko.luckperms.api.caching.MetaContexts)1 PermissionCache (me.lucko.luckperms.common.caching.type.PermissionCache)1