From 0c842a22b9ed4d391ad9d1c5246b277279161d31 Mon Sep 17 00:00:00 2001 From: bigguy345 Date: Tue, 24 Feb 2026 23:02:25 +0200 Subject: [PATCH] Fix java method declaration MethodInfo not being fetched properly --- .../gui/util/script/interpreter/ScriptDocument.java | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/main/java/noppes/npcs/client/gui/util/script/interpreter/ScriptDocument.java b/src/main/java/noppes/npcs/client/gui/util/script/interpreter/ScriptDocument.java index 54c7a6d37..70da1f1f5 100644 --- a/src/main/java/noppes/npcs/client/gui/util/script/interpreter/ScriptDocument.java +++ b/src/main/java/noppes/npcs/client/gui/util/script/interpreter/ScriptDocument.java @@ -3842,7 +3842,7 @@ public class ScriptDocument { continue; // Skip class/interface/enum declarations - these look like method declarations - // but "class Foo(" is not a method, it's a class declaration + // but "class Foo(" is not a method, it's a class declaration3 String returnType = m.group(1); if (returnType.equals("class") || returnType.equals("interface") || returnType.equals("enum") ||returnType.equals("new")) { continue; @@ -3850,9 +3850,14 @@ public class ScriptDocument { // Find the corresponding MethodInfo created in parseMethodDeclarations int methodDeclStart = m.start(); + int methodNameStart = m.start(2); MethodInfo methodInfo = null; for (MethodInfo method : getAllMethods()) { - if (method.getFullDeclarationOffset() == methodDeclStart) { + boolean matchesDeclStart = method.getTypeOffset() == methodDeclStart + || method.getFullDeclarationOffset() == methodDeclStart; + boolean matchesNameStart = method.getNameOffset() == methodNameStart; + + if (matchesDeclStart || matchesNameStart) { methodInfo = method; break; }