mirror of
https://github.com/LuckPerms/LuckPerms.git
synced 2026-11-24 08:14:25 +00:00
Permission holder refactoring
This commit is contained in:
85 files changed
+663
-721
No files matched your search
@@ -25,7 +25,7 @@
|
||||
|
||||
package me.lucko.luckperms.sponge.service;
|
||||
|
||||
import me.lucko.luckperms.common.model.NodeMapType;
|
||||
import me.lucko.luckperms.api.model.DataType;
|
||||
import me.lucko.luckperms.sponge.service.model.LPPermissionDescription;
|
||||
import me.lucko.luckperms.sponge.service.model.LPPermissionService;
|
||||
import me.lucko.luckperms.sponge.service.model.LPSubject;
|
||||
@@ -75,8 +75,8 @@ public final class ProxyFactory {
|
||||
public static SubjectData toSponge(LPSubjectData luckPerms) {
|
||||
LPSubject parentSubject = luckPerms.getParentSubject();
|
||||
return IS_API_7 ?
|
||||
new me.lucko.luckperms.sponge.service.proxy.api7.SubjectDataProxy(parentSubject.getService(), parentSubject.toReference(), luckPerms.getType() == NodeMapType.ENDURING) :
|
||||
new me.lucko.luckperms.sponge.service.proxy.api6.SubjectDataProxy(parentSubject.getService(), parentSubject.toReference(), luckPerms.getType() == NodeMapType.ENDURING);
|
||||
new me.lucko.luckperms.sponge.service.proxy.api7.SubjectDataProxy(parentSubject.getService(), parentSubject.toReference(), luckPerms.getType() == DataType.NORMAL) :
|
||||
new me.lucko.luckperms.sponge.service.proxy.api6.SubjectDataProxy(parentSubject.getService(), parentSubject.toReference(), luckPerms.getType() == DataType.NORMAL);
|
||||
}
|
||||
|
||||
public static PermissionDescription toSponge(LPPermissionDescription luckPerms) {
|
||||
|
||||
+4
-4
@@ -30,10 +30,10 @@ import com.google.common.collect.ImmutableMap;
|
||||
import com.google.common.collect.ImmutableSet;
|
||||
|
||||
import me.lucko.luckperms.api.context.ImmutableContextSet;
|
||||
import me.lucko.luckperms.api.model.DataType;
|
||||
import me.lucko.luckperms.api.node.Tristate;
|
||||
import me.lucko.luckperms.api.query.QueryOptions;
|
||||
import me.lucko.luckperms.common.context.ContextSetComparator;
|
||||
import me.lucko.luckperms.common.model.NodeMapType;
|
||||
import me.lucko.luckperms.sponge.service.ProxyFactory;
|
||||
import me.lucko.luckperms.sponge.service.model.LPPermissionService;
|
||||
import me.lucko.luckperms.sponge.service.model.LPSubject;
|
||||
@@ -58,14 +58,14 @@ import java.util.concurrent.ConcurrentHashMap;
|
||||
*/
|
||||
public class CalculatedSubjectData implements LPSubjectData {
|
||||
private final LPSubject parentSubject;
|
||||
private final NodeMapType type;
|
||||
private final DataType type;
|
||||
private final LPPermissionService service;
|
||||
|
||||
private final Map<ImmutableContextSet, Map<String, Boolean>> permissions = new ConcurrentHashMap<>();
|
||||
private final Map<ImmutableContextSet, Set<LPSubjectReference>> parents = new ConcurrentHashMap<>();
|
||||
private final Map<ImmutableContextSet, Map<String, String>> options = new ConcurrentHashMap<>();
|
||||
|
||||
public CalculatedSubjectData(LPSubject parentSubject, NodeMapType type, LPPermissionService service) {
|
||||
public CalculatedSubjectData(LPSubject parentSubject, DataType type, LPPermissionService service) {
|
||||
this.parentSubject = parentSubject;
|
||||
this.type = type;
|
||||
this.service = service;
|
||||
@@ -82,7 +82,7 @@ public class CalculatedSubjectData implements LPSubjectData {
|
||||
}
|
||||
|
||||
@Override
|
||||
public NodeMapType getType() {
|
||||
public DataType getType() {
|
||||
return this.type;
|
||||
}
|
||||
|
||||
|
||||
+2
-2
@@ -26,8 +26,8 @@
|
||||
package me.lucko.luckperms.sponge.service.model.calculated;
|
||||
|
||||
import me.lucko.luckperms.api.context.ImmutableContextSet;
|
||||
import me.lucko.luckperms.api.model.DataType;
|
||||
import me.lucko.luckperms.api.node.Tristate;
|
||||
import me.lucko.luckperms.common.model.NodeMapType;
|
||||
import me.lucko.luckperms.sponge.service.LuckPermsService;
|
||||
import me.lucko.luckperms.sponge.service.model.LPSubject;
|
||||
import me.lucko.luckperms.sponge.service.model.LPSubjectReference;
|
||||
@@ -38,7 +38,7 @@ import java.util.concurrent.CompletableFuture;
|
||||
* Extension of CalculatedSubjectData which allows subclasses to respond to updates
|
||||
*/
|
||||
public abstract class MonitoredSubjectData extends CalculatedSubjectData {
|
||||
public MonitoredSubjectData(LPSubject subject, NodeMapType type, LuckPermsService service) {
|
||||
public MonitoredSubjectData(LPSubject subject, DataType type, LuckPermsService service) {
|
||||
super(subject, type, service);
|
||||
}
|
||||
|
||||
|
||||
+3
-3
@@ -28,13 +28,13 @@ package me.lucko.luckperms.sponge.service.model.permissionholder;
|
||||
import com.google.common.collect.ImmutableList;
|
||||
|
||||
import me.lucko.luckperms.api.context.ImmutableContextSet;
|
||||
import me.lucko.luckperms.api.model.DataType;
|
||||
import me.lucko.luckperms.api.node.Tristate;
|
||||
import me.lucko.luckperms.api.query.QueryOptions;
|
||||
import me.lucko.luckperms.common.cacheddata.type.MetaCache;
|
||||
import me.lucko.luckperms.common.graph.TraversalAlgorithm;
|
||||
import me.lucko.luckperms.common.inheritance.InheritanceGraph;
|
||||
import me.lucko.luckperms.common.model.Group;
|
||||
import me.lucko.luckperms.common.model.NodeMapType;
|
||||
import me.lucko.luckperms.common.model.PermissionHolder;
|
||||
import me.lucko.luckperms.common.node.factory.NodeFactory;
|
||||
import me.lucko.luckperms.common.node.factory.NodeTypes;
|
||||
@@ -67,8 +67,8 @@ public abstract class PermissionHolderSubject<T extends PermissionHolder> implem
|
||||
PermissionHolderSubject(LPSpongePlugin plugin, T parent) {
|
||||
this.parent = parent;
|
||||
this.plugin = plugin;
|
||||
this.subjectData = new PermissionHolderSubjectData(plugin.getService(), NodeMapType.ENDURING, parent, this);
|
||||
this.transientSubjectData = new PermissionHolderSubjectData(plugin.getService(), NodeMapType.TRANSIENT, parent, this);
|
||||
this.subjectData = new PermissionHolderSubjectData(plugin.getService(), DataType.NORMAL, parent, this);
|
||||
this.transientSubjectData = new PermissionHolderSubjectData(plugin.getService(), DataType.TRANSIENT, parent, this);
|
||||
}
|
||||
|
||||
public void fireUpdateEvent() {
|
||||
|
||||
+181
-89
@@ -30,6 +30,7 @@ import com.google.common.collect.ImmutableMap;
|
||||
|
||||
import me.lucko.luckperms.api.context.ImmutableContextSet;
|
||||
import me.lucko.luckperms.api.model.DataMutateResult;
|
||||
import me.lucko.luckperms.api.model.DataType;
|
||||
import me.lucko.luckperms.api.node.ChatMetaType;
|
||||
import me.lucko.luckperms.api.node.Node;
|
||||
import me.lucko.luckperms.api.node.NodeType;
|
||||
@@ -42,7 +43,6 @@ import me.lucko.luckperms.api.query.QueryOptions;
|
||||
import me.lucko.luckperms.common.cacheddata.type.MetaAccumulator;
|
||||
import me.lucko.luckperms.common.model.Group;
|
||||
import me.lucko.luckperms.common.model.HolderType;
|
||||
import me.lucko.luckperms.common.model.NodeMapType;
|
||||
import me.lucko.luckperms.common.model.PermissionHolder;
|
||||
import me.lucko.luckperms.common.model.User;
|
||||
import me.lucko.luckperms.common.node.factory.NodeFactory;
|
||||
@@ -68,11 +68,11 @@ import java.util.stream.Stream;
|
||||
public class PermissionHolderSubjectData implements LPSubjectData {
|
||||
private final LuckPermsService service;
|
||||
|
||||
private final NodeMapType type;
|
||||
private final DataType type;
|
||||
private final PermissionHolder holder;
|
||||
private final LPSubject parentSubject;
|
||||
|
||||
public PermissionHolderSubjectData(LuckPermsService service, NodeMapType type, PermissionHolder holder, LPSubject parentSubject) {
|
||||
public PermissionHolderSubjectData(LuckPermsService service, DataType type, PermissionHolder holder, LPSubject parentSubject) {
|
||||
this.type = type;
|
||||
this.service = service;
|
||||
this.holder = holder;
|
||||
@@ -94,7 +94,7 @@ public class PermissionHolderSubjectData implements LPSubjectData {
|
||||
}
|
||||
|
||||
@Override
|
||||
public NodeMapType getType() {
|
||||
public DataType getType() {
|
||||
return this.type;
|
||||
}
|
||||
|
||||
@@ -129,35 +129,52 @@ public class PermissionHolderSubjectData implements LPSubjectData {
|
||||
if (tristate == Tristate.UNDEFINED) {
|
||||
// Unset
|
||||
Node node = NodeFactory.builder(permission).withContext(contexts).build();
|
||||
this.type.run(
|
||||
() -> this.holder.unsetPermission(node),
|
||||
() -> this.holder.unsetTransientPermission(node)
|
||||
);
|
||||
switch (this.type) {
|
||||
case NORMAL:
|
||||
this.holder.unsetPermission(DataType.NORMAL, node);
|
||||
break;
|
||||
case TRANSIENT:
|
||||
this.holder.unsetPermission(DataType.TRANSIENT, node);
|
||||
break;
|
||||
default:
|
||||
throw new AssertionError();
|
||||
}
|
||||
return save(this.holder).thenApply(v -> true);
|
||||
}
|
||||
|
||||
Node node = NodeFactory.builder(permission).value(tristate.asBoolean()).withContext(contexts).build();
|
||||
this.type.run(
|
||||
() -> {
|
||||
// unset the inverse, to allow false -> true, true -> false overrides.
|
||||
this.holder.unsetPermission(node);
|
||||
this.holder.setPermission(node);
|
||||
},
|
||||
() -> {
|
||||
// unset the inverse, to allow false -> true, true -> false overrides.
|
||||
this.holder.unsetTransientPermission(node);
|
||||
this.holder.setTransientPermission(node);
|
||||
}
|
||||
);
|
||||
// unset the inverse, to allow false -> true, true -> false overrides.
|
||||
// unset the inverse, to allow false -> true, true -> false overrides.
|
||||
switch (this.type) {
|
||||
case NORMAL:
|
||||
// unset the inverse, to allow false -> true, true -> false overrides.
|
||||
this.holder.unsetPermission(DataType.NORMAL, node);
|
||||
this.holder.setPermission(DataType.NORMAL, node, true);
|
||||
break;
|
||||
case TRANSIENT:
|
||||
// unset the inverse, to allow false -> true, true -> false overrides.
|
||||
this.holder.unsetPermission(DataType.TRANSIENT, node);
|
||||
this.holder.setPermission(DataType.TRANSIENT, node, true);
|
||||
break;
|
||||
default:
|
||||
throw new AssertionError();
|
||||
}
|
||||
return save(this.holder).thenApply(v -> true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public CompletableFuture<Boolean> clearPermissions() {
|
||||
boolean ret = this.type.supply(
|
||||
this.holder::clearEnduringNodes,
|
||||
this.holder::clearTransientNodes
|
||||
);
|
||||
boolean ret;
|
||||
switch (this.type) {
|
||||
case NORMAL:
|
||||
ret = this.holder.clearNodes(DataType.NORMAL, null);
|
||||
break;
|
||||
case TRANSIENT:
|
||||
ret = this.holder.clearNodes(DataType.TRANSIENT, null);
|
||||
break;
|
||||
default:
|
||||
throw new AssertionError();
|
||||
}
|
||||
|
||||
if (!ret) {
|
||||
return CompletableFuture.completedFuture(false);
|
||||
@@ -173,17 +190,22 @@ public class PermissionHolderSubjectData implements LPSubjectData {
|
||||
@Override
|
||||
public CompletableFuture<Boolean> clearPermissions(ImmutableContextSet contexts) {
|
||||
Objects.requireNonNull(contexts, "contexts");
|
||||
boolean ret = this.type.supply(
|
||||
() -> this.holder.clearEnduringNodes(contexts),
|
||||
() -> {
|
||||
List<Node> toRemove = streamNodes()
|
||||
.filter(n -> n.getContexts().equals(contexts))
|
||||
.collect(Collectors.toList());
|
||||
boolean ret;
|
||||
switch (this.type) {
|
||||
case NORMAL:
|
||||
ret = this.holder.clearNodes(DataType.NORMAL, contexts);
|
||||
break;
|
||||
case TRANSIENT:
|
||||
List<Node> toRemove = streamNodes()
|
||||
.filter(n -> n.getContexts().equals(contexts))
|
||||
.collect(Collectors.toList());
|
||||
|
||||
toRemove.forEach(this.holder::unsetTransientPermission);
|
||||
return !toRemove.isEmpty();
|
||||
}
|
||||
);
|
||||
toRemove.forEach(node -> this.holder.unsetPermission(DataType.TRANSIENT, node));
|
||||
ret = !toRemove.isEmpty();
|
||||
break;
|
||||
default:
|
||||
throw new AssertionError();
|
||||
}
|
||||
|
||||
if (!ret) {
|
||||
return CompletableFuture.completedFuture(false);
|
||||
@@ -235,10 +257,17 @@ public class PermissionHolderSubjectData implements LPSubjectData {
|
||||
.withContext(contexts)
|
||||
.build();
|
||||
|
||||
DataMutateResult result = this.type.supply(
|
||||
() -> this.holder.setPermission(node),
|
||||
() -> this.holder.setTransientPermission(node)
|
||||
);
|
||||
DataMutateResult result;
|
||||
switch (this.type) {
|
||||
case NORMAL:
|
||||
result = this.holder.setPermission(DataType.NORMAL, node, true);
|
||||
break;
|
||||
case TRANSIENT:
|
||||
result = this.holder.setPermission(DataType.TRANSIENT, node, true);
|
||||
break;
|
||||
default:
|
||||
throw new AssertionError();
|
||||
}
|
||||
|
||||
if (!result.wasSuccessful()) {
|
||||
return CompletableFuture.completedFuture(false);
|
||||
@@ -260,10 +289,17 @@ public class PermissionHolderSubjectData implements LPSubjectData {
|
||||
.withContext(contexts)
|
||||
.build();
|
||||
|
||||
DataMutateResult result = this.type.supply(
|
||||
() -> this.holder.unsetPermission(node),
|
||||
() -> this.holder.unsetTransientPermission(node)
|
||||
);
|
||||
DataMutateResult result;
|
||||
switch (this.type) {
|
||||
case NORMAL:
|
||||
result = this.holder.unsetPermission(DataType.NORMAL, node);
|
||||
break;
|
||||
case TRANSIENT:
|
||||
result = this.holder.unsetPermission(DataType.TRANSIENT, node);
|
||||
break;
|
||||
default:
|
||||
throw new AssertionError();
|
||||
}
|
||||
|
||||
if (!result.wasSuccessful()) {
|
||||
return CompletableFuture.completedFuture(false);
|
||||
@@ -274,17 +310,22 @@ public class PermissionHolderSubjectData implements LPSubjectData {
|
||||
|
||||
@Override
|
||||
public CompletableFuture<Boolean> clearParents() {
|
||||
boolean ret = this.type.supply(
|
||||
() -> this.holder.clearEnduringParents(true),
|
||||
() -> {
|
||||
List<Node> toRemove = streamNodes()
|
||||
.filter(n -> n instanceof InheritanceNode)
|
||||
.collect(Collectors.toList());
|
||||
boolean ret;
|
||||
switch (this.type) {
|
||||
case NORMAL:
|
||||
ret = this.holder.clearNormalParents(null, true);
|
||||
break;
|
||||
case TRANSIENT:
|
||||
List<Node> toRemove = streamNodes()
|
||||
.filter(n -> n instanceof InheritanceNode)
|
||||
.collect(Collectors.toList());
|
||||
|
||||
toRemove.forEach(this.holder::unsetTransientPermission);
|
||||
return !toRemove.isEmpty();
|
||||
}
|
||||
);
|
||||
toRemove.forEach(node -> this.holder.unsetPermission(DataType.TRANSIENT, node));
|
||||
ret = !toRemove.isEmpty();
|
||||
break;
|
||||
default:
|
||||
throw new AssertionError();
|
||||
}
|
||||
|
||||
if (!ret) {
|
||||
return CompletableFuture.completedFuture(false);
|
||||
@@ -296,18 +337,23 @@ public class PermissionHolderSubjectData implements LPSubjectData {
|
||||
@Override
|
||||
public CompletableFuture<Boolean> clearParents(ImmutableContextSet contexts) {
|
||||
Objects.requireNonNull(contexts, "contexts");
|
||||
boolean ret = this.type.supply(
|
||||
() -> this.holder.clearEnduringParents(contexts, true),
|
||||
() -> {
|
||||
List<Node> toRemove = streamNodes()
|
||||
.filter(n -> n instanceof InheritanceNode)
|
||||
.filter(n -> n.getContexts().equals(contexts))
|
||||
.collect(Collectors.toList());
|
||||
boolean ret;
|
||||
switch (this.type) {
|
||||
case NORMAL:
|
||||
ret = this.holder.clearNormalParents(contexts, true);
|
||||
break;
|
||||
case TRANSIENT:
|
||||
List<Node> toRemove = streamNodes()
|
||||
.filter(n -> n instanceof InheritanceNode)
|
||||
.filter(n -> n.getContexts().equals(contexts))
|
||||
.collect(Collectors.toList());
|
||||
|
||||
toRemove.forEach(this.holder::unsetTransientPermission);
|
||||
return !toRemove.isEmpty();
|
||||
}
|
||||
);
|
||||
toRemove.forEach(node -> this.holder.unsetPermission(DataType.TRANSIENT, node));
|
||||
ret = !toRemove.isEmpty();
|
||||
break;
|
||||
default:
|
||||
throw new AssertionError();
|
||||
}
|
||||
|
||||
if (!ret) {
|
||||
return CompletableFuture.completedFuture(false);
|
||||
@@ -380,11 +426,19 @@ public class PermissionHolderSubjectData implements LPSubjectData {
|
||||
// remove all prefixes/suffixes from the user
|
||||
streamNodes()
|
||||
.filter(node1 -> type.nodeType().matches(node1))
|
||||
.filter(n -> ((Node) n).getContexts().equals(contexts))
|
||||
.forEach(n -> this.type.run(
|
||||
() -> this.holder.unsetPermission(n),
|
||||
() -> this.holder.unsetTransientPermission(n)
|
||||
));
|
||||
.filter(n -> n.getContexts().equals(contexts))
|
||||
.forEach(n -> {
|
||||
switch (this.type) {
|
||||
case NORMAL:
|
||||
this.holder.unsetPermission(DataType.NORMAL, n);
|
||||
break;
|
||||
case TRANSIENT:
|
||||
this.holder.unsetPermission(DataType.TRANSIENT, n);
|
||||
break;
|
||||
default:
|
||||
throw new AssertionError();
|
||||
}
|
||||
});
|
||||
|
||||
MetaAccumulator metaAccumulator = this.holder.accumulateMeta(null, QueryOptions.defaultContextualOptions().toBuilder().context(contexts).build());
|
||||
metaAccumulator.complete();
|
||||
@@ -397,18 +451,32 @@ public class PermissionHolderSubjectData implements LPSubjectData {
|
||||
streamNodes()
|
||||
.filter(n -> n instanceof MetaNode && ((MetaNode) n).getMetaKey().equals(key))
|
||||
.filter(n -> n.getContexts().equals(contexts))
|
||||
.forEach(n -> this.type.run(
|
||||
() -> this.holder.unsetPermission(n),
|
||||
() -> this.holder.unsetTransientPermission(n)
|
||||
));
|
||||
.forEach(n -> {
|
||||
switch (this.type) {
|
||||
case NORMAL:
|
||||
this.holder.unsetPermission(DataType.NORMAL, n);
|
||||
break;
|
||||
case TRANSIENT:
|
||||
this.holder.unsetPermission(DataType.TRANSIENT, n);
|
||||
break;
|
||||
default:
|
||||
throw new AssertionError();
|
||||
}
|
||||
});
|
||||
|
||||
node = NodeFactory.buildMetaNode(key, value).withContext(contexts).build();
|
||||
}
|
||||
|
||||
this.type.run(
|
||||
() -> this.holder.setPermission(node),
|
||||
() -> this.holder.setTransientPermission(node)
|
||||
);
|
||||
switch (this.type) {
|
||||
case NORMAL:
|
||||
this.holder.setPermission(DataType.NORMAL, node, true);
|
||||
break;
|
||||
case TRANSIENT:
|
||||
this.holder.setPermission(DataType.TRANSIENT, node, true);
|
||||
break;
|
||||
default:
|
||||
throw new AssertionError();
|
||||
}
|
||||
return save(this.holder).thenApply(v -> true);
|
||||
}
|
||||
|
||||
@@ -428,10 +496,18 @@ public class PermissionHolderSubjectData implements LPSubjectData {
|
||||
}
|
||||
})
|
||||
.filter(n -> n.getContexts().equals(contexts))
|
||||
.forEach(node -> this.type.run(
|
||||
() -> this.holder.unsetPermission(node),
|
||||
() -> this.holder.unsetTransientPermission(node)
|
||||
));
|
||||
.forEach(node -> {
|
||||
switch (this.type) {
|
||||
case NORMAL:
|
||||
this.holder.unsetPermission(DataType.NORMAL, node);
|
||||
break;
|
||||
case TRANSIENT:
|
||||
this.holder.unsetPermission(DataType.TRANSIENT, node);
|
||||
break;
|
||||
default:
|
||||
throw new AssertionError();
|
||||
}
|
||||
});
|
||||
|
||||
return save(this.holder).thenApply(v -> true);
|
||||
}
|
||||
@@ -445,10 +521,18 @@ public class PermissionHolderSubjectData implements LPSubjectData {
|
||||
.filter(n -> n.getContexts().equals(contexts))
|
||||
.collect(Collectors.toList());
|
||||
|
||||
toRemove.forEach(node -> this.type.run(
|
||||
() -> this.holder.unsetPermission(node),
|
||||
() -> this.holder.unsetTransientPermission(node)
|
||||
));
|
||||
toRemove.forEach(node -> {
|
||||
switch (this.type) {
|
||||
case NORMAL:
|
||||
this.holder.unsetPermission(DataType.NORMAL, node);
|
||||
break;
|
||||
case TRANSIENT:
|
||||
this.holder.unsetPermission(DataType.TRANSIENT, node);
|
||||
break;
|
||||
default:
|
||||
throw new AssertionError();
|
||||
}
|
||||
});
|
||||
|
||||
if (toRemove.isEmpty()) {
|
||||
return CompletableFuture.completedFuture(false);
|
||||
@@ -463,10 +547,18 @@ public class PermissionHolderSubjectData implements LPSubjectData {
|
||||
.filter(NodeType.META_OR_CHAT_META::matches)
|
||||
.collect(Collectors.toList());
|
||||
|
||||
toRemove.forEach(node -> this.type.run(
|
||||
() -> this.holder.unsetPermission(node),
|
||||
() -> this.holder.unsetTransientPermission(node)
|
||||
));
|
||||
toRemove.forEach(node -> {
|
||||
switch (this.type) {
|
||||
case NORMAL:
|
||||
this.holder.unsetPermission(DataType.NORMAL, node);
|
||||
break;
|
||||
case TRANSIENT:
|
||||
this.holder.unsetPermission(DataType.TRANSIENT, node);
|
||||
break;
|
||||
default:
|
||||
throw new AssertionError();
|
||||
}
|
||||
});
|
||||
|
||||
if (toRemove.isEmpty()) {
|
||||
return CompletableFuture.completedFuture(false);
|
||||
@@ -483,7 +575,7 @@ public class PermissionHolderSubjectData implements LPSubjectData {
|
||||
}
|
||||
|
||||
// no further action required for transient types
|
||||
if (this.type == NodeMapType.TRANSIENT) {
|
||||
if (this.type == DataType.TRANSIENT) {
|
||||
return CompletableFuture.completedFuture(null);
|
||||
}
|
||||
|
||||
|
||||
+3
-3
@@ -25,8 +25,8 @@
|
||||
|
||||
package me.lucko.luckperms.sponge.service.model.persisted;
|
||||
|
||||
import me.lucko.luckperms.api.model.DataType;
|
||||
import me.lucko.luckperms.common.cache.BufferedRequest;
|
||||
import me.lucko.luckperms.common.model.NodeMapType;
|
||||
import me.lucko.luckperms.common.plugin.LuckPermsPlugin;
|
||||
import me.lucko.luckperms.sponge.service.LuckPermsService;
|
||||
import me.lucko.luckperms.sponge.service.ProxyFactory;
|
||||
@@ -81,7 +81,7 @@ public class PersistedSubject extends CalculatedSubject implements LPSubject {
|
||||
this.parentCollection = parentCollection;
|
||||
this.identifier = identifier;
|
||||
|
||||
this.subjectData = new PersistedSubjectData(this, NodeMapType.ENDURING, service) {
|
||||
this.subjectData = new PersistedSubjectData(this, DataType.NORMAL, service) {
|
||||
@Override
|
||||
protected void onUpdate(boolean success) {
|
||||
super.onUpdate(success);
|
||||
@@ -90,7 +90,7 @@ public class PersistedSubject extends CalculatedSubject implements LPSubject {
|
||||
}
|
||||
}
|
||||
};
|
||||
this.transientSubjectData = new MonitoredSubjectData(this, NodeMapType.TRANSIENT, service) {
|
||||
this.transientSubjectData = new MonitoredSubjectData(this, DataType.TRANSIENT, service) {
|
||||
@Override
|
||||
protected void onUpdate(boolean success) {
|
||||
if (success) {
|
||||
|
||||
+2
-2
@@ -25,7 +25,7 @@
|
||||
|
||||
package me.lucko.luckperms.sponge.service.model.persisted;
|
||||
|
||||
import me.lucko.luckperms.common.model.NodeMapType;
|
||||
import me.lucko.luckperms.api.model.DataType;
|
||||
import me.lucko.luckperms.sponge.service.LuckPermsService;
|
||||
import me.lucko.luckperms.sponge.service.model.calculated.MonitoredSubjectData;
|
||||
|
||||
@@ -36,7 +36,7 @@ public class PersistedSubjectData extends MonitoredSubjectData {
|
||||
private final PersistedSubject subject;
|
||||
private boolean save = true;
|
||||
|
||||
public PersistedSubjectData(PersistedSubject subject, NodeMapType type, LuckPermsService service) {
|
||||
public PersistedSubjectData(PersistedSubject subject, DataType type, LuckPermsService service) {
|
||||
super(subject, type, service);
|
||||
this.subject = subject;
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user