mirror of
https://github.com/LuckPerms/LuckPerms.git
synced 2024-11-27 21:29:47 +01:00
Fix temporary permission expirations never persisting. Fixes #30
This commit is contained in:
parent
d113a92ce5
commit
c66a01c1a6
@ -112,8 +112,6 @@ public abstract class PermissionHolder {
|
||||
this.nodes.clear();
|
||||
this.nodes.addAll(nodes);
|
||||
}
|
||||
|
||||
auditTemporaryPermissions();
|
||||
}
|
||||
|
||||
public void setTransientNodes(Set<Node> nodes) {
|
||||
@ -125,8 +123,6 @@ public abstract class PermissionHolder {
|
||||
this.transientNodes.clear();
|
||||
this.transientNodes.addAll(nodes);
|
||||
}
|
||||
|
||||
auditTemporaryPermissions();
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
@ -141,8 +137,6 @@ public abstract class PermissionHolder {
|
||||
.map(e -> me.lucko.luckperms.common.core.Node.fromSerialisedNode(e.getKey(), e.getValue()))
|
||||
.collect(Collectors.toList()));
|
||||
}
|
||||
|
||||
auditTemporaryPermissions();
|
||||
}
|
||||
|
||||
public void addNodeUnchecked(Node node) {
|
||||
|
@ -24,7 +24,6 @@ package me.lucko.luckperms.common.runnables;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import me.lucko.luckperms.common.LuckPermsPlugin;
|
||||
import me.lucko.luckperms.common.core.PermissionHolder;
|
||||
import me.lucko.luckperms.common.groups.Group;
|
||||
import me.lucko.luckperms.common.users.User;
|
||||
|
||||
@ -34,20 +33,21 @@ public class ExpireTemporaryTask implements Runnable {
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
boolean changes = false;
|
||||
boolean groupChanges = false;
|
||||
for (Group group : plugin.getGroupManager().getAll().values()) {
|
||||
if (group.auditTemporaryPermissions()) {
|
||||
changes = true;
|
||||
plugin.getDatastore().saveGroup(group);
|
||||
groupChanges = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (changes) {
|
||||
plugin.runUpdateTask();
|
||||
return;
|
||||
for (User user : plugin.getUserManager().getAll().values()) {
|
||||
if (user.auditTemporaryPermissions()) {
|
||||
plugin.getDatastore().saveUser(user);
|
||||
if (!groupChanges) {
|
||||
user.refreshPermissions();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
plugin.getUserManager().getAll().values().stream()
|
||||
.filter(PermissionHolder::auditTemporaryPermissions)
|
||||
.forEach(User::refreshPermissions);
|
||||
}
|
||||
}
|
@ -134,7 +134,10 @@ public class UserManager extends AbstractManager<UserIdentifier, User> {
|
||||
Set<UUID> players = plugin.getOnlinePlayers();
|
||||
plugin.doAsync(() -> {
|
||||
for (UUID uuid : players) {
|
||||
plugin.getDatastore().loadUser(plugin.getUuidCache().getUUID(uuid), "null");
|
||||
UUID internal = plugin.getUuidCache().getUUID(uuid);
|
||||
plugin.getDatastore().loadUser(internal, "null");
|
||||
User user = get(internal);
|
||||
user.refreshPermissions();
|
||||
}
|
||||
});
|
||||
});
|
||||
|
Loading…
Reference in New Issue
Block a user