public boolean hasPath(String path) { CustomScriptContainer csc = this; while (csc != null) { if (csc.contains(path)) { return true; } csc = ScriptRegistry.getScriptContainerAs(csc.inherit, CustomScriptContainer.class); } return false; }
public HashMap<String, String> getVars() { HashMap<String, String> vars; if (inherit != null) { ScriptContainer sc = ScriptRegistry.getScriptContainer(inherit); if (sc != null && sc instanceof CustomScriptContainer) { vars = ((CustomScriptContainer) sc).getVars(); } else { vars = new HashMap<String, String>(); } } else { vars = new HashMap<String, String>(); } for (String str : defaultVars.keySet()) { vars.remove(str); vars.put(str, defaultVars.get(str)); } return vars; }
public long runMechScript(String path, CustomObject obj, String value) { CustomScriptContainer csc = this; while (csc != null) { if (csc.contains("mechanisms." + path)) { ScriptQueue queue = InstantQueue.getQueue( ScriptQueue.getNextId("MECH_" + csc.getName() + "_" + path + "__")); List<ScriptEntry> listOfEntries = csc.getEntries( DenizenCore.getImplementation().getEmptyScriptEntryData(), "mechanisms." + path); long id = DetermineCommand.getNewId(); ScriptBuilder.addObjectToEntries(listOfEntries, "ReqId", id); CustomScriptContextSource cscs = new CustomScriptContextSource(); cscs.obj = obj; cscs.value = new Element(value); queue.setContextSource(cscs); queue.addEntries(listOfEntries); queue.start(); return id; } csc = ScriptRegistry.getScriptContainerAs(csc.inherit, CustomScriptContainer.class); } return -1; }
public long runTagScript(String path, CustomObject obj, ScriptEntryData data) { CustomScriptContainer csc = this; while (csc != null) { if (csc.contains("tags." + path)) { dB.echoDebug(this, "[CustomObject] Calculating tag: " + path + " for " + csc.getName()); ScriptQueue queue = InstantQueue.getQueue( ScriptQueue.getNextId("TAG_" + csc.getName() + "_" + path + "__")); List<ScriptEntry> listOfEntries = csc.getEntries(data, "tags." + path); long id = DetermineCommand.getNewId(); ScriptBuilder.addObjectToEntries(listOfEntries, "ReqId", id); CustomScriptContextSource cscs = new CustomScriptContextSource(); cscs.obj = obj; queue.setContextSource(cscs); queue.addEntries(listOfEntries); queue.start(); return id; } dB.echoDebug(this, "[CustomObject] Grabbing parent of " + csc.getName()); csc = ScriptRegistry.getScriptContainerAs(csc.inherit, CustomScriptContainer.class); } dB.echoDebug(this, "Unable to find tag handler for " + path + " for " + this.getName()); return -1; }