mirror of
https://github.com/KAMKEEL/CustomNPC-Plus.git
synced 2026-11-13 06:37:34 +00:00
Fixed primitive types not being properly resolved
This commit is contained in:
1 parent
8a0c7c5a65
commit
c591a91857
2 files changed
+20
No files matched your search
@@ -804,6 +804,16 @@ public class ScriptDocument {
|
||||
// Strip array brackets
|
||||
baseName = baseName.replace("[]", "").trim();
|
||||
|
||||
// Check primitive types first
|
||||
if (TypeResolver.isPrimitiveType(baseName)) {
|
||||
return TypeInfo.forPrimitive(baseName);
|
||||
}
|
||||
|
||||
// Check for String (common case)
|
||||
if (baseName.equals("String")) {
|
||||
return typeResolver.resolveFullName("java.lang.String");
|
||||
}
|
||||
|
||||
// Check script-defined types FIRST
|
||||
if (scriptTypes.containsKey(baseName)) {
|
||||
return scriptTypes.get(baseName);
|
||||
|
||||
@@ -370,6 +370,16 @@ public class TypeResolver {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Check if a type name is a primitive type.
|
||||
*/
|
||||
public static boolean isPrimitiveType(String typeName) {
|
||||
return typeName.equals("boolean") || typeName.equals("byte") || typeName.equals("char") ||
|
||||
typeName.equals("short") || typeName.equals("int") || typeName.equals("long") ||
|
||||
typeName.equals("float") || typeName.equals("double") || typeName.equals("void");
|
||||
}
|
||||
|
||||
/**
|
||||
* Represents a type occurrence within generic content.
|
||||
*/
|
||||
|
||||
Reference in new issue
Block a user