diff --git a/LavalinkServer/src/main/java/lavalink/server/Launcher.kt b/LavalinkServer/src/main/java/lavalink/server/Launcher.kt index 28186c783..8252b9a47 100644 --- a/LavalinkServer/src/main/java/lavalink/server/Launcher.kt +++ b/LavalinkServer/src/main/java/lavalink/server/Launcher.kt @@ -143,7 +143,7 @@ object Launcher { .properties(properties) .web(WebApplicationType.SERVLET) .bannerMode(Banner.Mode.OFF) - .resourceLoader(DefaultResourceLoader(pluginManager::class.java.classLoader)) + .resourceLoader(DefaultResourceLoader(pluginManager.classLoader)) .listeners( ApplicationListener { event: Any -> when (event) { diff --git a/LavalinkServer/src/main/java/lavalink/server/bootstrap/PluginManager.kt b/LavalinkServer/src/main/java/lavalink/server/bootstrap/PluginManager.kt index e422785a6..ffce21334 100644 --- a/LavalinkServer/src/main/java/lavalink/server/bootstrap/PluginManager.kt +++ b/LavalinkServer/src/main/java/lavalink/server/bootstrap/PluginManager.kt @@ -21,12 +21,17 @@ class PluginManager(val config: PluginsConfig) { final val pluginManifests: MutableList = mutableListOf() + var classLoader = javaClass.classLoader + init { manageDownloads() + pluginManifests.apply { addAll(readClasspathManifests()) addAll(loadJars()) } + + println(pluginManifests) } private fun manageDownloads() { @@ -104,12 +109,12 @@ class PluginManager(val config: PluginsConfig) { ?.takeIf { it.isNotEmpty() } ?: return emptyList() - val classLoader = URLClassLoader.newInstance( + classLoader = URLClassLoader.newInstance( jarsToLoad.map { URL("jar:file:${it.absolutePath}!/") }.toTypedArray(), javaClass.classLoader ) - return jarsToLoad.flatMap { loadJar(it, classLoader) } + return jarsToLoad.flatMap { loadJar(it, classLoader as URLClassLoader) } } private fun loadJar(file: File, cl: URLClassLoader): List {