コード例 #1
0
 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;
 }
コード例 #2
0
 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;
 }