private Optional<PermissionResult> determineAccess(final @NonNull C sender, final @NonNull CommandNode<C> node) {
        final Map<Type, Permission> accessMap = node.nodeMeta().getOrNull(CommandNode.META_KEY_ACCESS);
        if (accessMap == null) {
            throw new IllegalStateException("Expected access requirements to be propagated");
        }
        final Set<Permission> failed = new HashSet<>();
        for (final Map.Entry<Type, Permission> entry : accessMap.entrySet()) {
            if (GenericTypeReflector.isSuperType(entry.getKey(), sender.getClass())) {
                final PermissionResult result = this.commandManager.testPermission(sender, entry.getValue());
                if (result.allowed()) {
                    return Optional.of(result);
                } else {
                    failed.add(entry.getValue());
                }
            }
        }
        if (failed.isEmpty()) {
            return Optional.empty();
        }
        return Optional.of(PermissionResult.denied(Permission.anyOf(failed)));
    }
Checks if the sender can access the node.

<p>Returns {@link Optional#empty} if the sender does not match the type requirements for the node.</p>

<p>If the sender matches a sender type-permission entry, the success result will be returned.
Otherwise, a failure result with all of the failed permissions wrapped by {@link Permission#anyOf(Permission...)}
will be returned.</p>

@param sender command sender
@param node   command node
@return whether the sender can access the node
cloud-core/src/main/java/org/incendo/cloud/CommandTree.java