Java Code Examples for com.sedmelluq.discord.lavaplayer.track.AudioTrackEndReason#REPLACED

The following examples show how to use com.sedmelluq.discord.lavaplayer.track.AudioTrackEndReason#REPLACED . 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: PlayerServiceImpl.java    From JuniperBot with GNU General Public License v3.0 6 votes vote down vote up
@Override
protected void onTrackEnd(PlaybackInstance instance, AudioTrackEndReason endReason) {
    notifyCurrentEnd(instance, endReason);
    if (endReason.mayStartNext && featureSetService.isAvailable(instance.getGuildId())) {
        if (instance.playNext()) {
            return;
        }
        TrackRequest current = instance.getCurrent();
        if (current != null) {
            contextService.withContext(instance.getGuildId(), () -> messageManager.onQueueEnd(current));
        }
    }

    if (endReason != AudioTrackEndReason.REPLACED) {
        // execute instance reset out of current thread
        taskExecutor.execute(() -> clearInstance(instance, false));
    }
}
 
Example 2
Source File: LavalinkInternalPlayerEventHandler.java    From Lavalink-Client with MIT License 4 votes vote down vote up
@Override
public void onTrackEnd(IPlayer player, AudioTrack track, AudioTrackEndReason endReason) {
    if (endReason != AudioTrackEndReason.REPLACED && endReason != AudioTrackEndReason.STOPPED) {
        ((LavalinkPlayer) player).clearTrack();
    }
}