Skip to content

Commit 2f010c5

Browse files
committed
fix: actually registering plugins
1 parent c81107a commit 2f010c5

File tree

2 files changed

+8
-3
lines changed

2 files changed

+8
-3
lines changed

LavalinkServer/src/main/java/lavalink/server/Launcher.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@ object Launcher {
143143
.properties(properties)
144144
.web(WebApplicationType.SERVLET)
145145
.bannerMode(Banner.Mode.OFF)
146-
.resourceLoader(DefaultResourceLoader(pluginManager::class.java.classLoader))
146+
.resourceLoader(DefaultResourceLoader(pluginManager.classLoader))
147147
.listeners(
148148
ApplicationListener { event: Any ->
149149
when (event) {

LavalinkServer/src/main/java/lavalink/server/bootstrap/PluginManager.kt

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,12 +21,17 @@ class PluginManager(val config: PluginsConfig) {
2121

2222
final val pluginManifests: MutableList<PluginManifest> = mutableListOf()
2323

24+
var classLoader = javaClass.classLoader
25+
2426
init {
2527
manageDownloads()
28+
2629
pluginManifests.apply {
2730
addAll(readClasspathManifests())
2831
addAll(loadJars())
2932
}
33+
34+
println(pluginManifests)
3035
}
3136

3237
private fun manageDownloads() {
@@ -104,12 +109,12 @@ class PluginManager(val config: PluginsConfig) {
104109
?.takeIf { it.isNotEmpty() }
105110
?: return emptyList()
106111

107-
val classLoader = URLClassLoader.newInstance(
112+
classLoader = URLClassLoader.newInstance(
108113
jarsToLoad.map { URL("jar:file:${it.absolutePath}!/") }.toTypedArray(),
109114
javaClass.classLoader
110115
)
111116

112-
return jarsToLoad.flatMap { loadJar(it, classLoader) }
117+
return jarsToLoad.flatMap { loadJar(it, classLoader as URLClassLoader) }
113118
}
114119

115120
private fun loadJar(file: File, cl: URLClassLoader): List<PluginManifest> {

0 commit comments

Comments
 (0)