mirror of
https://github.com/PaperMC/Paper.git
synced 2024-12-28 15:30:19 +01:00
Allow modifying library loader jars bytecode
This commit is contained in:
parent
b0a676ba62
commit
d9e51980e6
1 changed files with 9 additions and 1 deletions
|
@ -46,6 +46,7 @@ public class LibraryLoader
|
||||||
private final RepositorySystem repository;
|
private final RepositorySystem repository;
|
||||||
private final DefaultRepositorySystemSession session;
|
private final DefaultRepositorySystemSession session;
|
||||||
private final List<RemoteRepository> repositories;
|
private final List<RemoteRepository> repositories;
|
||||||
|
public static java.util.function.BiFunction<URL[], ClassLoader, URLClassLoader> LIBRARY_LOADER_FACTORY; // Paper - rewrite reflection in libraries
|
||||||
|
|
||||||
public LibraryLoader(@NotNull Logger logger)
|
public LibraryLoader(@NotNull Logger logger)
|
||||||
{
|
{
|
||||||
|
@ -130,7 +131,14 @@ public class LibraryLoader
|
||||||
} );
|
} );
|
||||||
}
|
}
|
||||||
|
|
||||||
URLClassLoader loader = new URLClassLoader( jarFiles.toArray( new URL[ jarFiles.size() ] ), getClass().getClassLoader() );
|
// Paper start - rewrite reflection in libraries
|
||||||
|
URLClassLoader loader;
|
||||||
|
if (LIBRARY_LOADER_FACTORY == null) {
|
||||||
|
loader = new URLClassLoader( jarFiles.toArray( new URL[ jarFiles.size() ] ), getClass().getClassLoader() );
|
||||||
|
} else {
|
||||||
|
loader = LIBRARY_LOADER_FACTORY.apply(jarFiles.toArray( new URL[ jarFiles.size() ] ), getClass().getClassLoader());
|
||||||
|
}
|
||||||
|
// Paper end - rewrite reflection in libraries
|
||||||
|
|
||||||
return loader;
|
return loader;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue