PluginContext
Namespace Mc.Scripting · Kind class (sealed)
public sealed class PluginContextPer-plugin services. Everything registered through it is released automatically when the plugin unloads or hot-reloads.
Remarks
Section titled “Remarks”Plugins normally use the same members through the Plugin base class properties (Events, Commands, …). Use the context directly when your code lives outside the plugin class: pass it to helper classes so everything they register is released with the plugin.
Properties
Section titled “Properties”AssemblyPath
Section titled “AssemblyPath”public string AssemblyPath { get; }Path of the plugin assembly.
BossBars
Section titled “BossBars”public BossBars BossBars { get; }Boss bars.
Channels
Section titled “Channels”public ChannelRegistry Channels { get; }Plugin messaging channels of this plugin (ChannelRegistry).
ChunkTickets
Section titled “ChunkTickets”public ChunkTickets ChunkTickets { get; }Chunk tickets.
Commands
Section titled “Commands”public CommandRegistry Commands { get; }Commands.
Config
Section titled “Config”public PluginConfig Config { get; }Configuration files and the data folder.
public Ecs Ecs { get; }ECS access.
Events
Section titled “Events”public EventRegistry Events { get; }Event subscriptions.
Holograms
Section titled “Holograms”public Holograms Holograms { get; }Holograms (text displays).
public int Id { get; }Stable plugin id (kept across hot reloads).
public PluginMetadata Info { get; }What the plugin declares about itself (plugin.json or PluginInfoAttribute).
IsUnloaded
Section titled “IsUnloaded”public bool IsUnloaded { get; }Whether the plugin was unloaded.
public Logger Log { get; }The plugin’s logger.
public Menus Menus { get; }Custom GUIs (menus) owned by this plugin.
public string Name { get; }The plugin name.
public Npcs Npcs { get; }NPCs (fake players).
Permissions
Section titled “Permissions”public PluginPermissions Permissions { get; }Permissions.
Scheduler
Section titled “Scheduler”public Scheduler Scheduler { get; }Scheduler.
Services
Section titled “Services”public ServiceManager Services { get; }Plugin-to-plugin services.
Sidebars
Section titled “Sidebars”public Sidebars Sidebars { get; }Sidebars.
Systems
Section titled “Systems”public SystemRegistry Systems { get; }Systems.
Version
Section titled “Version”public string Version { get; }The plugin version.
Methods
Section titled “Methods”| Member | Description |
|---|---|
void Track(IPluginResource resource) |
Registers an arbitrary resource to be disposed on unload. |
public void Track(IPluginResource resource)Registers an arbitrary resource to be disposed on unload.
Parameters
| Name | Type | Description |
|---|---|---|
resource |
IPluginResource |
See also
Section titled “See also”BossBars · ChannelRegistry · ChunkTickets · CommandRegistry · Ecs · EventRegistry · Holograms · IPluginResource · Log · Logger · Menus · Npcs · PluginConfig · PluginMetadata · PluginPermissions · Scheduler · ServiceManager · Sidebars · SystemRegistry