Interface HookAPI
-
Method Summary
Modifier and TypeMethodDescriptionstatic HookAPI
get()
Returns the global HookAPI instance.String[]
Returns the names of all plugin with which we can create a hook.Get all currently registered cloud system hooks.getHooks()
Gets all hooks that currently are active.getHooksByHooked
(Plugin plugin) Get all hooks that hook into the given plugin.getHooksByManaging
(Plugin plugin) Get all hooks that are being managed by the given plugin.Get all currently registered nicknaming hooks.Get all currently registered parties hooks.boolean
Manually register a new cloud system hook.boolean
Manually register a new nicknaming hook.boolean
Manually register a new parties hook.Collection
<? extends Hook> tryAutoHook
(Plugin plugin) Tries to let MBedwars automatically initiate a hook with a plugin.boolean
unregisterHook
(Hook hook) Removes a hook.
-
Method Details
-
getHooks
Collection<Hook> getHooks()Gets all hooks that currently are active.- Returns:
- All active hooks
-
getHooksByHooked
Get all hooks that hook into the given plugin.- Parameters:
plugin
- The plugin into which a hook is hooking into- Returns:
- A collection of all hooks into that plugin. Empty if there are none
-
getHooksByManaging
Get all hooks that are being managed by the given plugin.- Parameters:
plugin
- The plugin that created the hooks- Returns:
- A collection of hooks that are being managed. Empty if there are none
-
getAutoPluginNames
String[] getAutoPluginNames()Returns the names of all plugin with which we can create a hook.Includes names of plugins that aren't installed on the server.
- Returns:
- Names of all plugins that we can hook into
- See Also:
-
tryAutoHook
Tries to let MBedwars automatically initiate a hook with a plugin.Reasons for failure:
- Plugin is already hooked
-PluginHookEvent
got cancelled
- Plugin is not supported (not hookable, version/version not supported)
- An error occured while we tried to hook into it
- It may only be hooked into after all arenas have been loaded
- Plugin is not enabled- Parameters:
plugin
- The plugin with a hook shall be created- Returns:
- A list of the hooks that we created. May be empty if there are none
- See Also:
-
unregisterHook
Removes a hook.- Parameters:
hook
- The hook that shall be removed- Returns:
true
when we succeded
-
getPartiesHooks
PartiesHook[] getPartiesHooks()Get all currently registered parties hooks.This also includes the ones that MBedwars registers (e.g. Parties, Parties and Friends ...)
- Returns:
- All the currently registered parties hooks
-
registerPartiesHook
Manually register a new parties hook.You may use
unregisterHook(Hook)
to remove the hook again.- Parameters:
hook
- The hook that shall be registered- Returns:
false
if it is already registered. Otherwisetrue
- Throws:
IllegalStateException
- In case the class is incorrectly being handled
-
getNicknamingHooks
NicknamingHook[] getNicknamingHooks()Get all currently registered nicknaming hooks.This also includes the ones that MBedwars registers (e.g. Nicknamer, NameTagEdit, CMI ...)
- Returns:
- All the currently registered nicknaming hooks
-
registerNicknamingHook
Manually register a new nicknaming hook.You may use
unregisterHook(Hook)
to remove the hook again.- Parameters:
hook
- The hook that shall be registered- Returns:
false
if it is already registered. Otherwisetrue
- Throws:
IllegalStateException
- In case the class is incorrectly being handled
-
getCloudSystemHooks
CloudSystemHook[] getCloudSystemHooks()Get all currently registered cloud system hooks.This also includes the ones that MBedwars registers (e.g. CloudNet, CaveCloud ...)
- Returns:
- All the currently registered cloud system hooks
-
registerCloudSystemHook
Manually register a new cloud system hook.You may use
unregisterHook(Hook)
to remove the hook again.- Parameters:
hook
- The hook that shall be registered- Returns:
false
if it is already registered. Otherwisetrue
- Throws:
IllegalStateException
- In case the class is incorrectly being handled
-
get
Returns the global HookAPI instance.- Returns:
- The global HookAPI instance
-