Small fix for #getAllWithPermission
This commit is contained in:
parent
58e223e74b
commit
d626c08b4c
@ -45,7 +45,7 @@ import static me.lucko.luckperms.utils.ArgumentChecker.unescapeCharacters;
|
||||
|
||||
@EqualsAndHashCode(of = {"holder"})
|
||||
public class LuckPermsSubject implements Subject {
|
||||
public static Subject wrapHolder(PermissionHolder holder, LuckPermsService service) {
|
||||
public static LuckPermsSubject wrapHolder(PermissionHolder holder, LuckPermsService service) {
|
||||
return new LuckPermsSubject(holder, service);
|
||||
}
|
||||
|
||||
@ -104,6 +104,10 @@ public class LuckPermsSubject implements Subject {
|
||||
return transientData;
|
||||
}
|
||||
|
||||
public boolean isPermissionSet(@NonNull Set<Context> contexts, @NonNull String node) {
|
||||
return getPermissionValue(contexts, node) != Tristate.UNDEFINED;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasPermission(@NonNull Set<Context> contexts, @NonNull String node) {
|
||||
return getPermissionValue(contexts, node).asBoolean();
|
||||
|
@ -83,7 +83,7 @@ public class GroupCollection implements SubjectCollection {
|
||||
public Map<Subject, Boolean> getAllWithPermission(@NonNull Set<Context> contexts, @NonNull String node) {
|
||||
return manager.getAll().values().stream()
|
||||
.map(u -> LuckPermsSubject.wrapHolder(u, service))
|
||||
.filter(sub -> sub.hasPermission(contexts, node))
|
||||
.filter(sub -> sub.isPermissionSet(contexts, node))
|
||||
.collect(Collectors.toMap(sub -> sub, sub -> sub.getPermissionValue(contexts, node).asBoolean()));
|
||||
}
|
||||
|
||||
|
@ -129,7 +129,7 @@ public class UserCollection implements SubjectCollection {
|
||||
@Override
|
||||
public Map<Subject, Boolean> getAllWithPermission(@NonNull Set<Context> contexts, @NonNull String node) {
|
||||
return users.values().stream()
|
||||
.filter(sub -> sub.hasPermission(contexts, node))
|
||||
.filter(sub -> sub.isPermissionSet(contexts, node))
|
||||
.collect(Collectors.toMap(sub -> sub, sub -> sub.getPermissionValue(contexts, node).asBoolean()));
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user