mirror of
https://github.com/KAMKEEL/CustomNPC-Plus.git
synced 2026-11-15 16:04:51 +00:00
Added run(EnumScriptType, Event) and
run(String, Event) methods to IScriptUnit interface, with JaninoScript delegating to callByHookType(). This provides a cleaner abstraction that supports both ScriptContainer and JaninoScript without type checking. Affected files: - IScriptUnit: Added run() methods to interface - JaninoScript: Implemented run() delegation methods - DataScript, PlayerDataScript, GlobalNPCDataScript, ForgeDataScript - EffectScript, LinkedItemScript, RecipeScript - ScriptCustomItem, TileScripted: Refactored to use polymorphic calls
This commit is contained in:
1 parent
cd60a03544
commit
cc0959dcfe
12 files changed
+156
-52
No files matched your search
@@ -94,14 +94,9 @@ public class GlobalNPCDataScript implements IScriptHandler {
|
||||
}
|
||||
|
||||
for (IScriptUnit script : this.scripts) {
|
||||
if (script == null || !script.hasCode())
|
||||
if (script == null || script.hasErrored() || !script.hasCode())
|
||||
continue;
|
||||
if (script instanceof ScriptContainer) {
|
||||
ScriptContainer container = (ScriptContainer) script;
|
||||
if (container.errored)
|
||||
continue;
|
||||
container.run(hookName, event);
|
||||
}
|
||||
script.run(hookName, event);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user