コード例 #1
0
ファイル: Check.java プロジェクト: jswilk/NoCheatPlus
  /**
   * Execute some actions for the specified player.
   *
   * @param violationData the violation data
   * @param isMainThread If this is called from within the main thread. If true, this must really be
   *     the main thread and not from synchronized code coming form another thread.
   * @return true, if the event should be cancelled
   */
  protected boolean executeActions(final ViolationData violationData, final boolean isMainThread) {

    // Dispatch the VL processing to the hook manager (now thread safe).
    if (NCPHookManager.shouldCancelVLProcessing(violationData))
      // One of the hooks has decided to cancel the VL processing, return false.
      return false;

    // Add this failed check to the Metrics data (async!).
    MetricsData.addFailed(violationData.check.type);

    final boolean hasCancel = violationData.hasCancel();

    if (isMainThread) return violationData.executeActions();
    else
      // Always schedule to add to ViolationHistory.
      TickTask.requestActionsExecution(violationData);

    // (Design change: Permission checks are moved to cached permissions, lazily updated.)
    return hasCancel;
  }