mirror of
https://github.com/KAMKEEL/CustomNPC-Plus.git
synced 2026-11-17 16:55:12 +00:00
Linked Item Scripts + Effect Script Fix
This commit is contained in:
1 parent
5cbab2581c
commit
f84dd5477d
8 files changed
+532
-36
No files matched your search
@@ -22,7 +22,6 @@ public class LinkedItemScript implements INpcScriptHandler {
|
||||
public String scriptLanguage = "ECMAScript";
|
||||
public boolean enabled = false;
|
||||
|
||||
|
||||
public NBTTagCompound writeToNBT(NBTTagCompound compound) {
|
||||
compound.setString("ScriptLanguage", scriptLanguage);
|
||||
compound.setBoolean("ScriptEnabled", enabled);
|
||||
@@ -43,10 +42,6 @@ public class LinkedItemScript implements INpcScriptHandler {
|
||||
return this;
|
||||
}
|
||||
|
||||
public void callScript(ScriptType type, PlayerEvent.EffectEvent event) {
|
||||
callScript(type.function, event);
|
||||
}
|
||||
|
||||
public boolean isEnabled() {
|
||||
return this.enabled && ScriptController.HasStart && container != null && ConfigScript.ScriptingEnabled;
|
||||
}
|
||||
@@ -61,14 +56,6 @@ public class LinkedItemScript implements INpcScriptHandler {
|
||||
if (!this.isEnabled()) {
|
||||
return;
|
||||
}
|
||||
|
||||
ScriptEngine engine = container.engine;
|
||||
engine.put("API", NpcAPI.Instance());
|
||||
|
||||
for (Map.Entry<String, Object> engineObjects : NpcAPI.engineObjects.entrySet()) {
|
||||
engine.put(engineObjects.getKey(), engineObjects.getValue());
|
||||
}
|
||||
|
||||
container.run(s, event);
|
||||
}
|
||||
|
||||
@@ -115,7 +102,7 @@ public class LinkedItemScript implements INpcScriptHandler {
|
||||
|
||||
@Override
|
||||
public String noticeString() {
|
||||
return "";
|
||||
return "LinkedItem";
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -173,15 +160,4 @@ public class LinkedItemScript implements INpcScriptHandler {
|
||||
this.setEnabled(compound.getBoolean("ScriptEnabled"));
|
||||
}
|
||||
}
|
||||
|
||||
public enum ScriptType {
|
||||
OnAdd("onAdded"),
|
||||
OnTick("onTick"),
|
||||
OnRemove("onRemove");
|
||||
|
||||
public final String function;
|
||||
ScriptType(String functionName) {
|
||||
this.function = functionName;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user