mirror of
https://github.com/asofold/CompatNoCheatPlus.git
synced 2024-11-18 11:16:23 +01:00
use method for calculating the group id.
This commit is contained in:
parent
5644f7b01f
commit
2e3d93f4d2
@ -96,6 +96,15 @@ public final class NCPHookManager {
|
||||
return id;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the Id of the group for a given check id. (If the given id is a group id it will return the same value but a different object).
|
||||
* @param checkId
|
||||
* @return
|
||||
*/
|
||||
private final static Integer getGroupId(final Integer checkId){
|
||||
return (checkId.intValue() / 1000) * 1000;
|
||||
}
|
||||
|
||||
/**
|
||||
* Add hook to the hooksByChecks mappings, for the check id and if different group id.
|
||||
* assumes that the hook already has been registered in the allHooks map.
|
||||
@ -103,7 +112,7 @@ public final class NCPHookManager {
|
||||
* @param hook
|
||||
*/
|
||||
private static void addToMappings(Integer checkId, NCPHook hook) {
|
||||
Integer groupId = (checkId.intValue() / 1000) * 1000; // NOTE: group id calculation
|
||||
Integer groupId = getGroupId(checkId);
|
||||
addToMapping(checkId, hook);
|
||||
if (checkId.intValue() != groupId.intValue()) addToMapping(groupId, hook);
|
||||
}
|
||||
@ -201,7 +210,7 @@ public final class NCPHookManager {
|
||||
|
||||
// checks for hooks registered for all events, only for the group and specifically for the check.
|
||||
// A Paradigm could be to return true as soon as one hook has returned true.
|
||||
final Integer groupId = (checkId.intValue() / 1000) * 1000; // NOTE: group id calculation
|
||||
final Integer groupId = getGroupId(checkId);
|
||||
|
||||
// Most specific:
|
||||
final List<NCPHook> hooksCheck = hooksByChecks.get(checkId);
|
||||
|
Loading…
Reference in New Issue
Block a user