Paper/patches/api/0393-Also-load-resources-from-LibraryLoader.patch
Nassim Jahnke 928bcc8d3a
Updated Upstream (Bukkit/CraftBukkit) (#8430)
Upstream has released updates that appear to apply and compile correctly.
This update has not been tested by PaperMC and as with ANY update, please do your own testing

Bukkit Changes:
09943450 Update SnakeYAML version
5515734f SPIGOT-7162: Incorrect description for Entity#getVehicle javadoc
6f82b381 PR-788: Add getHand() to all relevant events

CraftBukkit Changes:
aaf484f6f SPIGOT-7163: CraftMerchantRecipe doesn't copy demand and specialPrice from BukkitMerchantRecipe
5329dd6fd PR-1107: Add getHand() to all relevant events
93061706e SPIGOT-7045: Ocelots never spawn with babies with spawn reason OCELOT_BABY
2022-10-02 09:56:36 +02:00

49 Zeilen
1.9 KiB
Diff

From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Nick Hensel <nickhensel25@icloud.com>
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);