fix ctx classloader

This commit is contained in:
yushijinhun 2018-02-12 23:15:04 +08:00
parent 50159626ae
commit feab9141c3
No known key found for this signature in database
GPG key ID: 5BC167F73EA558E4

View file

@ -18,9 +18,15 @@ public class AuthlibInjectorTweaker implements ITweaker {
@Override
public void injectIntoClassLoader(LaunchClassLoader launchClassLoader) {
log("launched from tweaker");
bootstrap(transformers::add);
launchClassLoader.registerTransformer(TweakerTransformerAdapter.class.getName());
ClassLoader originalCtxCl = Thread.currentThread().getContextClassLoader();
Thread.currentThread().setContextClassLoader(getClass().getClassLoader());
try {
log("launched from tweaker");
bootstrap(transformers::add);
launchClassLoader.registerTransformer(TweakerTransformerAdapter.class.getName());
} finally {
Thread.currentThread().setContextClassLoader(originalCtxCl);
}
}
@Override