GameServer.Hooks.PluginManager (GameServer v1.0.509)

Loads and manages hook plugins shipped as OTP applications under modules/plugins/*.

Each plugin is expected to be a directory named after the OTP app name (e.g. polyglot_hook) containing:

modules/plugins/polyglot_hook/
  ebin/polyglot_hook.app
  ebin/Elixir.GameServer.Modules.PolyglotHook.beam
  deps/*/ebin/*.beam

The plugin's .app env must include the key :hooks_module, whose value is either a charlist or string module name like 'Elixir.GameServer.Modules.PolyglotHook'.

This manager is intentionally dependency-free: it only adds ebin directories to the code path and uses Application.load/1 + Application.ensure_all_started/1.

Summary

Types

plugin_app()

@type plugin_app() :: atom()

plugin_name()

@type plugin_name() :: String.t()

Functions

call_rpc(plugin, fn_name, args, opts \\ [])

@spec call_rpc(plugin_name(), String.t(), list(), keyword()) ::
  {:ok, any()} | {:error, term()}

child_spec(init_arg)

Returns a specification to start this module under a supervisor.

See Supervisor.

hook_modules()

@spec hook_modules() :: [{plugin_name(), module()}]

list()

lookup(name)

@spec lookup(plugin_name()) ::
  {:ok, GameServer.Hooks.PluginManager.Plugin.t()} | {:error, term()}

plugins_dir()

@spec plugins_dir() :: String.t()

reload()

reload_and_after_startup()

@spec reload_and_after_startup() :: %{
  plugins: [GameServer.Hooks.PluginManager.Plugin.t()],
  after_startup: map()
}

start_link(opts \\ [])

@spec start_link(keyword()) :: GenServer.on_start()