mirror of
https://github.com/KAMKEEL/CustomNPC-Plus.git
synced 2026-11-12 21:17:32 +00:00
Fetched correct package name for Class<?> types that have null getPackage
This commit is contained in:
1 parent
28761df3b2
commit
586d43f08b
1 file changed
+9
-1
@@ -77,7 +77,15 @@ public class TypeInfo {
|
||||
String fullName = clazz.getName();
|
||||
String simpleName = clazz.getSimpleName();
|
||||
Package pkg = clazz.getPackage();
|
||||
String packageName = pkg != null ? pkg.getName() : "";
|
||||
String packageName = "";
|
||||
if (pkg != null) {
|
||||
packageName = pkg.getName();
|
||||
} else if (!fullName.equals(simpleName)) {
|
||||
int lastDot = fullName.lastIndexOf('.');
|
||||
if (lastDot > 0) {
|
||||
packageName = fullName.substring(0, lastDot);
|
||||
}
|
||||
}
|
||||
|
||||
TypeInfo enclosing = null;
|
||||
if (clazz.getEnclosingClass() != null) {
|
||||
|
||||
Reference in new issue
Block a user