diff --git a/Loader/src/main/java/de/com/baseband/launcher/classloader/CustomClassLoader.java b/Loader/src/main/java/de/com/baseband/launcher/classloader/CustomClassLoader.java index 3628930..969f603 100644 --- a/Loader/src/main/java/de/com/baseband/launcher/classloader/CustomClassLoader.java +++ b/Loader/src/main/java/de/com/baseband/launcher/classloader/CustomClassLoader.java @@ -67,6 +67,8 @@ public class CustomClassLoader extends ClassLoader implements Util { throw new IllegalStateException(MixinService.getService().getClass().toString()); } + registerAsParallelCapable(); + Field parent = ClassLoader.class.getDeclaredField("parent"); parent.setAccessible(true); parent.set(this, parent.get(Launch.classLoader)); @@ -97,8 +99,11 @@ public class CustomClassLoader extends ClassLoader implements Util { throw new RuntimeException(e); } } - URL r = Launch.classLoader.findResource(name); - if(r == null) + URL r; + synchronized (Launch.classLoader) { + r = Launch.classLoader.findResource(name); + } + if (r == null) return super.findResource(name); return r; } @@ -120,17 +125,17 @@ public class CustomClassLoader extends ClassLoader implements Util { @Override protected Class findClass(String name) throws ClassNotFoundException { - synchronized (Launch.classLoader) { - if (names.contains(name.replace('.', '/') + ".class")) { - Class clazz = loadBBClass(name); - if (clazz != null) - return clazz; - } - try { + if (names.contains(name.replace('.', '/') + ".class")) { + Class clazz = loadBBClass(name); + if (clazz != null) + return clazz; + } + try { + synchronized (Launch.classLoader) { return Launch.classLoader.findClass(name); - } catch (ClassNotFoundException e) { - return super.findClass(name); } + } catch (ClassNotFoundException e) { + return super.findClass(name); } }