Another Vault fix & cleanup User / Group classes

This commit is contained in:
Luck
2016-09-30 17:45:29 +01:00
Unverified
parent 63b9be9845
commit 2d8083bf18
4 changed files with 56 additions and 179 deletions
@@ -199,7 +199,16 @@ public class VaultPermissionHook extends Permission {
@Override
public boolean playerInGroup(String world, @NonNull String player, @NonNull String group) {
log("Checking if player " + player + " is in group: " + group + " on world " + world + ", server " + server);
return playerHas(world, player, "group." + group);
final User user = plugin.getUserManager().get(player);
if (user == null) return false;
return user.getNodes().stream()
.filter(Node::isGroupNode)
.filter(n -> n.shouldApplyOnServer(server, isIncludeGlobal(), false))
.filter(n -> n.shouldApplyOnWorld(world, true, false))
.map(Node::getGroupName)
.filter(s -> s.equalsIgnoreCase(group))
.findAny().isPresent();
}
@Override