mirror of
https://github.com/PaperMC/Paper.git
synced 2024-12-27 23:10:16 +01:00
Also load resources from LibraryLoader
This commit is contained in:
parent
49b56fd1fb
commit
9b6aadff54
1 changed files with 23 additions and 2 deletions
|
@ -109,14 +109,35 @@ public final class PluginClassLoader extends URLClassLoader implements io.paperm
|
|||
|
||||
@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
|
||||
|
||||
// Paper start
|
||||
@Override
|
||||
public Class<?> loadClass(@NotNull String name, boolean resolve, boolean checkGlobal, boolean checkLibraries) throws ClassNotFoundException {
|
||||
|
|
Loading…
Reference in a new issue