当前位置: 首页>>代码示例>>Java>>正文


Java JDAClientImpl类代码示例

本文整理汇总了Java中net.dv8tion.jda.client.entities.impl.JDAClientImpl的典型用法代码示例。如果您正苦于以下问题:Java JDAClientImpl类的具体用法?Java JDAClientImpl怎么用?Java JDAClientImpl使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


JDAClientImpl类属于net.dv8tion.jda.client.entities.impl包,在下文中一共展示了JDAClientImpl类的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: JDAImpl

import net.dv8tion.jda.client.entities.impl.JDAClientImpl; //导入依赖的package包/类
public JDAImpl(AccountType accountType, String token, SessionController controller, OkHttpClient.Builder httpClientBuilder, WebSocketFactory wsFactory,
               boolean autoReconnect, boolean audioEnabled, boolean useShutdownHook, boolean bulkDeleteSplittingEnabled, boolean retryOnTimeout, boolean enableMDC,
               int corePoolSize, int maxReconnectDelay, ConcurrentMap<String, String> contextMap)
{
    this.accountType = accountType;
    this.setToken(token);
    this.httpClientBuilder = httpClientBuilder;
    this.wsFactory = wsFactory;
    this.autoReconnect = autoReconnect;
    this.audioEnabled = audioEnabled;
    this.shutdownHook = useShutdownHook ? new Thread(this::shutdown, "JDA Shutdown Hook") : null;
    this.bulkDeleteSplittingEnabled = bulkDeleteSplittingEnabled;
    this.pool = new ScheduledThreadPoolExecutor(corePoolSize, new JDAThreadFactory());
    this.maxReconnectDelay = maxReconnectDelay;
    this.sessionController = controller == null ? new SessionControllerAdapter() : controller;
    if (enableMDC)
        this.contextMap = contextMap == null ? new ConcurrentHashMap<>() : contextMap;
    else
        this.contextMap = null;

    this.presence = new PresenceImpl(this);
    this.requester = new Requester(this);
    this.requester.setRetryOnTimeout(retryOnTimeout);

    this.jdaClient = accountType == AccountType.CLIENT ? new JDAClientImpl(this) : null;
    this.jdaBot = accountType == AccountType.BOT ? new JDABotImpl(this) : null;
}
 
开发者ID:DV8FromTheWorld,项目名称:JDA,代码行数:28,代码来源:JDAImpl.java

示例2: invalidate

import net.dv8tion.jda.client.entities.impl.JDAClientImpl; //导入依赖的package包/类
protected void invalidate()
{
    sessionId = null;
    chunkingAndSyncing = false;
    sentAuthInfo = false;

    chunkSyncQueue.clear();
    api.getTextChannelMap().clear();
    api.getVoiceChannelMap().clear();
    api.getCategoryMap().clear();
    api.getGuildMap().clear();
    api.getUserMap().clear();
    api.getPrivateChannelMap().clear();
    api.getFakeUserMap().clear();
    api.getFakePrivateChannelMap().clear();
    api.getEntityBuilder().clearCache();
    api.getEventCache().clear();
    api.getGuildLock().clear();
    this.<ReadyHandler>getHandler("READY").clearCache();
    this.<GuildMembersChunkHandler>getHandler("GUILD_MEMBERS_CHUNK").clearCache();

    if (api.getAccountType() == AccountType.CLIENT)
    {
        JDAClientImpl client = api.asClient();

        client.getRelationshipMap().clear();
        client.getGroupMap().clear();
        client.getCallUserMap().clear();
    }
}
 
开发者ID:DV8FromTheWorld,项目名称:JDA,代码行数:31,代码来源:WebSocketClient.java

示例3: WebSocketExtension

import net.dv8tion.jda.client.entities.impl.JDAClientImpl; //导入依赖的package包/类
public WebSocketExtension(JDAClientImpl api)
{
    this.api = api;
}
 
开发者ID:DV8FromTheWorld,项目名称:JDA-Client,代码行数:5,代码来源:WebSocketExtension.java

示例4: CustomWebSocketHandler

import net.dv8tion.jda.client.entities.impl.JDAClientImpl; //导入依赖的package包/类
public CustomWebSocketHandler(JDAClientImpl api)
{
    this.api = api;
    this.wse = new WebSocketExtension(api);
}
 
开发者ID:duke605,项目名称:DiscordCE,代码行数:6,代码来源:CustomWebSocketHandler.java

示例5: onReady

import net.dv8tion.jda.client.entities.impl.JDAClientImpl; //导入依赖的package包/类
@Override
public void onReady(ReadyEvent e)
{
    // Updating player status
    ConcurrentUtil.executor.execute(() -> e.getJDA().getAccountManager().setGame("Minecraft [Menus]"));
    DiscordCE.client = (JDAClient) e.getJDA();

    // Setting interceptor
    ((JDAClientImpl) DiscordCE.client)
            .getClient()
            .setCustomHandler(new CustomWebSocketHandler((JDAClientImpl) DiscordCE.client));

    // Setting default guild and channel
    if (Preferences.i.usingChannel.equals("") && e.getJDA().getGuilds().size() > 0)
    {
        Preferences.i.usingGuild = e.getJDA().getGuilds().get(0).getId();
        Preferences.i.usingChannel = e.getJDA().getGuilds().get(0).getPublicChannel().getId();
        Preferences.save();
    }

    // Getting block list
    ConcurrentUtil.executor.execute(() -> {
        Requester.Response r = ((JDAClientImpl) DiscordCE.client).getRequester()
                .get(Requester.DISCORD_API_PREFIX + "users/@me/relationships");

        if (!r.isOk())
            return;

        for(Object o :  r.getArray()) {
            JSONObject jo = (JSONObject) o;

            VolatileSettings.relationships.put(jo.getString("id"), new Relationship(jo));
        }
    });

    // Adding hook to shutdown dce when user exists
    Runtime.getRuntime().addShutdownHook(new Thread(() -> {
        DiscordCE.client.shutdown(false);
        MixpanelUtil.sentGameStopEvent(false);
    }));
}
 
开发者ID:duke605,项目名称:DiscordCE,代码行数:42,代码来源:DiscordEventHandler.java

示例6: asClient

import net.dv8tion.jda.client.entities.impl.JDAClientImpl; //导入依赖的package包/类
@Override
public JDAClientImpl asClient()
{
    AccountTypeException.check(getAccountType(), AccountType.CLIENT);
    return jdaClient;
}
 
开发者ID:DV8FromTheWorld,项目名称:JDA,代码行数:7,代码来源:JDAImpl.java


注:本文中的net.dv8tion.jda.client.entities.impl.JDAClientImpl类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。