本文整理汇总了Java中org.spongepowered.api.service.permission.PermissionDescription.Builder方法的典型用法代码示例。如果您正苦于以下问题:Java PermissionDescription.Builder方法的具体用法?Java PermissionDescription.Builder怎么用?Java PermissionDescription.Builder使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.spongepowered.api.service.permission.PermissionDescription
的用法示例。
在下文中一共展示了PermissionDescription.Builder方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: assign
import org.spongepowered.api.service.permission.PermissionDescription; //导入方法依赖的package包/类
@Nonnull
@Override
public PermissionDescription.Builder assign(@Nonnull String permission, boolean value) {
Objects.requireNonNull(permission, "permission");
this.roles.put(permission, Tristate.fromBoolean(value));
return this;
}
示例2: newDescriptionBuilder
import org.spongepowered.api.service.permission.PermissionDescription; //导入方法依赖的package包/类
@Override
public PermissionDescription.Builder newDescriptionBuilder(@Nonnull Object o) {
Optional<PluginContainer> container = Sponge.getGame().getPluginManager().fromInstance(o);
if (!container.isPresent()) {
throw new IllegalArgumentException("Couldn't find a plugin container for " + o.getClass().getSimpleName());
}
return new LPDescriptionBuilder(this.handle, container.get());
}
示例3: newDescriptionBuilder
import org.spongepowered.api.service.permission.PermissionDescription; //导入方法依赖的package包/类
@Override
public Optional<PermissionDescription.Builder> newDescriptionBuilder(@Nonnull Object o) {
Optional<PluginContainer> container = Sponge.getGame().getPluginManager().fromInstance(o);
if (!container.isPresent()) {
throw new IllegalArgumentException("Couldn't find a plugin container for " + o.getClass().getSimpleName());
}
return Optional.of(new LPDescriptionBuilder(this.handle, container.get()));
}
示例4: newDescriptionBuilder
import org.spongepowered.api.service.permission.PermissionDescription; //导入方法依赖的package包/类
@Override
public PermissionDescription.Builder newDescriptionBuilder(final Object instance) {
Optional<PluginContainer> container = this.plugin.getGame().getPluginManager().fromInstance(instance);
if (!container.isPresent()) {
throw new IllegalArgumentException("Couldn't find a plugin container for " + instance.getClass().getSimpleName());
}
return new EPPermissionDescription.Builder(this, container.get());
}
示例5: register
import org.spongepowered.api.service.permission.PermissionDescription; //导入方法依赖的package包/类
@Override
public void register(Permission perm) {
if (this.permissions.stream().filter(p -> p.get().equalsIgnoreCase(perm.get())).count() > 0) return;
this.permissions.add(perm);
org.spongepowered.api.service.permission.PermissionService service = Sponge.getServiceManager().provide(org.spongepowered.api.service.permission.PermissionService.class).get();
Optional<PermissionDescription.Builder> builder = service.newDescriptionBuilder(UltimateCore.get());
if (!builder.isPresent()) return;
builder.get().id(perm.get()).description(perm.getDescription()).register();
}