use of me.lucko.luckperms.sponge.service.model.LPPermissionDescription in project LuckPerms by lucko.
the class DescriptionBuilder method register.
@Nonnull
@Override
public PermissionDescription register() throws IllegalStateException {
if (this.id == null) {
throw new IllegalStateException("id cannot be null");
}
LPPermissionDescription description = this.service.registerPermissionDescription(this.id, this.description, this.container);
// Set role-templates
LPSubjectCollection subjects = this.service.getCollection(PermissionService.SUBJECTS_ROLE_TEMPLATE);
for (Map.Entry<String, Tristate> assignment : this.roles.entrySet()) {
LPSubject roleSubject = subjects.loadSubject(assignment.getKey()).join();
roleSubject.getTransientSubjectData().setPermission(ContextSet.empty(), this.id, assignment.getValue());
}
this.service.getPlugin().getPermissionVault().offer(this.id);
// null stuff so this instance can be reused
this.roles.clear();
this.id = null;
this.description = null;
return description.sponge();
}
use of me.lucko.luckperms.sponge.service.model.LPPermissionDescription in project LuckPerms by lucko.
the class DescriptionBuilder method register.
@Nonnull
@Override
public PermissionDescription register() throws IllegalStateException {
if (this.id == null) {
throw new IllegalStateException("id cannot be null");
}
LPPermissionDescription description = this.service.registerPermissionDescription(this.id, this.description, this.container);
// Set role-templates
LPSubjectCollection subjects = this.service.getCollection(PermissionService.SUBJECTS_ROLE_TEMPLATE);
for (Map.Entry<String, Tristate> assignment : this.roles.entrySet()) {
LPSubject roleSubject = subjects.loadSubject(assignment.getKey()).join();
roleSubject.getTransientSubjectData().setPermission(ContextSet.empty(), this.id, assignment.getValue());
}
this.service.getPlugin().getPermissionVault().offer(this.id);
// null stuff so this instance can be reused
this.roles.clear();
this.id = null;
this.description = null;
return description.sponge();
}
Aggregations