Re-enable multi-release plugin JARs (#9001)

This commit is contained in:
Emily 2023-03-19 11:50:13 -03:00 committed by GitHub
parent 055f7228f0
commit 510082222b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
192 changed files with 9 additions and 28 deletions

View file

@ -5,7 +5,7 @@ Subject: [PATCH] Paper Plugins
diff --git a/build.gradle.kts b/build.gradle.kts
index d95b3d504ddc9ed76fc86cd45fa922d68e597827..9d6e604c7667985dc8107a5df9d36c53e8006326 100644
index bb1f3b3d5a22ca391f4362e5d4cf016e7e9be0e3..f900b73c52971fe682171e7f99246afdb8b080f3 100644
--- a/build.gradle.kts
+++ b/build.gradle.kts
@@ -45,7 +45,7 @@ dependencies {
@ -2040,7 +2040,7 @@ index 6d634b0ea813ccb19f1562a7d0e5a59cea4eab21..e4b6f278a811acbb0070e311c5c3bdaf
}
diff --git a/src/main/java/org/bukkit/plugin/java/PluginClassLoader.java b/src/main/java/org/bukkit/plugin/java/PluginClassLoader.java
index 2f74ec96ece706de23156ebabfe493211bc05391..2d2fa6ce5200eb5c75a733f9f54f400113cc22b0 100644
index 2f74ec96ece706de23156ebabfe493211bc05391..302319acbc257a075adfb78d9f5c49fdadf45bdc 100644
--- a/src/main/java/org/bukkit/plugin/java/PluginClassLoader.java
+++ b/src/main/java/org/bukkit/plugin/java/PluginClassLoader.java
@@ -29,7 +29,8 @@ import org.jetbrains.annotations.Nullable;
@ -2067,7 +2067,7 @@ index 2f74ec96ece706de23156ebabfe493211bc05391..2d2fa6ce5200eb5c75a733f9f54f4001
- PluginClassLoader(@NotNull final JavaPluginLoader loader, @Nullable final ClassLoader parent, @NotNull final PluginDescriptionFile description, @NotNull final File dataFolder, @NotNull final File file, @Nullable ClassLoader libraryLoader) throws IOException, InvalidPluginException, MalformedURLException {
+ @org.jetbrains.annotations.ApiStatus.Internal // Paper
+ public PluginClassLoader(@Nullable final ClassLoader parent, @NotNull final PluginDescriptionFile description, @NotNull final File dataFolder, @NotNull final File file, @Nullable ClassLoader libraryLoader, @Nullable JarFile jarFile, io.papermc.paper.plugin.provider.entrypoint.DependencyContext dependencyContext) throws IOException, InvalidPluginException, MalformedURLException { // Paper // Paper - use JarFile provided by SpigotPluginProvider
+ public PluginClassLoader(@Nullable final ClassLoader parent, @NotNull final PluginDescriptionFile description, @NotNull final File dataFolder, @NotNull final File file, @Nullable ClassLoader libraryLoader, JarFile jarFile, io.papermc.paper.plugin.provider.entrypoint.DependencyContext dependencyContext) throws IOException, InvalidPluginException, MalformedURLException { // Paper // Paper - use JarFile provided by SpigotPluginProvider
super(new URL[] {file.toURI().toURL()}, parent);
- Preconditions.checkArgument(loader != null, "Loader cannot be null");
+ this.loader = null; // Paper - pass null into loader field
@ -2077,7 +2077,7 @@ index 2f74ec96ece706de23156ebabfe493211bc05391..2d2fa6ce5200eb5c75a733f9f54f4001
this.dataFolder = dataFolder;
this.file = file;
- this.jar = new JarFile(file);
+ this.jar = jarFile == null ? new JarFile(file) : jarFile; // Paper - use JarFile provided by SpigotPluginProvider
+ this.jar = jarFile; // Paper - use JarFile provided by SpigotPluginProvider
this.manifest = jar.getManifest();
this.url = file.toURI().toURL();
this.libraryLoader = libraryLoader;