diff --git a/LaunchServer/src/main/java/pro/gravit/launchserver/asm/NodeUtils.java b/LaunchServer/src/main/java/pro/gravit/launchserver/asm/NodeUtils.java new file mode 100644 index 00000000..17785154 --- /dev/null +++ b/LaunchServer/src/main/java/pro/gravit/launchserver/asm/NodeUtils.java @@ -0,0 +1,22 @@ +package pro.gravit.launchserver.asm; + +import java.io.IOException; +import java.io.InputStream; + +import org.objectweb.asm.ClassReader; +import org.objectweb.asm.tree.ClassNode; + +import pro.gravit.utils.helper.IOHelper; + +public final class NodeUtils { + private NodeUtils() { } + public static ClassNode forClass(Class cls, int flags) { + try (InputStream in = cls.getClassLoader().getResourceAsStream(cls.getName().replace('.', '/') + ".class")) { + ClassNode ret = new ClassNode(); + new ClassReader(IOHelper.read(in)).accept(ret, flags); + return ret; + } catch (IOException e) { + throw new RuntimeException(e); + } + } +} diff --git a/modules b/modules index 88bd03c3..f07089a3 160000 --- a/modules +++ b/modules @@ -1 +1 @@ -Subproject commit 88bd03c38a2681e997a305e376eb63e446c99a7f +Subproject commit f07089a3448c99793f3ecd8c1f8f6c389e49a7a0