Skip to content

API reference Obsidian.API

IEventDispatcher interface

Registers and dispatches Minecraft event handlers.

public interface IEventDispatcher : IDisposable

In Obsidian.API.

Remarks

Handlers can run concurrently on different threads. Events raised during a level's tick run as part of that level's tick, while other levels may tick concurrently. Packet-driven events run on the connection's processing thread. Asynchronous continuations may resume on another thread; there is no fixed thread affinity. Handlers must make state shared across events thread-safe.

Methods

ExecuteEventAsync<TEventArgs>(TEventArgs)

ValueTask<EventResult> ExecuteEventAsync<TEventArgs>(TEventArgs eventArgs) where TEventArgs : BaseMinecraftEventArgs;

Runs the registered handlers in the calling context, awaiting each in priority order.

Remarks

Other dispatches may run concurrently; see IEventDispatcher.

RegisterEvents(IPluginContainer)

void RegisterEvents(IPluginContainer pluginContainer = null);

Registers attributed handlers from MinecraftEventHandler modules.

Remarks

Registered handlers follow the threading contract of IEventDispatcher.

On this page