From 5d4be66aa81efb38b8fa26de53ab9dfdaad695f4 Mon Sep 17 00:00:00 2001 From: devoxin <15076404+devoxin@users.noreply.github.com> Date: Wed, 5 Jun 2024 21:33:37 +0100 Subject: [PATCH] Add method for registering multiple audio source managers in one go (#132) --- .../discord/lavaplayer/player/AudioPlayerManager.java | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/main/src/main/java/com/sedmelluq/discord/lavaplayer/player/AudioPlayerManager.java b/main/src/main/java/com/sedmelluq/discord/lavaplayer/player/AudioPlayerManager.java index 35eab02c..046d9280 100644 --- a/main/src/main/java/com/sedmelluq/discord/lavaplayer/player/AudioPlayerManager.java +++ b/main/src/main/java/com/sedmelluq/discord/lavaplayer/player/AudioPlayerManager.java @@ -40,6 +40,16 @@ public interface AudioPlayerManager { */ void registerSourceManager(AudioSourceManager sourceManager); + /** + * Same as {@link #registerSourceManager(AudioSourceManager)} but registers multiple in one call. + * @param sourceManagers The source managers to register, which will be used for subsequent loadItem calls + */ + default void registerSourceManagers(AudioSourceManager... sourceManagers) { + for (AudioSourceManager sourceManager : sourceManagers) { + registerSourceManager(sourceManager); + } + } + /** * Shortcut for accessing a source manager of a certain class. *