use of io.github.nucleuspowered.nucleus.PluginInfo.DESCRIPTION in project Nucleus by NucleusPowered.
the class NucleusPlugin method registerPermissions.
@Override
protected void registerPermissions() {
Optional<PermissionService> ops = Sponge.getServiceManager().provide(PermissionService.class);
ops.ifPresent(permissionService -> {
Map<String, PermissionInformation> m = this.getPermissionRegistry().getPermissions();
m.entrySet().stream().filter(x -> {
SuggestedLevel lvl = x.getValue().level;
return lvl == SuggestedLevel.ADMIN || lvl == SuggestedLevel.OWNER;
}).filter(x -> x.getValue().isNormal).forEach(k -> permissionService.newDescriptionBuilder(this).assign(PermissionDescription.ROLE_ADMIN, true).description(k.getValue().description).id(k.getKey()).register());
m.entrySet().stream().filter(x -> x.getValue().level == SuggestedLevel.MOD).filter(x -> x.getValue().isNormal).forEach(k -> permissionService.newDescriptionBuilder(this).assign(PermissionDescription.ROLE_STAFF, true).description(k.getValue().description).id(k.getKey()).register());
m.entrySet().stream().filter(x -> x.getValue().level == SuggestedLevel.USER).filter(x -> x.getValue().isNormal).forEach(k -> permissionService.newDescriptionBuilder(this).assign(PermissionDescription.ROLE_USER, true).description(k.getValue().description).id(k.getKey()).register());
});
}
Aggregations