Interface HookAPI


public interface HookAPI
Aggregates a collection of APIs that are used to maintain a list for features that MBedwars makes use of.
  • Method Details

    • getHooks

      Collection<Hook> getHooks()
      Gets all hooks that currently are active.
      Returns:
      All active hooks
    • getHooksByHooked

      Collection<Hook> getHooksByHooked(Plugin plugin)
      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

      Collection<Hook> getHooksByManaging(Plugin plugin)
      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

      Collection<? extends Hook> tryAutoHook(Plugin plugin)
      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

      boolean unregisterHook(Hook hook)
      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

      boolean registerPartiesHook(PartiesHook hook)
      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. Otherwise true
      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

      boolean registerNicknamingHook(NicknamingHook hook)
      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. Otherwise true
      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

      boolean registerCloudSystemHook(CloudSystemHook hook)
      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. Otherwise true
      Throws:
      IllegalStateException - In case the class is incorrectly being handled
    • get

      static HookAPI get()
      Returns the global HookAPI instance.
      Returns:
      The global HookAPI instance