Format changes
This commit is contained in:
parent
27bff9e613
commit
7e099a985c
@ -1,5 +1,6 @@
|
|||||||
package me.libraryaddict.disguise.utilities.reflection;
|
package me.libraryaddict.disguise.utilities.reflection;
|
||||||
|
|
||||||
|
import me.libraryaddict.disguise.utilities.DisguiseUtilities;
|
||||||
import org.bukkit.entity.Entity;
|
import org.bukkit.entity.Entity;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
@ -51,13 +52,18 @@ public class ClassGetter {
|
|||||||
|
|
||||||
// Get a File object for the package
|
// Get a File object for the package
|
||||||
CodeSource src = runFrom.getProtectionDomain().getCodeSource();
|
CodeSource src = runFrom.getProtectionDomain().getCodeSource();
|
||||||
|
|
||||||
if (src != null) {
|
if (src != null) {
|
||||||
URL resource = src.getLocation();
|
URL resource = src.getLocation();
|
||||||
boolean isInsideJar = resource.getPath().toLowerCase(Locale.ENGLISH).contains(".jar!") && resource.getPath().toLowerCase(Locale.ENGLISH).endsWith(".class");
|
String path = resource.getPath().toLowerCase(Locale.ENGLISH);
|
||||||
if (resource.getPath().toLowerCase(Locale.ENGLISH).endsWith(".jar") || isInsideJar) {
|
|
||||||
|
boolean isInsideJar = path.endsWith(".jar") || (path.contains(".jar!") && path.endsWith(".class"));
|
||||||
|
|
||||||
|
if (isInsideJar) {
|
||||||
processJarfile(resource, pkgname, classes);
|
processJarfile(resource, pkgname, classes);
|
||||||
} else {
|
} else {
|
||||||
File[] baseFileList = new File(resource.getPath() + "/" + pkgname.replace(".", "/")).listFiles();
|
File[] baseFileList = new File(resource.getPath() + "/" + pkgname.replace(".", "/")).listFiles();
|
||||||
|
|
||||||
if (baseFileList != null) {
|
if (baseFileList != null) {
|
||||||
for (File f : baseFileList) {
|
for (File f : baseFileList) {
|
||||||
if (f.getName().contains("$")) {
|
if (f.getName().contains("$")) {
|
||||||
@ -67,7 +73,7 @@ public class ClassGetter {
|
|||||||
classes.add(pkgname + "/" + f.getName());
|
classes.add(pkgname + "/" + f.getName());
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
System.out.println("File not found for: " + resource.getPath() + "/" + pkgname.replace(".", "/"));
|
DisguiseUtilities.getLogger().severe("File not found for: " + resource.getPath() + "/" + pkgname.replace(".", "/"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user