try to hotfix permission expiring

This commit is contained in:
_Bastler 2023-12-18 09:58:47 +01:00
parent ba28c98e44
commit 2bac10502d

View File

@ -416,20 +416,16 @@ public class PermissionManager implements UserDataProvider {
List<Permission> existingPermissions = get(target, name);
for (Permission existingPermission : existingPermissions) {
if (existingPermission.getExpires().isBefore(permissionsExpires)
|| permissionMapping.isLifetimeRound() && InstantHelper
.truncate(existingPermission.getExpires(), permissionMapping.getLifetimeUnit())
.isBefore(InstantHelper.truncate(permissionsExpires,
permissionMapping.getLifetimeUnit()))) {
if (starts != null) {
if (existingPermission.getStarts() == null || existingPermission.getStarts().isAfter(starts)
|| existingPermission.getExpires().isAfter(starts)) {
permission = existingPermission;
break;
}
} else if (existingPermission.getStarts() == null) {
if (additional && existingPermission.getExpires().isAfter(Instant.now())
&& (starts == null && (existingPermission.getStarts() == null
|| existingPermission.getStarts().isBefore(Instant.now()))
|| starts != null && (starts.isBefore(existingPermission.getExpires())
|| existingPermission.getStarts() != null
&& starts.isAfter(existingPermission.getStarts())))) {
if (permission == null) {
permission = existingPermission;
} else if (existingPermission.getExpires().isAfter(permission.getExpires())) {
permission = existingPermission;
break;
}
}
}