本文整理汇总了Java中org.spongepowered.api.util.Tristate.equals方法的典型用法代码示例。如果您正苦于以下问题:Java Tristate.equals方法的具体用法?Java Tristate.equals怎么用?Java Tristate.equals使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.spongepowered.api.util.Tristate
的用法示例。
在下文中一共展示了Tristate.equals方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getLoadedWithPermission
import org.spongepowered.api.util.Tristate; //导入方法依赖的package包/类
@Override
public Map<Subject, Boolean> getLoadedWithPermission(String permission) {
Preconditions.checkNotNull(permission, "permission");
ImmutableMap.Builder<Subject, Boolean> builder = ImmutableMap.builder();
for (Subject subject : this.identifierSubjects.values()) {
Tristate value = subject.getPermissionValue(subject.getActiveContexts(), permission);
if (!value.equals(Tristate.UNDEFINED)) {
builder.put(subject, value.asBoolean());
}
}
return builder.build();
}
示例2: getAllWithPermission
import org.spongepowered.api.util.Tristate; //导入方法依赖的package包/类
@Override
public CompletableFuture<Map<SubjectReference, Boolean>> getAllWithPermission(Set<Context> contexts, String permission) {
Preconditions.checkNotNull(contexts, "contexts");
Preconditions.checkNotNull(permission, "permission");
ImmutableMap.Builder<SubjectReference, Boolean> builder = ImmutableMap.builder();
for (Subject subject : this.identifierSubjects.values()) {
Tristate value = subject.getPermissionValue(contexts, permission);
if (!value.equals(Tristate.UNDEFINED)) {
builder.put(subject.asSubjectReference(), value.asBoolean());
}
}
return CompletableFuture.completedFuture(builder.build());
}
示例3: setPermission
import org.spongepowered.api.util.Tristate; //导入方法依赖的package包/类
public boolean setPermission(final EPSubjectData<?> subject, final String permission, final Tristate value, final boolean insert) {
ConfigurationNode permissions = this.getNode().getNode(subject.getIdentifier(), "permissions");
// Supprime une permission
if (value.equals(Tristate.UNDEFINED)) {
permissions.removeChild(permission);
this.plugin.getELogger().debug("Removed from configs file : (identifier='" + subject + "';permission='" + permission + "';type='" + this.typeWorld + "')");
// Ajoute une permission
} else {
permissions.getNode(permission).setValue(value.asBoolean());
this.plugin.getELogger().debug("Added to the configs file : (identifier='" + subject + "';permission='" + permission + "';value='" + value.asBoolean() + "';type='" + this.typeWorld + "')");
}
return this.save(true);
}
示例4: command
import org.spongepowered.api.util.Tristate; //导入方法依赖的package包/类
private CompletableFuture<Boolean> command(final CommandSource player, final String groupName, final String permission, final String worldName) throws EMessageException {
String typeGroup = EPCommand.getTypeWorld(player, this.plugin.getService().getGroupSubjects(), worldName);
EGroupSubject group = EPCommand.getGroup(player, this.plugin.getService(), groupName, typeGroup);
Set<Context> contexts = EPContextCalculator.of(worldName);
Tristate value = group.getPermissionValue(contexts, permission);
// Permission : True
if (value.equals(Tristate.TRUE)) {
EPMessages.GROUP_PERMISSION_CHECK_TRUE.sender()
.replace("{group}", group.getFriendlyIdentifier().orElse(groupName))
.replace("{permission}", permission)
.replace("{type}", typeGroup)
.sendTo(player);
// Permission : False
} else if (value.equals(Tristate.FALSE)) {
EPMessages.GROUP_PERMISSION_CHECK_FALSE.sender()
.replace("{group}", group.getFriendlyIdentifier().orElse(groupName))
.replace("{permission}", permission)
.replace("{type}", typeGroup)
.sendTo(player);
// Permission : Undefined
} else {
EPMessages.GROUP_PERMISSION_CHECK_UNDEFINED.sender()
.replace("{group}", group.getFriendlyIdentifier().orElse(groupName))
.replace("{permission}", permission)
.replace("{type}", typeGroup)
.sendTo(player);
}
return CompletableFuture.completedFuture(true);
}
示例5: command
import org.spongepowered.api.util.Tristate; //导入方法依赖的package包/类
private void command(final CommandSource staff, final EUserSubject subject, final String permission, final String worldName, final String typeUser) {
Set<Context> contexts = EPContextCalculator.of(worldName);
Tristate value = subject.getPermissionValue(contexts, permission);
// Permission : True
if (value.equals(Tristate.TRUE)) {
EPMessages.COLLECTION_PERMISSION_CHECK_TRUE.sender()
.replace("{subject}", subject.getIdentifier())
.replace("{collection}", subject.getCollectionIdentifier())
.replace("{permission}", permission)
.replace("{type}", typeUser)
.sendTo(staff);
// Permission : False
} else if (value.equals(Tristate.FALSE)) {
EPMessages.COLLECTION_PERMISSION_CHECK_FALSE.sender()
.replace("{subject}", subject.getIdentifier())
.replace("{collection}", subject.getCollectionIdentifier())
.replace("{permission}", permission)
.replace("{type}", typeUser)
.sendTo(staff);
// Permission : Undefined
} else {
EPMessages.COLLECTION_PERMISSION_CHECK_UNDEFINED.sender()
.replace("{subject}", subject.getIdentifier())
.replace("{collection}", subject.getCollectionIdentifier())
.replace("{permission}", permission)
.replace("{type}", typeUser)
.sendTo(staff);
}
}
示例6: command
import org.spongepowered.api.util.Tristate; //导入方法依赖的package包/类
private void command(final CommandSource staff, final EUser user, final EUserSubject subject, final String permission,
final String worldName, final String typeUser) {
Set<Context> contexts = EPContextCalculator.of(worldName);
Tristate value = user.getPermissionValue(contexts, permission);
// Permission : True
if (value.equals(Tristate.TRUE)) {
// La source et le joueur sont identique
if (staff.getIdentifier().equals(user.getIdentifier())) {
EPMessages.USER_PERMISSION_CHECK_TRUE_EQUALS.sender()
.replace("{player}", user.getName())
.replace("{permission}", permission)
.replace("{type}", typeUser)
.sendTo(staff);
// La source et le joueur ne sont pas identique
} else {
EPMessages.USER_PERMISSION_CHECK_TRUE_STAFF.sender()
.replace("{player}", user.getName())
.replace("{permission}", permission)
.replace("{type}", typeUser)
.sendTo(staff);
}
// Permission : False
} else if (value.equals(Tristate.FALSE)) {
// La source et le joueur sont identique
if (staff.getIdentifier().equals(user.getIdentifier())) {
EPMessages.USER_PERMISSION_CHECK_FALSE_EQUALS.sender()
.replace("{player}", user.getName())
.replace("{permission}", permission)
.replace("{type}", typeUser)
.sendTo(staff);
// La source et le joueur ne sont pas identique
} else {
EPMessages.USER_PERMISSION_CHECK_FALSE_STAFF.sender()
.replace("{player}", user.getName())
.replace("{permission}", permission)
.replace("{type}", typeUser)
.sendTo(staff);
}
// Permission : Undefined
} else {
// La source et le joueur sont identique
if (staff.getIdentifier().equals(user.getIdentifier())) {
EPMessages.USER_PERMISSION_CHECK_UNDEFINED_EQUALS.sender()
.replace("{player}", user.getName())
.replace("{permission}", permission)
.replace("{type}", typeUser)
.sendTo(staff);
// La source et le joueur ne sont pas identique
} else {
EPMessages.USER_PERMISSION_CHECK_UNDEFINED_STAFF.sender()
.replace("{player}", user.getName())
.replace("{permission}", permission)
.replace("{type}", typeUser)
.sendTo(staff);
}
}
}