use of org.spongepowered.common.service.server.permission.SpongePermissionService in project SpongeCommon by SpongePowered.
the class DedicatedPlayerListMixin method impl$checkForPlayerLimitBypassPermission.
@Inject(method = "canBypassPlayerLimit", at = @At("HEAD"), cancellable = true)
private void impl$checkForPlayerLimitBypassPermission(final GameProfile profile, final CallbackInfoReturnable<Boolean> ci) {
final PermissionService permissionService = Sponge.server().serviceProvider().permissionService();
Subject subject = permissionService.userSubjects().subject(profile.getId().toString()).orElse(null);
if (subject == null) {
subject = permissionService.userSubjects().defaults();
}
final Tristate tristate = subject.permissionValue(LoginPermissions.BYPASS_PLAYER_LIMIT_PERMISSION);
// if we are still using the default permission service
if (tristate == Tristate.UNDEFINED && permissionService instanceof SpongePermissionService) {
return;
}
ci.setReturnValue(tristate.asBoolean());
}
Aggregations