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.clear();
|
||||||
this.nodes.addAll(nodes);
|
this.nodes.addAll(nodes);
|
||||||
}
|
}
|
||||||
|
|
||||||
auditTemporaryPermissions();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setTransientNodes(Set<Node> nodes) {
|
public void setTransientNodes(Set<Node> nodes) {
|
||||||
@ -125,8 +123,6 @@ public abstract class PermissionHolder {
|
|||||||
this.transientNodes.clear();
|
this.transientNodes.clear();
|
||||||
this.transientNodes.addAll(nodes);
|
this.transientNodes.addAll(nodes);
|
||||||
}
|
}
|
||||||
|
|
||||||
auditTemporaryPermissions();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Deprecated
|
@Deprecated
|
||||||
@ -141,8 +137,6 @@ public abstract class PermissionHolder {
|
|||||||
.map(e -> me.lucko.luckperms.common.core.Node.fromSerialisedNode(e.getKey(), e.getValue()))
|
.map(e -> me.lucko.luckperms.common.core.Node.fromSerialisedNode(e.getKey(), e.getValue()))
|
||||||
.collect(Collectors.toList()));
|
.collect(Collectors.toList()));
|
||||||
}
|
}
|
||||||
|
|
||||||
auditTemporaryPermissions();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void addNodeUnchecked(Node node) {
|
public void addNodeUnchecked(Node node) {
|
||||||
|
@ -24,7 +24,6 @@ package me.lucko.luckperms.common.runnables;
|
|||||||
|
|
||||||
import lombok.AllArgsConstructor;
|
import lombok.AllArgsConstructor;
|
||||||
import me.lucko.luckperms.common.LuckPermsPlugin;
|
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.groups.Group;
|
||||||
import me.lucko.luckperms.common.users.User;
|
import me.lucko.luckperms.common.users.User;
|
||||||
|
|
||||||
@ -34,20 +33,21 @@ public class ExpireTemporaryTask implements Runnable {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
boolean changes = false;
|
boolean groupChanges = false;
|
||||||
for (Group group : plugin.getGroupManager().getAll().values()) {
|
for (Group group : plugin.getGroupManager().getAll().values()) {
|
||||||
if (group.auditTemporaryPermissions()) {
|
if (group.auditTemporaryPermissions()) {
|
||||||
changes = true;
|
plugin.getDatastore().saveGroup(group);
|
||||||
|
groupChanges = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (changes) {
|
for (User user : plugin.getUserManager().getAll().values()) {
|
||||||
plugin.runUpdateTask();
|
if (user.auditTemporaryPermissions()) {
|
||||||
return;
|
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();
|
Set<UUID> players = plugin.getOnlinePlayers();
|
||||||
plugin.doAsync(() -> {
|
plugin.doAsync(() -> {
|
||||||
for (UUID uuid : players) {
|
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