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


Java AudioManager.closeAudioConnection方法代码示例

本文整理汇总了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();
}
 
开发者ID:avaire,项目名称:avaire,代码行数:17,代码来源:MusicActivityJob.java

示例2: close

import net.dv8tion.jda.core.managers.AudioManager; //导入方法依赖的package包/类
public void close() {
    AudioManager manager = guild.getAudioManager();
    if (!manager.isConnected()) {
        return;
    }
    manager.closeAudioConnection();
}
 
开发者ID:kacperduras,项目名称:Charrizard,代码行数:8,代码来源:CAudio.java

示例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;
}
 
开发者ID:SegfaultError11,项目名称:WeenieBot,代码行数:38,代码来源:WeenieBot.java

示例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;
}
 
开发者ID:SegfaultError11,项目名称:WeenieBot,代码行数:11,代码来源:WeenieBot.java

示例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;
}
 
开发者ID:elgoupil,项目名称:GoupilBot,代码行数:11,代码来源:Music.java

示例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();
}
 
开发者ID:Frederikam,项目名称:GensokyoBot,代码行数:13,代码来源:GuildPlayer.java

示例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();
}
 
开发者ID:paul-io,项目名称:momo-2,代码行数:13,代码来源:Leave.java

示例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);
    }
}
 
开发者ID:natanbc,项目名称:GabrielBot,代码行数:14,代码来源:GuildMusicPlayer.java


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