9
0
mirror of https://github.com/VolmitSoftware/Iris.git synced 2025-12-19 15:09:18 +00:00

make jar scanner also load child classes

This commit is contained in:
Julian Krings
2025-09-02 12:27:26 +02:00
parent 9ea425aee4
commit 43131ed8f6
2 changed files with 23 additions and 1 deletions

View File

@@ -567,7 +567,7 @@ public class Iris extends VolmitPlugin implements Listener {
postShutdown.forEach(Runnable::run);
super.onDisable();
J.attempt(new JarScanner(instance.getJarFile(), "", false)::scan);
J.attempt(new JarScanner(instance.getJarFile(), "", false)::scanAll);
}
private void setupPapi() {

View File

@@ -83,6 +83,28 @@ public class JarScanner {
zip.close();
}
public void scanAll() throws IOException {
classes.clear();
FileInputStream fin = new FileInputStream(jar);
ZipInputStream zip = new ZipInputStream(fin);
for (ZipEntry entry = zip.getNextEntry(); entry != null; entry = zip.getNextEntry()) {
if (!entry.isDirectory() && entry.getName().endsWith(".class")) {
String c = entry.getName().replaceAll("/", ".").replace(".class", "");
if (c.startsWith(superPackage)) {
try {
Class<?> clazz = Class.forName(c);
classes.add(clazz);
} catch (Throwable e) {
if (!report) continue;
Iris.reportError(e);
e.printStackTrace();
}
}
}
}
}
/**
* Get the scanned clases
*