mirror of
https://github.com/LuckPerms/LuckPerms.git
synced 2024-11-24 03:25:19 +01:00
Rename getWithPermission method internally
This commit is contained in:
parent
5d6389249a
commit
bfa5fc43cd
@ -115,7 +115,7 @@ public class ApiGroupManager extends ApiAbstractManager<Group, net.luckperms.api
|
||||
@Deprecated
|
||||
public @NonNull CompletableFuture<List<HeldNode<String>>> getWithPermission(@NonNull String permission) {
|
||||
Objects.requireNonNull(permission, "permission");
|
||||
return (CompletableFuture) this.plugin.getStorage().getGroupsWithPermission(StandardNodeMatchers.key(permission));
|
||||
return (CompletableFuture) this.plugin.getStorage().searchGroupNodes(StandardNodeMatchers.key(permission));
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
@ -123,7 +123,7 @@ public class ApiGroupManager extends ApiAbstractManager<Group, net.luckperms.api
|
||||
public @NonNull <T extends Node> CompletableFuture<Map<String, Collection<T>>> searchAll(@NonNull NodeMatcher<? extends T> matcher) {
|
||||
Objects.requireNonNull(matcher, "matcher");
|
||||
ConstraintNodeMatcher<? extends T> constraint = (ConstraintNodeMatcher<? extends T>) matcher;
|
||||
return this.plugin.getStorage().getGroupsWithPermission(constraint).thenApply(list -> {
|
||||
return this.plugin.getStorage().searchGroupNodes(constraint).thenApply(list -> {
|
||||
ImmutableListMultimap.Builder<String, T> builder = ImmutableListMultimap.builder();
|
||||
for (NodeEntry<String, ? extends T> row : list) {
|
||||
builder.put(row.getHolder(), row.getNode());
|
||||
|
@ -124,7 +124,7 @@ public class ApiUserManager extends ApiAbstractManager<User, net.luckperms.api.m
|
||||
@Deprecated
|
||||
public @NonNull CompletableFuture<List<HeldNode<UUID>>> getWithPermission(@NonNull String permission) {
|
||||
Objects.requireNonNull(permission, "permission");
|
||||
return (CompletableFuture) this.plugin.getStorage().getUsersWithPermission(StandardNodeMatchers.key(permission));
|
||||
return (CompletableFuture) this.plugin.getStorage().searchUserNodes(StandardNodeMatchers.key(permission));
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
@ -132,7 +132,7 @@ public class ApiUserManager extends ApiAbstractManager<User, net.luckperms.api.m
|
||||
public <T extends Node> @NonNull CompletableFuture<Map<UUID, Collection<T>>> searchAll(@NonNull NodeMatcher<? extends T> matcher) {
|
||||
Objects.requireNonNull(matcher, "matcher");
|
||||
ConstraintNodeMatcher<? extends T> constraint = (ConstraintNodeMatcher<? extends T>) matcher;
|
||||
return this.plugin.getStorage().getUsersWithPermission(constraint).thenApply(list -> {
|
||||
return this.plugin.getStorage().searchUserNodes(constraint).thenApply(list -> {
|
||||
ImmutableListMultimap.Builder<UUID, T> builder = ImmutableListMultimap.builder();
|
||||
for (NodeEntry<UUID, ? extends T> row : list) {
|
||||
builder.put(row.getHolder(), row.getNode());
|
||||
|
@ -88,7 +88,7 @@ public class GroupListMembers extends ChildCommand<Group> {
|
||||
|
||||
Message.SEARCH_SEARCHING_MEMBERS.send(sender, group.getName());
|
||||
|
||||
List<NodeEntry<UUID, InheritanceNode>> matchedUsers = plugin.getStorage().getUsersWithPermission(matcher).join().stream()
|
||||
List<NodeEntry<UUID, InheritanceNode>> matchedUsers = plugin.getStorage().searchUserNodes(matcher).join().stream()
|
||||
.filter(n -> n.getNode().getValue())
|
||||
.collect(Collectors.toList());
|
||||
|
||||
@ -105,7 +105,7 @@ public class GroupListMembers extends ChildCommand<Group> {
|
||||
Message.SEARCH_RESULT_GROUP_DEFAULT.send(sender);
|
||||
}
|
||||
|
||||
List<NodeEntry<String, InheritanceNode>> matchedGroups = plugin.getStorage().getGroupsWithPermission(matcher).join().stream()
|
||||
List<NodeEntry<String, InheritanceNode>> matchedGroups = plugin.getStorage().searchGroupNodes(matcher).join().stream()
|
||||
.filter(n -> n.getNode().getValue())
|
||||
.collect(Collectors.toList());
|
||||
|
||||
|
@ -95,7 +95,7 @@ public class EditorCommand extends SingleCommand {
|
||||
// include all online players
|
||||
Map<UUID, User> users = new LinkedHashMap<>(plugin.getUserManager().getAll());
|
||||
|
||||
// then fill up with other users
|
||||
// then fill up with other users with permissions
|
||||
if (type.includingOffline && users.size() < MAX_USERS) {
|
||||
plugin.getStorage().getUniqueUsers().join().stream()
|
||||
.filter(uuid -> !users.containsKey(uuid))
|
||||
|
@ -87,8 +87,8 @@ public class SearchCommand extends SingleCommand {
|
||||
|
||||
Message.SEARCH_SEARCHING.send(sender, matcher);
|
||||
|
||||
List<NodeEntry<UUID, Node>> matchedUsers = plugin.getStorage().getUsersWithPermission(matcher).join();
|
||||
List<NodeEntry<String, Node>> matchedGroups = plugin.getStorage().getGroupsWithPermission(matcher).join();
|
||||
List<NodeEntry<UUID, Node>> matchedUsers = plugin.getStorage().searchUserNodes(matcher).join();
|
||||
List<NodeEntry<String, Node>> matchedGroups = plugin.getStorage().searchGroupNodes(matcher).join();
|
||||
|
||||
int users = matchedUsers.size();
|
||||
int groups = matchedGroups.size();
|
||||
|
@ -162,9 +162,9 @@ public class Storage {
|
||||
return makeFuture(this.implementation::getUniqueUsers);
|
||||
}
|
||||
|
||||
public <N extends Node> CompletableFuture<List<NodeEntry<UUID, N>>> getUsersWithPermission(ConstraintNodeMatcher<N> constraint) {
|
||||
public <N extends Node> CompletableFuture<List<NodeEntry<UUID, N>>> searchUserNodes(ConstraintNodeMatcher<N> constraint) {
|
||||
return makeFuture(() -> {
|
||||
List<NodeEntry<UUID, N>> result = this.implementation.getUsersWithPermission(constraint);
|
||||
List<NodeEntry<UUID, N>> result = this.implementation.searchUserNodes(constraint);
|
||||
result.removeIf(entry -> entry.getNode().hasExpired());
|
||||
return ImmutableList.copyOf(result);
|
||||
});
|
||||
@ -208,9 +208,9 @@ public class Storage {
|
||||
});
|
||||
}
|
||||
|
||||
public <N extends Node> CompletableFuture<List<NodeEntry<String, N>>> getGroupsWithPermission(ConstraintNodeMatcher<N> constraint) {
|
||||
public <N extends Node> CompletableFuture<List<NodeEntry<String, N>>> searchGroupNodes(ConstraintNodeMatcher<N> constraint) {
|
||||
return makeFuture(() -> {
|
||||
List<NodeEntry<String, N>> result = this.implementation.getGroupsWithPermission(constraint);
|
||||
List<NodeEntry<String, N>> result = this.implementation.searchGroupNodes(constraint);
|
||||
result.removeIf(entry -> entry.getNode().hasExpired());
|
||||
return ImmutableList.copyOf(result);
|
||||
});
|
||||
|
@ -72,7 +72,7 @@ public interface StorageImplementation {
|
||||
|
||||
Set<UUID> getUniqueUsers() throws Exception;
|
||||
|
||||
<N extends Node> List<NodeEntry<UUID, N>> getUsersWithPermission(ConstraintNodeMatcher<N> constraint) throws Exception;
|
||||
<N extends Node> List<NodeEntry<UUID, N>> searchUserNodes(ConstraintNodeMatcher<N> constraint) throws Exception;
|
||||
|
||||
Group createAndLoadGroup(String name) throws Exception;
|
||||
|
||||
@ -84,7 +84,7 @@ public interface StorageImplementation {
|
||||
|
||||
void deleteGroup(Group group) throws Exception;
|
||||
|
||||
<N extends Node> List<NodeEntry<String, N>> getGroupsWithPermission(ConstraintNodeMatcher<N> constraint) throws Exception;
|
||||
<N extends Node> List<NodeEntry<String, N>> searchGroupNodes(ConstraintNodeMatcher<N> constraint) throws Exception;
|
||||
|
||||
Track createAndLoadTrack(String name) throws Exception;
|
||||
|
||||
|
@ -261,7 +261,7 @@ public class CombinedConfigurateStorage extends AbstractConfigurateStorage {
|
||||
}
|
||||
|
||||
@Override
|
||||
public <N extends Node> List<NodeEntry<UUID, N>> getUsersWithPermission(ConstraintNodeMatcher<N> constraint) throws Exception {
|
||||
public <N extends Node> List<NodeEntry<UUID, N>> searchUserNodes(ConstraintNodeMatcher<N> constraint) throws Exception {
|
||||
List<NodeEntry<UUID, N>> held = new ArrayList<>();
|
||||
this.usersLoader.apply(false, true, root -> {
|
||||
for (Map.Entry<Object, ? extends ConfigurationNode> entry : root.getChildrenMap().entrySet()) {
|
||||
@ -301,7 +301,7 @@ public class CombinedConfigurateStorage extends AbstractConfigurateStorage {
|
||||
}
|
||||
|
||||
@Override
|
||||
public <N extends Node> List<NodeEntry<String, N>> getGroupsWithPermission(ConstraintNodeMatcher<N> constraint) throws Exception {
|
||||
public <N extends Node> List<NodeEntry<String, N>> searchGroupNodes(ConstraintNodeMatcher<N> constraint) throws Exception {
|
||||
List<NodeEntry<String, N>> held = new ArrayList<>();
|
||||
this.groupsLoader.apply(false, true, root -> {
|
||||
for (Map.Entry<Object, ? extends ConfigurationNode> entry : root.getChildrenMap().entrySet()) {
|
||||
|
@ -254,7 +254,7 @@ public class SeparatedConfigurateStorage extends AbstractConfigurateStorage {
|
||||
}
|
||||
|
||||
@Override
|
||||
public <N extends Node> List<NodeEntry<UUID, N>> getUsersWithPermission(ConstraintNodeMatcher<N> constraint) throws Exception {
|
||||
public <N extends Node> List<NodeEntry<UUID, N>> searchUserNodes(ConstraintNodeMatcher<N> constraint) throws Exception {
|
||||
List<NodeEntry<UUID, N>> held = new ArrayList<>();
|
||||
try (Stream<Path> stream = Files.list(getDirectory(StorageLocation.USER))) {
|
||||
stream.filter(getFileTypeFilter())
|
||||
@ -297,7 +297,7 @@ public class SeparatedConfigurateStorage extends AbstractConfigurateStorage {
|
||||
}
|
||||
|
||||
@Override
|
||||
public <N extends Node> List<NodeEntry<String, N>> getGroupsWithPermission(ConstraintNodeMatcher<N> constraint) throws Exception {
|
||||
public <N extends Node> List<NodeEntry<String, N>> searchGroupNodes(ConstraintNodeMatcher<N> constraint) throws Exception {
|
||||
List<NodeEntry<String, N>> held = new ArrayList<>();
|
||||
try (Stream<Path> stream = Files.list(getDirectory(StorageLocation.GROUP))) {
|
||||
stream.filter(getFileTypeFilter())
|
||||
|
@ -360,7 +360,7 @@ public class MongoStorage implements StorageImplementation {
|
||||
}
|
||||
|
||||
@Override
|
||||
public <N extends Node> List<NodeEntry<UUID, N>> getUsersWithPermission(ConstraintNodeMatcher<N> constraint) throws Exception {
|
||||
public <N extends Node> List<NodeEntry<UUID, N>> searchUserNodes(ConstraintNodeMatcher<N> constraint) throws Exception {
|
||||
List<NodeEntry<UUID, N>> held = new ArrayList<>();
|
||||
MongoCollection<Document> c = this.database.getCollection(this.prefix + "users");
|
||||
try (MongoCursor<Document> cursor = c.find().iterator()) {
|
||||
@ -470,7 +470,7 @@ public class MongoStorage implements StorageImplementation {
|
||||
}
|
||||
|
||||
@Override
|
||||
public <N extends Node> List<NodeEntry<String, N>> getGroupsWithPermission(ConstraintNodeMatcher<N> constraint) throws Exception {
|
||||
public <N extends Node> List<NodeEntry<String, N>> searchGroupNodes(ConstraintNodeMatcher<N> constraint) throws Exception {
|
||||
List<NodeEntry<String, N>> held = new ArrayList<>();
|
||||
MongoCollection<Document> c = this.database.getCollection(this.prefix + "groups");
|
||||
try (MongoCursor<Document> cursor = c.find().iterator()) {
|
||||
|
@ -154,8 +154,8 @@ public class SplitStorage implements StorageImplementation {
|
||||
}
|
||||
|
||||
@Override
|
||||
public <N extends Node> List<NodeEntry<UUID, N>> getUsersWithPermission(ConstraintNodeMatcher<N> constraint) throws Exception {
|
||||
return implFor(SplitStorageType.USER).getUsersWithPermission(constraint);
|
||||
public <N extends Node> List<NodeEntry<UUID, N>> searchUserNodes(ConstraintNodeMatcher<N> constraint) throws Exception {
|
||||
return implFor(SplitStorageType.USER).searchUserNodes(constraint);
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -184,8 +184,8 @@ public class SplitStorage implements StorageImplementation {
|
||||
}
|
||||
|
||||
@Override
|
||||
public <N extends Node> List<NodeEntry<String, N>> getGroupsWithPermission(ConstraintNodeMatcher<N> constraint) throws Exception {
|
||||
return implFor(SplitStorageType.GROUP).getGroupsWithPermission(constraint);
|
||||
public <N extends Node> List<NodeEntry<String, N>> searchGroupNodes(ConstraintNodeMatcher<N> constraint) throws Exception {
|
||||
return implFor(SplitStorageType.GROUP).searchGroupNodes(constraint);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -363,7 +363,7 @@ public class SqlStorage implements StorageImplementation {
|
||||
}
|
||||
|
||||
@Override
|
||||
public <N extends Node> List<NodeEntry<UUID, N>> getUsersWithPermission(ConstraintNodeMatcher<N> constraint) throws SQLException {
|
||||
public <N extends Node> List<NodeEntry<UUID, N>> searchUserNodes(ConstraintNodeMatcher<N> constraint) throws SQLException {
|
||||
PreparedStatementBuilder builder = new PreparedStatementBuilder().append(USER_PERMISSIONS_SELECT_PERMISSION);
|
||||
constraint.getConstraint().appendSql(builder, "permission");
|
||||
|
||||
@ -506,7 +506,7 @@ public class SqlStorage implements StorageImplementation {
|
||||
}
|
||||
|
||||
@Override
|
||||
public <N extends Node> List<NodeEntry<String, N>> getGroupsWithPermission(ConstraintNodeMatcher<N> constraint) throws SQLException {
|
||||
public <N extends Node> List<NodeEntry<String, N>> searchGroupNodes(ConstraintNodeMatcher<N> constraint) throws SQLException {
|
||||
PreparedStatementBuilder builder = new PreparedStatementBuilder().append(GROUP_PERMISSIONS_SELECT_PERMISSION);
|
||||
constraint.getConstraint().appendSql(builder, "permission");
|
||||
|
||||
|
@ -193,7 +193,7 @@ public class SpongeGroupManager extends AbstractGroupManager<SpongeGroup> implem
|
||||
return CompletableFuture.supplyAsync(() -> {
|
||||
ImmutableMap.Builder<LPSubjectReference, Boolean> builder = ImmutableMap.builder();
|
||||
|
||||
List<NodeEntry<String, Node>> lookup = this.plugin.getStorage().getGroupsWithPermission(StandardNodeMatchers.key(permission)).join();
|
||||
List<NodeEntry<String, Node>> lookup = this.plugin.getStorage().searchGroupNodes(StandardNodeMatchers.key(permission)).join();
|
||||
for (NodeEntry<String, Node> holder : lookup) {
|
||||
if (holder.getNode().getContexts().equals(ImmutableContextSetImpl.EMPTY)) {
|
||||
builder.put(getService().getReferenceFactory().obtain(getIdentifier(), holder.getHolder()), holder.getNode().getValue());
|
||||
@ -209,7 +209,7 @@ public class SpongeGroupManager extends AbstractGroupManager<SpongeGroup> implem
|
||||
return CompletableFuture.supplyAsync(() -> {
|
||||
ImmutableMap.Builder<LPSubjectReference, Boolean> builder = ImmutableMap.builder();
|
||||
|
||||
List<NodeEntry<String, Node>> lookup = this.plugin.getStorage().getGroupsWithPermission(StandardNodeMatchers.key(permission)).join();
|
||||
List<NodeEntry<String, Node>> lookup = this.plugin.getStorage().searchGroupNodes(StandardNodeMatchers.key(permission)).join();
|
||||
for (NodeEntry<String, Node> holder : lookup) {
|
||||
if (holder.getNode().getContexts().equals(contexts)) {
|
||||
builder.put(getService().getReferenceFactory().obtain(getIdentifier(), holder.getHolder()), holder.getNode().getValue());
|
||||
|
@ -212,7 +212,7 @@ public class SpongeUserManager extends AbstractUserManager<SpongeUser> implement
|
||||
return CompletableFuture.supplyAsync(() -> {
|
||||
ImmutableMap.Builder<LPSubjectReference, Boolean> builder = ImmutableMap.builder();
|
||||
|
||||
List<NodeEntry<UUID, Node>> lookup = this.plugin.getStorage().getUsersWithPermission(StandardNodeMatchers.key(permission)).join();
|
||||
List<NodeEntry<UUID, Node>> lookup = this.plugin.getStorage().searchUserNodes(StandardNodeMatchers.key(permission)).join();
|
||||
for (NodeEntry<UUID, Node> holder : lookup) {
|
||||
if (holder.getNode().getContexts().equals(ImmutableContextSetImpl.EMPTY)) {
|
||||
builder.put(getService().getReferenceFactory().obtain(getIdentifier(), holder.getHolder().toString()), holder.getNode().getValue());
|
||||
@ -228,7 +228,7 @@ public class SpongeUserManager extends AbstractUserManager<SpongeUser> implement
|
||||
return CompletableFuture.supplyAsync(() -> {
|
||||
ImmutableMap.Builder<LPSubjectReference, Boolean> builder = ImmutableMap.builder();
|
||||
|
||||
List<NodeEntry<UUID, Node>> lookup = this.plugin.getStorage().getUsersWithPermission(StandardNodeMatchers.key(permission)).join();
|
||||
List<NodeEntry<UUID, Node>> lookup = this.plugin.getStorage().searchUserNodes(StandardNodeMatchers.key(permission)).join();
|
||||
for (NodeEntry<UUID, Node> holder : lookup) {
|
||||
if (holder.getNode().getContexts().equals(contexts)) {
|
||||
builder.put(getService().getReferenceFactory().obtain(getIdentifier(), holder.getHolder().toString()), holder.getNode().getValue());
|
||||
|
Loading…
Reference in New Issue
Block a user