public static void setPlaybackChain(int i) {
        if(i == 0) {
            if(loopingRepeat)
                setPrevTrack(playQueueTracks.get(playQueueTracks.size()-1));
            else
                setPrevTrack(null);

            setNextTrack(playQueueTracks.get(getNextTrackIndex(i)));

            currentPlayback.setOnEndOfMedia(new Runnable() {
                @Override
                public void run() {
                    server.onTrackChange();
                    setCurrentTrack(nextTrack);
                    play();
                }
            });
        } else if(i == playQueueTracks.size() - 1 && !loopingRepeat) {
            setNextTrack(null);
            setPrevTrack(playQueueTracks.get(getPrevTrackIndex(i)));

            currentPlayback.setOnEndOfMedia(new Runnable() {
                @Override
                public void run() {
                    server.onTrackChange();
                }
            });
        } else {
            setPrevTrack(playQueueTracks.get(getPrevTrackIndex(i)));
            setNextTrack(playQueueTracks.get(getNextTrackIndex(i)));

            currentPlayback.setOnEndOfMedia(new Runnable() {
                @Override
                public void run() {
                    server.onTrackChange();
                    setCurrentTrack(nextTrack);
                    play();
                }
            });
        }
    }