mirror of
https://github.com/KAMKEEL/CustomNPC-Plus.git
synced 2026-11-17 15:45:10 +00:00
Made a new interface for CNPC+ script handlers and changed callScript functions to make them more 3rd party API-friendly
This commit is contained in:
1 parent
d433eccef1
commit
3b0879b0db
8 files changed
+59
-25
No files matched your search
@@ -29,7 +29,7 @@ import noppes.npcs.scripted.entity.ScriptNpc;
|
||||
import javax.script.ScriptEngine;
|
||||
import java.util.*;
|
||||
|
||||
public class DataScript implements IScriptHandler {
|
||||
public class DataScript implements INpcScriptHandler {
|
||||
public List<ScriptContainer> eventScripts = new ArrayList<>();
|
||||
|
||||
private HashMap<EnumScriptType,ScriptContainer> scripts = new HashMap<>();
|
||||
@@ -236,6 +236,14 @@ public class DataScript implements IScriptHandler {
|
||||
callScript(type, event, "$$IGNORED$$", null);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void callScript(String hookName, Event event) {
|
||||
try {
|
||||
EnumScriptType enumScriptType = EnumScriptType.valueOf(hookName);
|
||||
this.callScript(enumScriptType, event);
|
||||
} catch (IllegalArgumentException ignored) {}
|
||||
}
|
||||
|
||||
public boolean isClient() {
|
||||
return this.npc.isRemote();
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user