Skip to content

API reference Obsidian.API.Plugins

PluginBase class

Provides the base class for a plugin.

public abstract class PluginBase : IDisposable, IAsyncDisposable

In Obsidian.API.

Constructors

protected PluginBase();

Properties

public IPluginContainer Container { get; }public IPluginInfo Info { get; }

Methods

ConfigureRegistry(IPluginRegistry)

public virtual void ConfigureRegistry(IPluginRegistry pluginRegistry);

Used for registering commands, events, blocks, items and entities.

Remarks

Services from the Server will be injected when this method is called. e.x (ILogger, IServerConfiguration). Services registered through this method will be availiable/injected when PluginBase.OnServerReadyAsync is called.

ConfigureServices(IServiceCollection)

public virtual void ConfigureServices(IServiceCollection services);

Used for registering services.

Remarks

Only services from the Server will be injected when this method is called. e.x (ILogger, IServerConfiguration). Services registered through this method will be availiable/injected when PluginBase.OnServerReadyAsync is called.

public virtual void Dispose();public virtual ValueTask DisposeAsync();public sealed override bool Equals(object obj);public sealed override int GetHashCode();

OnLoadedAsync(IServer)

public virtual ValueTask OnLoadedAsync(IServer server);

Called when the plugin has fully loaded.

OnServerReadyAsync(IServer)

public virtual ValueTask OnServerReadyAsync(IServer server);

Called when the world has loaded and the server is joinable.

OnUnloadingAsync()

public virtual ValueTask OnUnloadingAsync();

Called when the plugin is being unloaded.

public sealed override string ToString();

On this page