本文整理汇总了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;
}
示例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();
}
}
示例3: WebSocketExtension
import net.dv8tion.jda.client.entities.impl.JDAClientImpl; //导入依赖的package包/类
public WebSocketExtension(JDAClientImpl api)
{
this.api = api;
}
示例4: CustomWebSocketHandler
import net.dv8tion.jda.client.entities.impl.JDAClientImpl; //导入依赖的package包/类
public CustomWebSocketHandler(JDAClientImpl api)
{
this.api = api;
this.wse = new WebSocketExtension(api);
}
示例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);
}));
}
示例6: asClient
import net.dv8tion.jda.client.entities.impl.JDAClientImpl; //导入依赖的package包/类
@Override
public JDAClientImpl asClient()
{
AccountTypeException.check(getAccountType(), AccountType.CLIENT);
return jdaClient;
}