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:
@@ -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() {
|
||||
|
||||
@@ -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
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user