diff --git a/CompatNoCheatPlus/src/me/asofold/bpl/cncp/hooks/ncp/NCPHookManager.java b/CompatNoCheatPlus/src/me/asofold/bpl/cncp/hooks/ncp/NCPHookManager.java index 0092268..be1756f 100644 --- a/CompatNoCheatPlus/src/me/asofold/bpl/cncp/hooks/ncp/NCPHookManager.java +++ b/CompatNoCheatPlus/src/me/asofold/bpl/cncp/hooks/ncp/NCPHookManager.java @@ -272,11 +272,11 @@ public final class NCPHookManager { * @param hookName * @return */ - public static NCPHook removeHook(String hookName){ - NCPHook hook = getHookByName(hookName); - if (hook == null) return null; - removeHook(hook); - return hook; + public static Collection removeHook(String hookName){ + Collection hooks = getHooksByName(hookName); + if (hooks.isEmpty()) return null; + removeHooks(hooks); + return hooks; } /** @@ -306,12 +306,13 @@ public final class NCPHookManager { * @param hookName case sensitive (exact match). * @return NCPHook if found, null otherwise. */ - public static NCPHook getHookByName(String hookName){ + public static Collection getHooksByName(String hookName){ + List hooks = new LinkedList(); for (Integer refId : allHooks.keySet()){ 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; } /**