diff --git a/common/src/main/java/me/lucko/luckperms/common/commands/group/GroupSetDisplayName.java b/common/src/main/java/me/lucko/luckperms/common/commands/group/GroupSetDisplayName.java index 1b335adf4..7f9a35e89 100644 --- a/common/src/main/java/me/lucko/luckperms/common/commands/group/GroupSetDisplayName.java +++ b/common/src/main/java/me/lucko/luckperms/common/commands/group/GroupSetDisplayName.java @@ -67,7 +67,7 @@ public class GroupSetDisplayName extends ChildCommand { String name = args.get(0); ImmutableContextSet context = args.getContextOrDefault(1, plugin).immutableCopy(); - String previousName = target.normalData().nodesSetInContext(context).stream() + String previousName = target.normalData().nodesInContext(context).stream() .filter(NodeType.DISPLAY_NAME::matches) .map(NodeType.DISPLAY_NAME::cast) .findFirst() diff --git a/common/src/main/java/me/lucko/luckperms/common/commands/log/LogNotify.java b/common/src/main/java/me/lucko/luckperms/common/commands/log/LogNotify.java index 05bd2a91f..617b0161d 100644 --- a/common/src/main/java/me/lucko/luckperms/common/commands/log/LogNotify.java +++ b/common/src/main/java/me/lucko/luckperms/common/commands/log/LogNotify.java @@ -59,7 +59,7 @@ public class LogNotify extends ChildCommand { return false; } - Optional node = user.normalData().nodesSetInContext(ImmutableContextSetImpl.EMPTY).stream() + Optional node = user.normalData().nodesInContext(ImmutableContextSetImpl.EMPTY).stream() .filter(n -> n.getKey().equalsIgnoreCase(IGNORE_NODE)) .findFirst(); diff --git a/common/src/main/java/me/lucko/luckperms/common/model/NodeMap.java b/common/src/main/java/me/lucko/luckperms/common/model/NodeMap.java index f05a1cc96..165e93e99 100644 --- a/common/src/main/java/me/lucko/luckperms/common/model/NodeMap.java +++ b/common/src/main/java/me/lucko/luckperms/common/model/NodeMap.java @@ -108,7 +108,11 @@ public final class NodeMap { } public int size() { - return this.map.size(); + int size = 0; + for (SortedSet values : this.map.values()) { + size += values.size(); + } + return size; } public List asList() { @@ -290,7 +294,7 @@ public final class NodeMap { } } - public Collection nodesSetInContext(ContextSet context) { + public Collection nodesInContext(ContextSet context) { final SortedSet values = this.map.get(context.immutableCopy()); if (values == null) { return ImmutableSet.of(); @@ -298,7 +302,7 @@ public final class NodeMap { return new ArrayList<>(values); } - public Collection inheritanceNodesSetInContext(ContextSet context) { + public Collection inheritanceNodesInContext(ContextSet context) { final SortedSet values = this.inheritanceMap.get(context.immutableCopy()); if (values == null) { return ImmutableSet.of(); diff --git a/common/src/main/java/me/lucko/luckperms/common/model/Track.java b/common/src/main/java/me/lucko/luckperms/common/model/Track.java index d31290864..a9a894e09 100644 --- a/common/src/main/java/me/lucko/luckperms/common/model/Track.java +++ b/common/src/main/java/me/lucko/luckperms/common/model/Track.java @@ -275,7 +275,7 @@ public final class Track { } // find all groups that are inherited by the user in the exact contexts given and applicable to this track - List nodes = user.normalData().inheritanceNodesSetInContext(context).stream() + List nodes = user.normalData().inheritanceNodesInContext(context).stream() .filter(Node::getValue) .filter(node -> containsGroup(node.getGroupName())) .distinct() @@ -340,7 +340,7 @@ public final class Track { } // find all groups that are inherited by the user in the exact contexts given and applicable to this track - List nodes = user.normalData().inheritanceNodesSetInContext(context).stream() + List nodes = user.normalData().inheritanceNodesInContext(context).stream() .filter(Node::getValue) .filter(node -> containsGroup(node.getGroupName())) .distinct() diff --git a/common/src/main/java/me/lucko/luckperms/common/model/manager/user/AbstractUserManager.java b/common/src/main/java/me/lucko/luckperms/common/model/manager/user/AbstractUserManager.java index 830fbd3ca..f32c76a58 100644 --- a/common/src/main/java/me/lucko/luckperms/common/model/manager/user/AbstractUserManager.java +++ b/common/src/main/java/me/lucko/luckperms/common/model/manager/user/AbstractUserManager.java @@ -82,7 +82,7 @@ public abstract class AbstractUserManager extends AbstractManage public boolean giveDefaultIfNeeded(User user, boolean save) { boolean work = false; - Collection globalGroups = user.normalData().inheritanceNodesSetInContext(ImmutableContextSetImpl.EMPTY); + Collection globalGroups = user.normalData().inheritanceNodesInContext(ImmutableContextSetImpl.EMPTY); // check that they are actually a member of their primary group, otherwise remove it if (this.plugin.getConfiguration().get(ConfigKeys.PRIMARY_GROUP_CALCULATION_METHOD).equals("stored")) { diff --git a/sponge/src/main/java/me/lucko/luckperms/sponge/service/model/permissionholder/PermissionHolderSubjectData.java b/sponge/src/main/java/me/lucko/luckperms/sponge/service/model/permissionholder/PermissionHolderSubjectData.java index 11de02bbf..522ad6f12 100644 --- a/sponge/src/main/java/me/lucko/luckperms/sponge/service/model/permissionholder/PermissionHolderSubjectData.java +++ b/sponge/src/main/java/me/lucko/luckperms/sponge/service/model/permissionholder/PermissionHolderSubjectData.java @@ -111,7 +111,7 @@ public class PermissionHolderSubjectData implements LPSubjectData { @Override public ImmutableMap getPermissions(ImmutableContextSet contexts) { ImmutableMap.Builder builder = ImmutableMap.builder(); - for (Node n : this.holder.getData(this.type).nodesSetInContext(contexts)) { + for (Node n : this.holder.getData(this.type).nodesInContext(contexts)) { builder.put(n.getKey(), n.getValue()); } return builder.build(); @@ -172,7 +172,7 @@ public class PermissionHolderSubjectData implements LPSubjectData { @Override public ImmutableList getParents(ImmutableContextSet contexts) { ImmutableList.Builder builder = ImmutableList.builder(); - for (InheritanceNode n : this.holder.getData(this.type).inheritanceNodesSetInContext(contexts)) { + for (InheritanceNode n : this.holder.getData(this.type).inheritanceNodesInContext(contexts)) { builder.add(this.service.getGroupSubjects().loadSubject(n.getGroupName()).join().toReference()); } return builder.build(); @@ -249,7 +249,7 @@ public class PermissionHolderSubjectData implements LPSubjectData { @Override public ImmutableMap getOptions(ImmutableContextSet contexts) { - return nodesToOptions(this.holder.getData(this.type).nodesSetInContext(contexts)); + return nodesToOptions(this.holder.getData(this.type).nodesInContext(contexts)); } private static ImmutableMap nodesToOptions(Iterable nodes) {