Search in sources :

Example 1 with IPermission

use of io.discloader.discloader.entity.IPermission in project DiscLoader by R3alCl0ud.

the class GuildChannel method permissionsOf.

@Override
public IPermission permissionsOf(IGuildMember member) {
    long raw = 0;
    if (getGuild().isOwner(member))
        return new Permission(member, this, 2146958463);
    for (IRole role : member.getRoles()) {
        if (role != null) {
            raw |= role.getPermissions().toLong();
        }
    }
    for (IOverwrite overwrite : overwritesOf(member)) {
        raw |= overwrite.getAllowed();
        raw &= ~overwrite.getDenied();
    }
    return new Permission(member, this, raw);
}
Also used : IRole(io.discloader.discloader.entity.guild.IRole) IPermission(io.discloader.discloader.entity.IPermission) Permission(io.discloader.discloader.core.entity.Permission) IOverwrite(io.discloader.discloader.entity.IOverwrite)

Aggregations

Permission (io.discloader.discloader.core.entity.Permission)1 IOverwrite (io.discloader.discloader.entity.IOverwrite)1 IPermission (io.discloader.discloader.entity.IPermission)1 IRole (io.discloader.discloader.entity.guild.IRole)1