Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: JvmPluginDescription check #2791

Merged
merged 1 commit into from
Sep 11, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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