Java Code Examples for net.dv8tion.jda.api.requests.GatewayIntent#getRawValue()

The following examples show how to use net.dv8tion.jda.api.requests.GatewayIntent#getRawValue() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: DefaultShardManagerBuilder.java    From JDA with Apache License 2.0 5 votes vote down vote up
private DefaultShardManagerBuilder applyIntents()
{
    EnumSet<CacheFlag> disabledCache = EnumSet.allOf(CacheFlag.class);
    for (CacheFlag flag : CacheFlag.values())
    {
        GatewayIntent requiredIntent = flag.getRequiredIntent();
        if (requiredIntent == null || (requiredIntent.getRawValue() & intents) != 0)
            disabledCache.remove(flag);
    }

    boolean enableMembers = (intents & GatewayIntent.GUILD_MEMBERS.getRawValue()) != 0;
    return setChunkingFilter(enableMembers ? ChunkingFilter.ALL : ChunkingFilter.NONE)
            .setMemberCachePolicy(enableMembers ? MemberCachePolicy.ALL : MemberCachePolicy.DEFAULT)
            .setDisabledCache(disabledCache);
}
 
Example 2
Source File: JDABuilder.java    From JDA with Apache License 2.0 5 votes vote down vote up
private JDABuilder applyIntents()
{
    EnumSet<CacheFlag> disabledCache = EnumSet.allOf(CacheFlag.class);
    for (CacheFlag flag : CacheFlag.values())
    {
        GatewayIntent requiredIntent = flag.getRequiredIntent();
        if (requiredIntent == null || (requiredIntent.getRawValue() & intents) != 0)
            disabledCache.remove(flag);
    }

    boolean enableMembers = (intents & GatewayIntent.GUILD_MEMBERS.getRawValue()) != 0;
    return setChunkingFilter(enableMembers ? ChunkingFilter.ALL : ChunkingFilter.NONE)
            .setMemberCachePolicy(enableMembers ? MemberCachePolicy.ALL : MemberCachePolicy.DEFAULT)
            .setDisabledCache(disabledCache);
}
 
Example 3
Source File: JDAImpl.java    From JDA with Apache License 2.0 4 votes vote down vote up
public boolean isIntent(GatewayIntent intent)
{
    int raw = intent.getRawValue();
    return (client.getGatewayIntents() & raw) == raw;
}