diff --git a/NCPCore/src/main/java/fr/neatmonster/nocheatplus/checks/Check.java b/NCPCore/src/main/java/fr/neatmonster/nocheatplus/checks/Check.java index b430cd35..25cfe2d0 100644 --- a/NCPCore/src/main/java/fr/neatmonster/nocheatplus/checks/Check.java +++ b/NCPCore/src/main/java/fr/neatmonster/nocheatplus/checks/Check.java @@ -19,7 +19,41 @@ import fr.neatmonster.nocheatplus.utilities.CheckUtils; import fr.neatmonster.nocheatplus.utilities.TickTask; /** - * The parent class of all checks. Don't let this implement Listener without knowing that this might be registered as component with NCP before the check-listeners. + * The parent class of all checks. Don't let this implement Listener without + * knowing that this might be registered as component with NCP before the + * check-listeners. + *
+ * Note on enabling and bypassing:
+ *
  • The full Check.isEnabled test will check the config flag + * (config.isEnabled) and test Check.hasBypass (permissions, exemption).
  • + *
  • Currently the code for isEnabled and hasBypasss is in + * fr.neatmonster.nocheatplus.utilities.CheckUtils .
  • + *
  • Currently the hasBypass check will test for a permission if in the main + * thread, or test for a cached permission if off the main thread, then check + * for exemption with fr.neatmonster.nocheatplus.hooks.NCPExemptionManager, for + * the case that no bypass permission is present.
  • + *
  • For checks run off the primary thread, permissions are cached. Updates + * must be requested with the TickTask explicitly, e.g. in the listener. This + * depends on the definition of which checks might run asynchronously, as given + * in fr.neatmonster.nocheatplus.hooks.APIUtils and the default permissions + * defined in ICheckConfig implementations.
  • + *
  • At present exemption checking is only thread-safe for the checks that are + * set to run off main thread (APIUtils).
  • + *
    + * Note on performance: + *
  • You might check the configuration flag directly with a given + * configuration, which is equivalent to but supposedly faster than calling + * CheckType.isEnabled(player) or CheckConfig.isEnabled(player). Then call + * hasBypass extra to that.
  • + *
  • For very simple checks, you might skip checking hasBypass for the normal + * case, and check it lazily only in case of a violation.
  • + *
  • The method signatures that take ICheckData and ICheckConfig as extra + * arguments will perform better, they also allow to pass null for config and + * data (also see fr.neatmonster.nocheatplus.utilities.CheckUtils).
  • + *
  • In case simplicity of code is demanded, just check isEnabled(player) or + * for better performance isEnabled(player, data, config), before running the + * actual check.
  • + * */ public abstract class Check implements MCAccessHolder {