Advertisement
Guest User

Speed

a guest
Nov 17th, 2017
103
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 2.34 KB | None | 0 0
  1. public abstract class Check implements IDebugPlayer
  2. {
  3.   protected static Map<String, ExecutionHistory> histories = new HashMap();
  4.   protected final CheckType type;
  5.   protected final IGenericInstanceHandle<MCAccess> mcAccess;
  6.  
  7.   protected static ExecutionHistory getHistory(Player player)
  8.   {
  9.     if (!histories.containsKey(player.getName())) {
  10.       histories.put(player.getName(), new ExecutionHistory());
  11.     }
  12.     return (ExecutionHistory)histories.get(player.getName());
  13.   }
  14.  
  15.   public Check(CheckType type)
  16.   {
  17.     this.type = type;
  18.     this.mcAccess = NCPAPIProvider.getNoCheatPlusAPI().getGenericInstanceHandle(MCAccess.class);
  19.     ViolationHistory.checkTypeMap.put(getClass().getName(), type);
  20.     DataManager.registerExecutionHistory(type, histories);
  21.   }
  22.  
  23.   public ViolationData executeActions(Player player, double vL, double addedVL, ActionList actions, IPenaltyList penaltyList)
  24.   {
  25.     return executeActions(new ViolationData(this, player, vL, addedVL, actions, penaltyList));
  26.   }
  27.  
  28.   public ViolationData executeActions(Player player, double vL, double addedVL, ActionList actions)
  29.   {
  30.     return executeActions(new ViolationData(this, player, vL, addedVL, actions));
  31.   }
  32.  
  33.   public ViolationData executeActions(ViolationData violationData)
  34.   {
  35.     if (NCPHookManager.shouldCancelVLProcessing(violationData)) {
  36.       violationData.preventCancel();
  37.     } else if (Bukkit.isPrimaryThread()) {
  38.       violationData.executeActions();
  39.     } else {
  40.       TickTask.requestActionsExecution(violationData);
  41.     }
  42.     return violationData;
  43.   }
  44.  
  45.   public CheckType getType()
  46.   {
  47.     return this.type;
  48.   }
  49.  
  50.   public boolean isEnabled(Player player, ICheckData data, ICheckConfig cc)
  51.   {
  52.     return (cc.isEnabled(this.type)) && (!CheckUtils.hasBypass(this.type, player, data));
  53.   }
  54.  
  55.   public boolean isEnabled(Player player, ICheckConfig cc)
  56.   {
  57.     return (cc.isEnabled(this.type)) && (!CheckUtils.hasBypass(this.type, player, null));
  58.   }
  59.  
  60.   public boolean isEnabled(Player player)
  61.   {
  62.     return (this.type.isEnabled(player)) && (!CheckUtils.hasBypass(this.type, player, null));
  63.   }
  64.  
  65.   public boolean hasBypass(Player player)
  66.   {
  67.     return CheckUtils.hasBypass(this.type, player, null);
  68.   }
  69.  
  70.   public void debug(Player player, String message)
  71.   {
  72.     CheckUtils.debug(player, this.type, message);
  73.   }
  74. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement