コード例 #1
0
ファイル: ActionHandler.java プロジェクト: sk0rms/Denizen
  public boolean doAction(
      String actionName,
      dNPC npc,
      dPlayer player,
      AssignmentScriptContainer assignment,
      Map<String, dObject> context) {
    if (assignment == null) {
      // dB.echoDebug("Tried to do 'on " + actionName + ":' but couldn't find a matching script.");
      return false;
    }

    if (!assignment.contains("actions.on " + actionName)) return false;

    dB.report(
        "Action",
        aH.debugObj("Type", "On " + actionName)
            + aH.debugObj("NPC", npc.toString())
            + assignment.getAsScriptArg().debug()
            + (player != null ? aH.debugObj("Player", player.getName()) : ""));

    // Fetch script from Actions
    List<ScriptEntry> script = assignment.getEntries(player, npc, "actions.on " + actionName);
    if (script.isEmpty()) return false;

    dB.echoDebug(
        DebugElement.Header,
        "Building action 'On " + actionName.toUpperCase() + "' for " + npc.toString());

    // Add entries and context to the queue
    ScriptQueue queue = InstantQueue.getQueue(null).addEntries(script);

    if (context != null) {
      for (Map.Entry<String, dObject> entry : context.entrySet()) {
        queue.addContext(entry.getKey(), entry.getValue());
      }
    }

    // Start the queue!
    queue.start();

    // TODO: Read determination to see if the event behind action should be cancelled.

    return false;
  }
コード例 #2
0
 public PVPStatsPlayerExtension(dPlayer player) {
   this.playerName = player.getName();
 }