From 3caa3cd96f7b25f147afa323fe430585db103d10 Mon Sep 17 00:00:00 2001 From: asofold Date: Tue, 7 Aug 2012 18:45:15 +0200 Subject: [PATCH] add API for all hooks (remove, get). --- .../bpl/cncp/hooks/ncp/NCPHookManager.java | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) 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 e98863e..6c3308d 100644 --- a/CompatNoCheatPlus/src/me/asofold/bpl/cncp/hooks/ncp/NCPHookManager.java +++ b/CompatNoCheatPlus/src/me/asofold/bpl/cncp/hooks/ncp/NCPHookManager.java @@ -2,6 +2,7 @@ package me.asofold.bpl.cncp.hooks.ncp; import java.util.ArrayList; +import java.util.Collection; import java.util.HashMap; import java.util.LinkedList; import java.util.List; @@ -331,6 +332,14 @@ public final class NCPHookManager { return hook; } + public static Collection removeAllHooks(){ + Collection hooks = getAllHooks(); + for (NCPHook hook : hooks){ + removeHook(hook); + } + return hooks; + } + /** * Get the hook by the hook name. * @param hookName case sensitive (exact match). @@ -344,4 +353,14 @@ public final class NCPHookManager { return null; } + /** + * Get a collection of all hooks. + * @return + */ + public static Collection getAllHooks(){ + List hooks = new LinkedList(); + hooks.addAll(allHooks.values()); + return hooks; + } + }