mirror of
https://github.com/asofold/CompatNoCheatPlus.git
synced 2025-01-24 21:51:19 +01:00
hooksByName it shoudlbne for names arent unique.
This commit is contained in:
parent
ab670c3a75
commit
23442aef66
@ -272,11 +272,11 @@ public final class NCPHookManager {
|
|||||||
* @param hookName
|
* @param hookName
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public static NCPHook removeHook(String hookName){
|
public static Collection<NCPHook> removeHook(String hookName){
|
||||||
NCPHook hook = getHookByName(hookName);
|
Collection<NCPHook> hooks = getHooksByName(hookName);
|
||||||
if (hook == null) return null;
|
if (hooks.isEmpty()) return null;
|
||||||
removeHook(hook);
|
removeHooks(hooks);
|
||||||
return hook;
|
return hooks;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -306,12 +306,13 @@ public final class NCPHookManager {
|
|||||||
* @param hookName case sensitive (exact match).
|
* @param hookName case sensitive (exact match).
|
||||||
* @return NCPHook if found, null otherwise.
|
* @return NCPHook if found, null otherwise.
|
||||||
*/
|
*/
|
||||||
public static NCPHook getHookByName(String hookName){
|
public static Collection<NCPHook> getHooksByName(String hookName){
|
||||||
|
List<NCPHook> hooks = new LinkedList<NCPHook>();
|
||||||
for (Integer refId : allHooks.keySet()){
|
for (Integer refId : allHooks.keySet()){
|
||||||
NCPHook hook = allHooks.get(refId);
|
NCPHook hook = allHooks.get(refId);
|
||||||
if (hook.getHookName().equals(hookName)) return hook;
|
if (hook.getHookName().equals(hookName) && !hooks.contains(hook)) hooks.add(hook);
|
||||||
}
|
}
|
||||||
return null;
|
return hooks;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
Reference in New Issue
Block a user