当前位置: 首页>>代码示例>>Java>>正文


Java DataMutateResult.ALREADY_HAS属性代码示例

本文整理汇总了Java中me.lucko.luckperms.api.DataMutateResult.ALREADY_HAS属性的典型用法代码示例。如果您正苦于以下问题:Java DataMutateResult.ALREADY_HAS属性的具体用法?Java DataMutateResult.ALREADY_HAS怎么用?Java DataMutateResult.ALREADY_HAS使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在me.lucko.luckperms.api.DataMutateResult的用法示例。


在下文中一共展示了DataMutateResult.ALREADY_HAS属性的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: setPermission

/**
 * Sets a permission node
 *
 * @param node the node to set
 */
public DataMutateResult setPermission(Node node) {
    if (hasPermission(node, false) != Tristate.UNDEFINED) {
        return DataMutateResult.ALREADY_HAS;
    }

    ImmutableCollection<Node> before = getEnduringNodes().values();

    this.nodesLock.lock();
    try {
        this.nodes.put(node.getFullContexts().makeImmutable(), node);
    } finally {
        this.nodesLock.unlock();
    }
    invalidateCache();

    ImmutableCollection<Node> after = getEnduringNodes().values();

    this.plugin.getEventFactory().handleNodeAdd(node, this, before, after);
    return DataMutateResult.SUCCESS;
}
 
开发者ID:lucko,项目名称:LuckPerms,代码行数:25,代码来源:PermissionHolder.java

示例2: setTransientPermission

/**
 * Sets a transient permission node
 *
 * @param node the node to set
 */
public DataMutateResult setTransientPermission(Node node) {
    if (hasPermission(node, true) != Tristate.UNDEFINED) {
        return DataMutateResult.ALREADY_HAS;
    }

    ImmutableCollection<Node> before = getTransientNodes().values();

    this.transientNodesLock.lock();
    try {
        this.transientNodes.put(node.getFullContexts().makeImmutable(), node);
    } finally {
        this.transientNodesLock.unlock();
    }

    invalidateCache();

    ImmutableCollection<Node> after = getTransientNodes().values();

    this.plugin.getEventFactory().handleNodeAdd(node, this, before, after);
    return DataMutateResult.SUCCESS;
}
 
开发者ID:lucko,项目名称:LuckPerms,代码行数:26,代码来源:PermissionHolder.java

示例3: setPrimaryGroup

@Override
public DataMutateResult setPrimaryGroup(@Nonnull String group) {
    Objects.requireNonNull(group, "group");
    if (getPrimaryGroup().equalsIgnoreCase(group)) {
        return DataMutateResult.ALREADY_HAS;
    }

    if (!this.handle.hasPermission(NodeFactory.buildGroupNode(group.toLowerCase()).build()).asBoolean()) {
        return DataMutateResult.FAIL;
    }

    this.handle.getPrimaryGroup().setStoredValue(group.toLowerCase());
    return DataMutateResult.SUCCESS;
}
 
开发者ID:lucko,项目名称:LuckPerms,代码行数:14,代码来源:ApiUser.java

示例4: appendGroup

/**
 * Appends a group to the end of this track
 *
 * @param group the group to append
 * @return the result of the operation
 */
public DataMutateResult appendGroup(Group group) {
    if (containsGroup(group)) {
        return DataMutateResult.ALREADY_HAS;
    }

    List<String> before = ImmutableList.copyOf(this.groups);
    this.groups.add(group.getName());
    List<String> after = ImmutableList.copyOf(this.groups);

    this.plugin.getEventFactory().handleTrackAddGroup(this, group.getName(), before, after);
    return DataMutateResult.SUCCESS;
}
 
开发者ID:lucko,项目名称:LuckPerms,代码行数:18,代码来源:Track.java

示例5: insertGroup

/**
 * Inserts a group at a certain position on this track
 *
 * @param group    the group to be inserted
 * @param position the index position (a value of 0 inserts at the start)
 * @throws IndexOutOfBoundsException if the position is less than 0 or greater than the size of the track
 * @return the result of the operation
 */
public DataMutateResult insertGroup(Group group, int position) throws IndexOutOfBoundsException {
    if (containsGroup(group)) {
        return DataMutateResult.ALREADY_HAS;
    }

    List<String> before = ImmutableList.copyOf(this.groups);
    this.groups.add(position, group.getName());
    List<String> after = ImmutableList.copyOf(this.groups);

    this.plugin.getEventFactory().handleTrackAddGroup(this, group.getName(), before, after);
    return DataMutateResult.SUCCESS;
}
 
开发者ID:lucko,项目名称:LuckPerms,代码行数:20,代码来源:Track.java


注:本文中的me.lucko.luckperms.api.DataMutateResult.ALREADY_HAS属性示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。