From 3558355a7728f7664154a07cd28e5708235d65d8 Mon Sep 17 00:00:00 2001 From: devoxin Date: Wed, 8 May 2024 01:11:03 +0100 Subject: [PATCH] Make the enabled option actually do something, remove null check on client init --- .../java/dev/lavalink/youtube/YoutubeAudioSourceManager.java | 2 +- .../java/dev/lavalink/youtube/plugin/YoutubePluginLoader.java | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/common/src/main/java/dev/lavalink/youtube/YoutubeAudioSourceManager.java b/common/src/main/java/dev/lavalink/youtube/YoutubeAudioSourceManager.java index ee9e2c8..327de38 100644 --- a/common/src/main/java/dev/lavalink/youtube/YoutubeAudioSourceManager.java +++ b/common/src/main/java/dev/lavalink/youtube/YoutubeAudioSourceManager.java @@ -124,7 +124,7 @@ public YoutubeAudioSourceManager(boolean allowSearch, this.allowSearch = allowSearch; this.allowDirectVideoIds = allowDirectVideoIds; this.allowDirectPlaylistIds = allowDirectPlaylistIds; - this.clients = clients == null ? new Client[0] : clients; + this.clients = clients; this.cipherManager = new SignatureCipherManager(); YoutubeAccessTokenTracker tokenTracker = new YoutubeAccessTokenTracker(httpInterfaceManager); diff --git a/plugin/src/main/java/dev/lavalink/youtube/plugin/YoutubePluginLoader.java b/plugin/src/main/java/dev/lavalink/youtube/plugin/YoutubePluginLoader.java index c75362f..6f1fb9b 100644 --- a/plugin/src/main/java/dev/lavalink/youtube/plugin/YoutubePluginLoader.java +++ b/plugin/src/main/java/dev/lavalink/youtube/plugin/YoutubePluginLoader.java @@ -127,6 +127,10 @@ private AbstractRoutePlanner getRoutePlanner() { @Override public AudioPlayerManager configure(AudioPlayerManager audioPlayerManager) { + if (youtubeConfig != null && !youtubeConfig.getEnabled()) { + return audioPlayerManager; + } + final YoutubeAudioSourceManager source; final boolean allowSearch = youtubeConfig == null || youtubeConfig.getAllowSearch(); final boolean allowDirectVideoIds = youtubeConfig == null || youtubeConfig.getAllowDirectVideoIds();