本文整理汇总了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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}