From f2ea09db3329167d6e5225359d1046491e06d0ce Mon Sep 17 00:00:00 2001 From: TopiSenpai Date: Thu, 27 Jan 2022 19:03:37 +0100 Subject: [PATCH] fix double blocking of cf --- .../github/topislavalinkplugins/spotify/SpotifyTrack.java | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/main/java/com/github/topislavalinkplugins/spotify/SpotifyTrack.java b/src/main/java/com/github/topislavalinkplugins/spotify/SpotifyTrack.java index afa0bbbf..7b6444ce 100644 --- a/src/main/java/com/github/topislavalinkplugins/spotify/SpotifyTrack.java +++ b/src/main/java/com/github/topislavalinkplugins/spotify/SpotifyTrack.java @@ -117,7 +117,7 @@ public AudioSourceManager getSourceManager(){ return this.spotifySourceManager; } - public AudioItem loadItem(String query) throws ExecutionException, InterruptedException{ + public AudioItem loadItem(String query) { var cf = new CompletableFuture(); this.spotifySourceManager.getAudioPlayerManager().loadItem(query, new AudioLoadResultHandler(){ @@ -141,8 +141,7 @@ public void loadFailed(FriendlyException exception){ cf.completeExceptionally(exception); } }); - cf.join(); - return cf.get(); + return cf.join(); } @Override