From b05141bc33e943266aa1b9797fc02ab1c320cb49 Mon Sep 17 00:00:00 2001 From: TudbuT Date: Wed, 27 Sep 2023 23:33:34 +0200 Subject: [PATCH] might actually work, TODO: try --- .../launcher/classloader/CustomClassloader.java | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/Loader/src/main/java/org/baseband/launcher/classloader/CustomClassloader.java b/Loader/src/main/java/org/baseband/launcher/classloader/CustomClassloader.java index df91a9e..cfc80e2 100644 --- a/Loader/src/main/java/org/baseband/launcher/classloader/CustomClassloader.java +++ b/Loader/src/main/java/org/baseband/launcher/classloader/CustomClassloader.java @@ -90,20 +90,18 @@ public class CustomClassloader extends ClassLoader { final byte[][] data = {null}; encryptedClasses.access(accessor -> Loader.classKey.access(classKey -> data[0] = classKey.getValue().decryptByte(accessor.getValue().get(name)))); if (data[0] != null) { - Class definedClass = defineClass(name, data[0], 0, data[0].length); - //// TudbuT // using unsafe is a bad idea as it breaks DataKeeper - // try { - // Field b = Unsafe.class.getDeclaredField("theUnsafe"); - // Unsafe unsafe = (Unsafe)b.get(null); - // Class definedClass = unsafe.defineClass(name, data[0], 0, data[0].length, this, null); + try { + Field b = Unsafe.class.getDeclaredField("theUnsafe"); + Unsafe unsafe = (Unsafe)b.get(null); + Class definedClass = unsafe.defineClass(name, data[0], 0, data[0].length, this, null); if (definedClass == null) { throw new ClassNotFoundException(name); } return definedClass; - // }catch (Exception e){ - // return null; - // } + } catch (Exception e){ + return null; + } } else { try { return Launch.classLoader.findClass(name);