Skip to content

Plugins and lifecycle

Entry points, metadata, API versions, the per-plugin context and everything that is released on unload.

Type Kind Description
ApiVersion struct The version of the plugin API (semantic: a minor increase is additive, a major increase is breaking).
IPlugin interface Plugin entry point.
IPluginResource interface Something owned by a plugin that must be released when it unloads.
McPluginAttribute class The manifest of a source plugin (a .cs file or folder the server compiles at startup), written as an assembly attribute at the top of one of its files: [assembly: McPlugin("homes", version: "1.2.0", depends: ["economy >=1.0"])].
Plugin class Convenience base class exposing the plugin’s scoped services.
PluginContext class Per-plugin services.
PluginDependency struct A dependency declaration of a plugin: the id of the other plugin and an optional version constraint.
PluginInfoAttribute class Optional metadata for a plugin type.
PluginMessageHandler delegate Receives a message a client sent on a channel the plugin listens on.
PluginMetadata class What a plugin declares about itself: from plugin.json, or from PluginInfoAttribute when there is no manifest.
Plugins class Read-only view of the loaded plugins: for admin tools (a /plugins command), for plugins that adapt to an optional other plugin, and for diagnosing why a plugin did not load.
VersionConstraint class Compares dotted versions against constraints (>=, >, =, <, <=, ^ = same major and at least).