Java/Janino editor fixes and improvements:

- Fixed clicking and adding hooks not properly resolving added types like INpcEvent.CollideEvent

- Imported wildcards of all available events in the given context.
  i.e ScriptContext NPC has INpcEvent,IProjectileEvent,IAbilityEvent,etc.. as available wildcard imports

- Added nested types to autocomplete of outer classes so INpcEvent. shows InitEvent, UpdateEvent, InteractEvent,etc...

- Added wildcard imports to autocomplete
This commit is contained in:
bigguy345 committed 2026-03-04 15:08:30 +02:00
1 parent 784fb8da65
commit 24af603ce1
4 files changed
+89 -20

No files matched your search

@@ -136,6 +136,12 @@ public class ScriptContext {
*/
private final List<String> namespaces;
/**
* Fully qualified names of the event interface classes this context supports.
* Only populated when registered via the Class<?> overload.
*/
private final List<String> namespaceFQNs = new ArrayList<>();
// ==================== CONSTRUCTOR ====================
private ScriptContext(String id, String hookContext, String... namespaces) {
@@ -155,6 +161,16 @@ public class ScriptContext {
return Collections.unmodifiableList(namespaces);
}
/**
* Get the fully qualified names of event interface classes this context supports.
* Only populated for contexts registered with Class<?> references.
*
* @return Unmodifiable list of FQN strings (e.g., "noppes.npcs.api.event.INpcEvent")
*/
public List<String> getNamespaceFQNs() {
return Collections.unmodifiableList(namespaceFQNs);
}
/**
* Check if this context includes a specific namespace.
*
@@ -220,7 +236,11 @@ public class ScriptContext {
for (int i = 0; i < eventClasses.length; i++) {
namespaces[i] = eventClasses[i].getSimpleName();
}
return register(id, hookContext, namespaces);
ScriptContext context = register(id, hookContext, namespaces);
for (Class<?> clazz : eventClasses) {
context.namespaceFQNs.add(clazz.getName().replace('$', '.'));
}
return context;
}
/**