mirror of
https://github.com/PaperMC/Paper.git
synced 2025-08-07 23:52:11 -07:00
Allow using PluginLoader classpath API from Bukkit plugins (#10758)
Allows using the PluginLoader API without any of the other changes imposed by switching to a paper-plugin.yml. Used by setting paper-plugin-loader in plugin.yml to the class name of your PluginLoader. Also allows skipping the libraries field by setting paper-skip-libraries to true (by default both libraries and jars provided by the PluginLoader are added to the classpath).
This commit is contained in:
@@ -936,13 +936,17 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
+ this.libraryLoader = libraryLoader;
|
||||
+
|
||||
+ this.logger = logger;
|
||||
+ if (this.configuration.hasOpenClassloader()) {
|
||||
+ if (this.configuration().hasOpenClassloader()) {
|
||||
+ this.group = PaperClassLoaderStorage.instance().registerOpenGroup(this);
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ private PaperPluginMeta configuration() {
|
||||
+ return (PaperPluginMeta) this.configuration;
|
||||
+ }
|
||||
+
|
||||
+ public void refreshClassloaderDependencyTree(DependencyContext dependencyContext) {
|
||||
+ if (this.configuration.hasOpenClassloader()) {
|
||||
+ if (this.configuration().hasOpenClassloader()) {
|
||||
+ return;
|
||||
+ }
|
||||
+ if (this.group != null) {
|
||||
@@ -1094,7 +1098,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
@@ -0,0 +0,0 @@
|
||||
+package io.papermc.paper.plugin.entrypoint.classloader;
|
||||
+
|
||||
+import io.papermc.paper.plugin.provider.configuration.PaperPluginMeta;
|
||||
+import io.papermc.paper.plugin.configuration.PluginMeta;
|
||||
+import io.papermc.paper.plugin.util.NamespaceChecker;
|
||||
+import org.jetbrains.annotations.ApiStatus;
|
||||
+
|
||||
@@ -1120,13 +1124,13 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
+ ClassLoader.registerAsParallelCapable();
|
||||
+ }
|
||||
+
|
||||
+ protected final PaperPluginMeta configuration;
|
||||
+ protected final PluginMeta configuration;
|
||||
+ protected final Path source;
|
||||
+ protected final Manifest jarManifest;
|
||||
+ protected final URL jarUrl;
|
||||
+ protected final JarFile jar;
|
||||
+
|
||||
+ public PaperSimplePluginClassLoader(Path source, JarFile file, PaperPluginMeta configuration, ClassLoader parentLoader) throws IOException {
|
||||
+ public PaperSimplePluginClassLoader(Path source, JarFile file, PluginMeta configuration, ClassLoader parentLoader) throws IOException {
|
||||
+ super(source.getFileName().toString(), new URL[]{source.toUri().toURL()}, parentLoader);
|
||||
+
|
||||
+ this.source = source;
|
||||
|
Reference in New Issue
Block a user