diff options
author | Nick Hensel <[email protected]> | 2022-09-20 03:07:03 +0200 |
---|---|---|
committer | GitHub <[email protected]> | 2022-09-20 02:07:03 +0100 |
commit | f8742e26ccb935cd82af1d0a4270a53ffee8ae3a (patch) | |
tree | 6b3c74a52e293227136dd977ef183eb91b529e3a | |
parent | dbc2d60ce08812cd55fc5bab7b6bd4bd8a71c77f (diff) | |
download | Paper-f8742e26ccb935cd82af1d0a4270a53ffee8ae3a.tar.gz Paper-f8742e26ccb935cd82af1d0a4270a53ffee8ae3a.zip |
Also load resources from LibraryLoader (#8335)
-rw-r--r-- | LICENSE.md | 1 | ||||
-rw-r--r-- | patches/api/0392-Also-load-resources-from-LibraryLoader.patch | 48 |
2 files changed, 49 insertions, 0 deletions
diff --git a/LICENSE.md b/LICENSE.md index 9e740e1570..e0ebe1e254 100644 --- a/LICENSE.md +++ b/LICENSE.md @@ -49,4 +49,5 @@ Owen1212055 <[email protected]> LemonCaramel <[email protected]> Noah van der Aa <[email protected]> Doc <[email protected]> +Nick Hensel <[email protected]> ``` diff --git a/patches/api/0392-Also-load-resources-from-LibraryLoader.patch b/patches/api/0392-Also-load-resources-from-LibraryLoader.patch new file mode 100644 index 0000000000..9843c45af2 --- /dev/null +++ b/patches/api/0392-Also-load-resources-from-LibraryLoader.patch @@ -0,0 +1,48 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Nick Hensel <[email protected]> +Date: Sun, 28 Aug 2022 23:44:18 +0200 +Subject: [PATCH] Also load resources from LibraryLoader + + +diff --git a/src/main/java/org/bukkit/plugin/java/PluginClassLoader.java b/src/main/java/org/bukkit/plugin/java/PluginClassLoader.java +index 345394132df70593800127d34a38f8f8a4dafe00..f7cfe6c0d9d52ed72d0d45baaaf856c15769c668 100644 +--- a/src/main/java/org/bukkit/plugin/java/PluginClassLoader.java ++++ b/src/main/java/org/bukkit/plugin/java/PluginClassLoader.java +@@ -90,14 +90,35 @@ public final class PluginClassLoader extends URLClassLoader { // Spigot + + @Override + public URL getResource(String name) { +- return findResource(name); ++ // Paper start ++ URL resource = findResource(name); ++ if (resource == null && libraryLoader != null) { ++ return libraryLoader.getResource(name); ++ } ++ return resource; ++ // Paper end + } + + @Override + public Enumeration<URL> getResources(String name) throws IOException { +- return findResources(name); ++ // Paper start ++ java.util.ArrayList<URL> resources = new java.util.ArrayList<>(); ++ addEnumeration(resources, findResources(name)); ++ if (libraryLoader != null) { ++ addEnumeration(resources, libraryLoader.getResources(name)); ++ } ++ return Collections.enumeration(resources); ++ // Paper end + } + ++ // Paper start ++ private <T> void addEnumeration(java.util.ArrayList<T> list, Enumeration<T> enumeration) { ++ while (enumeration.hasMoreElements()) { ++ list.add(enumeration.nextElement()); ++ } ++ } ++ // Paper end ++ + @Override + protected Class<?> loadClass(String name, boolean resolve) throws ClassNotFoundException { + return loadClass0(name, resolve, true, true); |