geforkt von Mirrors/Paper
Re-enable multi-release plugin JARs (#9001)
Dieser Commit ist enthalten in:
Ursprung
40b2d389d2
Commit
5f6566b549
@ -1,19 +0,0 @@
|
|||||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
||||||
From: Kyle Wood <kyle@denwav.dev>
|
|
||||||
Date: Fri, 4 Dec 2020 15:53:19 -0800
|
|
||||||
Subject: [PATCH] Enable multi-release plugin jars
|
|
||||||
|
|
||||||
|
|
||||||
diff --git a/src/main/java/org/bukkit/plugin/java/PluginClassLoader.java b/src/main/java/org/bukkit/plugin/java/PluginClassLoader.java
|
|
||||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
|
||||||
--- a/src/main/java/org/bukkit/plugin/java/PluginClassLoader.java
|
|
||||||
+++ b/src/main/java/org/bukkit/plugin/java/PluginClassLoader.java
|
|
||||||
@@ -0,0 +0,0 @@ public final class PluginClassLoader extends URLClassLoader implements io.paperm
|
|
||||||
this.description = description;
|
|
||||||
this.dataFolder = dataFolder;
|
|
||||||
this.file = file;
|
|
||||||
- this.jar = jarFile == null ? new JarFile(file) : jarFile; // Paper - use JarFile provided by SpigotPluginProvider
|
|
||||||
+ this.jar = jarFile == null ? new JarFile(file, true, java.util.zip.ZipFile.OPEN_READ, JarFile.runtimeVersion()) : jarFile; // Paper - use JarFile provided by SpigotPluginProvider // Paper - enable multi-release jars for Java 9+
|
|
||||||
this.manifest = jar.getManifest();
|
|
||||||
this.url = file.toURI().toURL();
|
|
||||||
this.libraryLoader = libraryLoader;
|
|
@ -2067,7 +2067,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
|
|
||||||
- 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 {
|
- 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
|
+ @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);
|
super(new URL[] {file.toURI().toURL()}, parent);
|
||||||
- Preconditions.checkArgument(loader != null, "Loader cannot be null");
|
- Preconditions.checkArgument(loader != null, "Loader cannot be null");
|
||||||
+ this.loader = null; // Paper - pass null into loader field
|
+ this.loader = null; // Paper - pass null into loader field
|
||||||
@ -2077,7 +2077,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
this.dataFolder = dataFolder;
|
this.dataFolder = dataFolder;
|
||||||
this.file = file;
|
this.file = file;
|
||||||
- this.jar = new JarFile(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.manifest = jar.getManifest();
|
||||||
this.url = file.toURI().toURL();
|
this.url = file.toURI().toURL();
|
||||||
this.libraryLoader = libraryLoader;
|
this.libraryLoader = libraryLoader;
|
||||||
|
@ -11,7 +11,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
@@ -0,0 +0,0 @@ public final class PluginClassLoader extends URLClassLoader implements io.paperm
|
@@ -0,0 +0,0 @@ public final class PluginClassLoader extends URLClassLoader implements io.paperm
|
||||||
|
|
||||||
@org.jetbrains.annotations.ApiStatus.Internal // Paper
|
@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);
|
- super(new URL[] {file.toURI().toURL()}, parent);
|
||||||
+ super(file.getName(), new URL[] {file.toURI().toURL()}, parent);
|
+ super(file.getName(), new URL[] {file.toURI().toURL()}, parent);
|
||||||
this.loader = null; // Paper - pass null into loader field
|
this.loader = null; // Paper - pass null into loader field
|
||||||
|
@ -5069,7 +5069,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
+ try {
|
+ try {
|
||||||
+ context = this.checkUpdate(context);
|
+ context = this.checkUpdate(context);
|
||||||
+
|
+
|
||||||
+ JarFile file = new JarFile(context.toFile());
|
+ JarFile file = new JarFile(context.toFile(), true, JarFile.OPEN_READ, JarFile.runtimeVersion());
|
||||||
+ PluginFileType<?, ?> type = PluginFileType.guessType(file);
|
+ PluginFileType<?, ?> type = PluginFileType.guessType(file);
|
||||||
+ if (type == null) {
|
+ if (type == null) {
|
||||||
+ throw new IllegalArgumentException(source + " is not a valid plugin file, cannot load a plugin from it!");
|
+ throw new IllegalArgumentException(source + " is not a valid plugin file, cannot load a plugin from it!");
|
||||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren