mirror of
https://github.com/KAMKEEL/CustomNPC-Plus.git
synced 2026-11-14 02:34:10 +00:00
Add Script Optimizations / Caching
This commit is contained in:
1 parent
b231f65bfb
commit
8119515705
6 files changed
+74
-15
No files matched your search
@@ -45,6 +45,7 @@ public class DataScript implements IScriptHandlerPacket {
|
||||
public String scriptLanguage = "ECMAScript";
|
||||
private EntityNPCInterface npc;
|
||||
public boolean enabled = false;
|
||||
private long lastGlobalsVersion = -1;
|
||||
|
||||
public ICustomNpc dummyNpc;
|
||||
public IWorld dummyWorld;
|
||||
@@ -271,9 +272,13 @@ public class DataScript implements IScriptHandlerPacket {
|
||||
engine.put(entry.getKey(), entry.getValue().value);
|
||||
}
|
||||
|
||||
engine.put("API", NpcAPI.Instance());
|
||||
for (Map.Entry<String, Object> engineObjects : NpcAPI.engineObjects.entrySet()) {
|
||||
engine.put(engineObjects.getKey(), engineObjects.getValue());
|
||||
long currentGlobalsVersion = NpcAPI.engineObjectsVersion;
|
||||
if (lastGlobalsVersion != currentGlobalsVersion) {
|
||||
engine.put("API", NpcAPI.Instance());
|
||||
for (Map.Entry<String, Object> engineObjects : NpcAPI.engineObjects.entrySet()) {
|
||||
engine.put(engineObjects.getKey(), engineObjects.getValue());
|
||||
}
|
||||
lastGlobalsVersion = currentGlobalsVersion;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user