mirror of
https://github.com/asofold/CompatNoCheatPlus.git
synced 2025-02-21 02:12:24 +01:00
javadocs updated
This commit is contained in:
parent
82bcac2029
commit
85ae6112d8
@ -1,7 +1,10 @@
|
||||
package me.asofold.bpl.cncp.hooks.ncp;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Type of checks and their groups (potentially parents).
|
||||
* @author mc_dev
|
||||
*
|
||||
*/
|
||||
public enum CheckType {
|
||||
|
||||
// GENERAL
|
||||
@ -32,7 +35,8 @@ public enum CheckType {
|
||||
BLOCKBREAK_FASTBREAK(BLOCKBREAK),
|
||||
BLOCKBREAK_NOSWING(BLOCKBREAK),
|
||||
BLOCKBREAK_DIRECTION(BLOCKBREAK),
|
||||
// ....
|
||||
|
||||
// TODO: add more ....
|
||||
|
||||
; // end of members.
|
||||
|
||||
|
@ -25,9 +25,9 @@ public interface NCPHook{
|
||||
|
||||
/**
|
||||
* This is called on failure of a check.<br>
|
||||
* This is the minimal interface, one should probably add specific information
|
||||
* like (target) locations and VL, but with this a lot is possible already (cncp).<br>
|
||||
* See AbstractNCPHook for future questions.
|
||||
* This is the minimal interface, it might later be extended by specific information
|
||||
* like (target) locations and VL, but with this a lot is possible already (see cncp).<br>
|
||||
* See AbstractNCPHook for future compatibility questions.
|
||||
* @param checkType the check that failed.
|
||||
* @param player The player that failed the check.
|
||||
* @return If to cancel the check failure processing.
|
||||
|
@ -40,7 +40,7 @@ public final class NCPHookManager {
|
||||
private final static Map<Integer, NCPHook> allHooks = new HashMap<Integer, NCPHook>();
|
||||
|
||||
/**
|
||||
* Mapping the check ids to the hooks.
|
||||
* Mapping the check types to the hooks.
|
||||
*/
|
||||
private static final Map<CheckType, List<NCPHook>> hooksByChecks = new HashMap<CheckType, List<NCPHook>>();
|
||||
|
||||
@ -74,7 +74,7 @@ public final class NCPHookManager {
|
||||
}
|
||||
|
||||
/**
|
||||
* Add hook to the hooksByChecks mappings, for the check id and if different group id.
|
||||
* Add hook to the hooksByChecks mappings, for the check type and if present, group type.
|
||||
* assumes that the hook already has been registered in the allHooks map.
|
||||
* @param checkType
|
||||
* @param hook
|
||||
@ -206,7 +206,7 @@ public final class NCPHookManager {
|
||||
/* External API for adding hooks etc. */
|
||||
|
||||
/**
|
||||
* Register a hook for a specific check id (all, group, or an individual check).
|
||||
* Register a hook for a specific check type (all, group, or an individual check).
|
||||
* @param checkType
|
||||
* @param hook
|
||||
* @return An id to identify the hook, will return the existing id if the hook was already present somewhere.
|
||||
@ -220,15 +220,15 @@ public final class NCPHookManager {
|
||||
|
||||
/**
|
||||
* Register a hook for several individual checks ids (all, group, or an individual checks).
|
||||
* @param checkIds Array of ids to register the hook for. If you pass null this hok will be registered for all checks.
|
||||
* @param checkTypes Array of check types to register the hook for. If you pass null this hook will be registered for all checks.
|
||||
* @param hook
|
||||
* @return
|
||||
*/
|
||||
public static Integer addHook(CheckType[] checkIds, NCPHook hook){
|
||||
if (checkIds == null) checkIds = new CheckType[]{CheckType.ALL};
|
||||
public static Integer addHook(CheckType[] checkTypes, NCPHook hook){
|
||||
if (checkTypes == null) checkTypes = new CheckType[]{CheckType.ALL};
|
||||
Integer hookId = getId(hook);
|
||||
for (CheckType checkId : checkIds){
|
||||
addToMappings(checkId, hook);
|
||||
for (CheckType checkType : checkTypes){
|
||||
addToMappings(checkType, hook);
|
||||
}
|
||||
logHookAdded(hook);
|
||||
return hookId;
|
||||
|
Loading…
Reference in New Issue
Block a user