Use new Node system in #getGroups

This commit is contained in:
Luck 2016-08-29 21:38:47 +01:00
parent 659baaf5fb
commit 75858c1555
No known key found for this signature in database
GPG Key ID: EFA9B3EC5FD90F8B

View File

@ -27,6 +27,7 @@ import lombok.Getter;
import lombok.Setter; import lombok.Setter;
import lombok.ToString; import lombok.ToString;
import me.lucko.luckperms.LuckPermsPlugin; import me.lucko.luckperms.LuckPermsPlugin;
import me.lucko.luckperms.api.Node;
import me.lucko.luckperms.api.event.events.GroupAddEvent; import me.lucko.luckperms.api.event.events.GroupAddEvent;
import me.lucko.luckperms.api.implementation.internal.GroupLink; import me.lucko.luckperms.api.implementation.internal.GroupLink;
import me.lucko.luckperms.api.implementation.internal.PermissionHolderLink; import me.lucko.luckperms.api.implementation.internal.PermissionHolderLink;
@ -37,6 +38,7 @@ import me.lucko.luckperms.exceptions.ObjectLacksException;
import me.lucko.luckperms.groups.Group; import me.lucko.luckperms.groups.Group;
import me.lucko.luckperms.utils.Identifiable; import me.lucko.luckperms.utils.Identifiable;
import java.util.Collections;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.UUID; import java.util.UUID;
@ -327,10 +329,9 @@ public abstract class User extends PermissionHolder implements Identifiable<UUID
*/ */
public List<String> getGroups(String server, String world, boolean includeGlobal) { public List<String> getGroups(String server, String world, boolean includeGlobal) {
// Call super #getPermissions method, and just sort through those // Call super #getPermissions method, and just sort through those
Map<String, Boolean> perms = exportNodes(server, world, null, includeGlobal, true, null); return getAllNodesFiltered(server, world, Collections.emptyMap(), includeGlobal, true).stream()
return perms.keySet().stream() .filter(Node::isGroupNode)
.filter(s -> Patterns.GROUP_MATCH.matcher(s).matches()) .map(Node::getGroupName)
.map(s -> Patterns.DOT.split(s, 2)[1])
.collect(Collectors.toList()); .collect(Collectors.toList());
} }
} }