Search in sources :

Example 11 with Group

use of me.lucko.luckperms.common.model.Group in project LuckPerms by lucko.

the class VaultChatHook method getGroupMeta.

@Override
public String getGroupMeta(String world, String name, String key) {
    Objects.requireNonNull(name, "name");
    Objects.requireNonNull(key, "key");
    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.getMeta().get(key);
    if (log()) {
        logMsg("#getGroupMeta: %s - %s - %s - %s", group.getName(), contexts.getContexts().toMultimap(), key, ret);
    }
    return 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 12 with Group

use of me.lucko.luckperms.common.model.Group in project LuckPerms by lucko.

the class VaultChatHook method setGroupChatSuffix.

@Override
public void setGroupChatSuffix(String world, String name, String suffix) {
    Objects.requireNonNull(name, "name");
    Group group = getGroup(name);
    if (group == null) {
        return;
    }
    setChatMeta(group, ChatMetaType.SUFFIX, suffix, world);
}
Also used : Group(me.lucko.luckperms.common.model.Group)

Example 13 with Group

use of me.lucko.luckperms.common.model.Group in project LuckPerms by lucko.

the class VaultChatHook method getGroupChatPrefix.

@Override
public String getGroupChatPrefix(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.getPrefix();
    if (log()) {
        logMsg("#getGroupPrefix: %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 14 with Group

use of me.lucko.luckperms.common.model.Group in project LuckPerms by lucko.

the class VaultPermissionHook method groupAddPermission.

@Override
public boolean groupAddPermission(String world, String name, String permission) {
    Objects.requireNonNull(name, "name");
    Objects.requireNonNull(permission, "permission");
    Group group = getGroup(name);
    if (group == null) {
        return false;
    }
    holderAddPermission(group, permission, world);
    return true;
}
Also used : Group(me.lucko.luckperms.common.model.Group)

Example 15 with Group

use of me.lucko.luckperms.common.model.Group in project LuckPerms by lucko.

the class VaultPermissionHook method holderSave.

void holderSave(PermissionHolder holder) {
    if (holder.getType().isUser()) {
        User u = (User) holder;
        this.plugin.getStorage().saveUser(u).thenRunAsync(() -> u.getRefreshBuffer().request(), this.plugin.getBootstrap().getScheduler().async());
    }
    if (holder.getType().isGroup()) {
        Group g = (Group) holder;
        this.plugin.getStorage().saveGroup(g).thenRunAsync(() -> this.plugin.getUpdateTaskBuffer().request(), this.plugin.getBootstrap().getScheduler().async());
    }
}
Also used : Group(me.lucko.luckperms.common.model.Group) User(me.lucko.luckperms.common.model.User)

Aggregations

Group (me.lucko.luckperms.common.model.Group)52 User (me.lucko.luckperms.common.model.User)20 Node (me.lucko.luckperms.api.Node)16 Set (java.util.Set)10 UUID (java.util.UUID)10 Track (me.lucko.luckperms.common.model.Track)10 NodeFactory (me.lucko.luckperms.common.node.NodeFactory)10 List (java.util.List)9 LuckPermsPlugin (me.lucko.luckperms.common.plugin.LuckPermsPlugin)9 Contexts (me.lucko.luckperms.api.Contexts)8 PermissionHolder (me.lucko.luckperms.common.model.PermissionHolder)8 Sender (me.lucko.luckperms.common.sender.Sender)8 HashSet (java.util.HashSet)7 Map (java.util.Map)7 Collectors (java.util.stream.Collectors)7 MutableContextSet (me.lucko.luckperms.api.context.MutableContextSet)7 CommandResult (me.lucko.luckperms.common.command.CommandResult)7 CommandPermission (me.lucko.luckperms.common.command.access.CommandPermission)7 LocaleManager (me.lucko.luckperms.common.locale.LocaleManager)7 CommandSpec (me.lucko.luckperms.common.locale.command.CommandSpec)7