Skip to content

Commit

Permalink
fix: JvmPluginDescription check (#2791)
Browse files Browse the repository at this point in the history
  • Loading branch information
cssxsh committed Sep 11, 2023
1 parent b500830 commit 323f6b3
Showing 1 changed file with 6 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import io.github.karlatemp.caller.StackFrame
import kotlinx.serialization.Serializable
import net.mamoe.mirai.console.compiler.common.ResolveContext
import net.mamoe.mirai.console.compiler.common.ResolveContext.Kind.*
import net.mamoe.mirai.console.internal.plugin.JvmPluginClassLoaderN
import net.mamoe.mirai.console.internal.util.findLoader
import net.mamoe.mirai.console.plugin.description.PluginDependency
import net.mamoe.mirai.console.plugin.description.PluginDescription
Expand Down Expand Up @@ -47,6 +48,11 @@ public interface JvmPluginDescription : PluginDescription {
pluginClassloader: ClassLoader = CallerFinder.getCaller()?.findLoader()
?: error("Cannot find caller classloader, please specify manually."),
): JvmPluginDescription {
if (filename == "plugin.yml") {
val cache = (pluginClassloader as? JvmPluginClassLoaderN)?.pluginDescriptionFromPluginResource
if (cache != null) return cache
}

val stream = pluginClassloader.getResourceAsStream(filename)
?: error("Cannot find plugin description resource '$filename'")

Expand Down

0 comments on commit 323f6b3

Please sign in to comment.