Skip to content

McPluginAttribute

Namespace Mc.Scripting · Kind class (sealed)

public sealed class McPluginAttribute : Attribute

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"])]. It carries the same information as plugin.json (a plugin.json next to the sources takes precedence). The server reads it from the syntax of the file before compiling, to compute the load order, so every argument must be a literal: string literals, null, and arrays or collection expressions of string literals (no constants, no nameof, no interpolation).

The attribute is ignored on a compiled plugin (it has a plugin.json or PluginInfoAttribute).

Member Description
Constructor Declares the plugin.
public McPluginAttribute(string id, string? version = null, string? name = null, string[]? depends = null, string[]? softDepends = null, string[]? loadBefore = null, string? description = null, string[]? authors = null, string? website = null, string? api = null, string? main = null)

Declares the plugin.

Parameters

Name Type Description
id string The unique id: 1-32 characters from a-z 0-9 - _. It is also the name of the data folder plugins/<id>/.
version string? = null The plugin version (default 0.0.0).
name string? = null The display name, used as the log prefix (default: the id).
depends string[]? = null Plugins that must be loaded first, optionally with a version constraint ("economy >=1.2"). Their types become available to the sources.
softDepends string[]? = null Plugins loaded first when present (their types are available to the sources, but the plugin must cope with their absence).
loadBefore string[]? = null Plugins that should be loaded after this one.
description string? = null A one-line description.
authors string[]? = null The author names.
website string? = null A website or repository url.
api string? = null The plugin API version the plugin was written for ("1.0").
main string? = null The full name of the plugin class when the sources contain several candidates.
Member Description
string? Api { get; } The API version.
string[]? Authors { get; } The authors.
string[]? Depends { get; } The hard dependencies.
string? Description { get; } The description.
string Id { get; } The plugin id.
string[]? LoadBefore { get; } The plugins that load after this one.
string? Main { get; } The plugin class.
string? Name { get; } The display name.
string[]? SoftDepends { get; } The soft dependencies.
string? Version { get; } The plugin version.
string? Website { get; } The website.
public string? Api { get; }

The API version.

public string[]? Authors { get; }

The authors.

public string[]? Depends { get; }

The hard dependencies.

public string? Description { get; }

The description.

public string Id { get; }

The plugin id.

public string[]? LoadBefore { get; }

The plugins that load after this one.

public string? Main { get; }

The plugin class.

public string? Name { get; }

The display name.

public string[]? SoftDepends { get; }

The soft dependencies.

public string? Version { get; }

The plugin version.

public string? Website { get; }

The website.