本文整理汇总了Java中net.dv8tion.jda.core.managers.AudioManager.closeAudioConnection方法的典型用法代码示例。如果您正苦于以下问题:Java AudioManager.closeAudioConnection方法的具体用法?Java AudioManager.closeAudioConnection怎么用?Java AudioManager.closeAudioConnection使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类net.dv8tion.jda.core.managers.AudioManager
的用法示例。
在下文中一共展示了AudioManager.closeAudioConnection方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: clearItems
import net.dv8tion.jda.core.managers.AudioManager; //导入方法依赖的package包/类
private void clearItems(AudioManager manager, GuildMusicManager guildMusicManager, long guildId) {
if (guildMusicManager != null) {
guildMusicManager.getScheduler().getQueue().clear();
guildMusicManager.getPlayer().destroy();
if (guildMusicManager.getLastActiveMessage() != null) {
MessageFactory.makeInfo(guildMusicManager.getLastActiveMessage(), "The music has ended due to inactivity.").queue();
}
}
AudioHandler.MUSIC_MANAGER.remove(guildId);
MISSING_LISTENERS.remove(guildId);
EMPTY_QUEUE.remove(guildId);
manager.closeAudioConnection();
}
示例2: close
import net.dv8tion.jda.core.managers.AudioManager; //导入方法依赖的package包/类
public void close() {
AudioManager manager = guild.getAudioManager();
if (!manager.isConnected()) {
return;
}
manager.closeAudioConnection();
}
示例3: joinChannel
import net.dv8tion.jda.core.managers.AudioManager; //导入方法依赖的package包/类
private boolean joinChannel(VoiceChannel channel, Guild guild)
{
log.info("Attempt to join channel: <" + channel.getName() + ">");
// Gets the audio manager, and opens an audio connection (Connects to the voice channel)
AudioManager manager = guild.getAudioManager();
if (manager.isConnected() || manager.isAttemptingToConnect())
{
manager.closeAudioConnection();
manager.openAudioConnection(channel);
}
else
manager.openAudioConnection(channel);
// Waits for the connection to occur.
int iterations = 0;
while (!manager.isConnected())
{
try
{
if (iterations >= MAX_ATTEMPTS)
break;
Thread.sleep(100);
iterations++;
}
catch (InterruptedException e)
{
log.warn("Interrupted while attempting to connect to voice channel.");
return false;
}
}
log.info("Successfully joined channel: <" + channel.getName() + ">");
return true;
}
示例4: leaveChannel
import net.dv8tion.jda.core.managers.AudioManager; //导入方法依赖的package包/类
private boolean leaveChannel(Guild guild, VoiceChannel channel)
{
// Gets the audio manager and closes the connection (Leaves the voice channel)
AudioManager manager = channel.getGuild().getAudioManager();
manager.closeAudioConnection();
this.isLocked = false;
return true;
}
示例5: disconnectFromVoiceChat
import net.dv8tion.jda.core.managers.AudioManager; //导入方法依赖的package包/类
public int disconnectFromVoiceChat(AudioManager manager) {
int res = 0;
if (manager.isConnected()) {
getGuildAudioPlayer(manager.getGuild()).player.stopTrack();
getGuildAudioPlayer(manager.getGuild()).scheduler.clearQueue();
manager.closeAudioConnection();
res = 1;
}
return res;
}
示例6: leaveVoiceChannelRequest
import net.dv8tion.jda.core.managers.AudioManager; //导入方法依赖的package包/类
public void leaveVoiceChannelRequest(TextChannel channel, boolean silent) {
AudioManager manager = getGuild().getAudioManager();
if (!silent) {
if (manager.getConnectedChannel() == null) {
channel.sendMessage(I18n.get(getGuild()).getString("playerNotInChannel")).queue();
} else {
channel.sendMessage(MessageFormat.format(I18n.get(getGuild()).getString("playerLeftChannel"), getChannel().getName())).queue();
}
}
manager.closeAudioConnection();
subscriber.unsubscribe();
}
示例7: executeCommand
import net.dv8tion.jda.core.managers.AudioManager; //导入方法依赖的package包/类
@Override
public void executeCommand(Message msg) {
EmbedBuilder em = new EmbedBuilder().setTimestamp(Instant.now());
AudioManager audio = msg.getGuild().getAudioManager();
audio.closeAudioConnection();
GuildObject.guildMap.get(msg.getGuild().getId()).getMusicManager().reset();
em.setTitle("Success", null)
.setColor(Util.resolveColor(Util.memberFromMessage(msg), Color.GREEN))
.setDescription("Left your voice channel and cleared the queue");
msg.getChannel().sendMessage(em.build()).queue();
}
示例8: leave
import net.dv8tion.jda.core.managers.AudioManager; //导入方法依赖的package包/类
public void leave() {
leaveTask = null;
AudioManager manager = getGuild().getAudioManager();
manager.setSendingHandler(null);
manager.closeAudioConnection();
scheduler.clear();
player.stopTrack();
player.destroy();
GabrielBot.getInstance().removePlayer(guildId);
if(GabrielBot.getInstance().getPlayer(guildId) != null) {
GabrielBot.LOGGER.error("Player was not removed: " + this + " " + guildId);
}
}