Skip to main content

Overview

IDalamudPluginInterface acts as the primary interface for plugins to interact with Dalamud and the game. It provides access to various services, configuration management, IPC, dependency injection, and UI building capabilities.

Interface Definition

public interface IDalamudPluginInterface : IServiceProvider
{
    // Events, properties, and methods
}

Events

LanguageChanged
event LanguageChangedDelegate
Fired when the game’s localization language is changed.
event LanguageChangedDelegate LanguageChanged;
Delegate signature:
public delegate void LanguageChangedDelegate(string langCode);
  • langCode - The new two-letter ISO language code
ActivePluginsChanged
event ActivePluginsChangedDelegate
Fired when the active list of plugins changes (loaded, unloaded, updated).
event ActivePluginsChangedDelegate ActivePluginsChanged;
Delegate signature:
public delegate void ActivePluginsChangedDelegate(IActivePluginsChangedEventArgs args);
  • args - Event arguments containing information about the change

Properties

Plugin Information

Reason
PluginLoadReason
Gets the reason this plugin was loaded.
PluginLoadReason Reason { get; }
InternalName
string
Gets the current internal plugin name.
string InternalName { get; }
Manifest
IPluginManifest
Gets the plugin’s manifest containing metadata.
IPluginManifest Manifest { get; }
SourceRepository
string
Gets the repository from which this plugin was installed.If installed from the official/main repository, returns SpecialPluginSource.MainRepo. Developer plugins return SpecialPluginSource.DevPlugin.
string SourceRepository { get; }
IsDev
bool
Gets whether this is a development plugin.
bool IsDev { get; }
IsTesting
bool
Gets whether this is a testing release of a plugin.Dev plugins have undefined behavior for this value, but can be expected to return false.
bool IsTesting { get; }

Timing

LoadTime
DateTime
Gets the local time that this plugin was loaded.
DateTime LoadTime { get; }
LoadTimeUTC
DateTime
Gets the UTC time that this plugin was loaded.
DateTime LoadTimeUTC { get; }
LoadTimeDelta
TimeSpan
Gets the timespan delta from when this plugin was loaded.
TimeSpan LoadTimeDelta { get; }

Directories and Files

DalamudAssetDirectory
DirectoryInfo
Gets the directory where Dalamud assets are stored.
DirectoryInfo DalamudAssetDirectory { get; }
AssemblyLocation
FileInfo
Gets the location of your plugin assembly.
FileInfo AssemblyLocation { get; }
ConfigDirectory
DirectoryInfo
Gets the directory where your plugin configurations are stored.
DirectoryInfo ConfigDirectory { get; }
ConfigFile
FileInfo
Gets the config file of your plugin.
FileInfo ConfigFile { get; }

UI and Development

UiBuilder
IUiBuilder
Gets the UiBuilder instance which allows you to draw UI into the game via ImGui.
IUiBuilder UiBuilder { get; }
IsDevMenuOpen
bool
Gets whether Dalamud is running in Debug mode or the /xldev menu is open. This can occur on release builds.
bool IsDevMenuOpen { get; }
IsDebugging
bool
Gets whether a debugger is attached.
bool IsDebugging { get; }

Localization and Chat

UiLanguage
string
Gets the current UI language in two-letter ISO format.
string UiLanguage { get; }
Sanitizer
ISanitizer
Gets the serializer class with functions to remove special characters from strings.
ISanitizer Sanitizer { get; }
GeneralChatType
XivChatType
Gets the chat type used by default for plugin messages.
XivChatType GeneralChatType { get; }

Plugin Management

IsAutoUpdateComplete
bool
Gets whether auto-updates have already completed this session.
bool IsAutoUpdateComplete { get; }
InstalledPlugins
IEnumerable<IExposedPlugin>
Gets a list of installed plugins along with their current state.
IEnumerable<IExposedPlugin> InstalledPlugins { get; }

Methods

UI Management

OpenPluginInstallerTo
bool
Opens the Plugin Installer window with optional search term.
bool OpenPluginInstallerTo(
    PluginInstallerOpenKind openTo = PluginInstallerOpenKind.AllPlugins,
    string? searchText = null
)
openTo
PluginInstallerOpenKind
default:"AllPlugins"
The page to open the installer to
searchText
string?
default:"null"
Optional search text to input in the search box
Returns: false if the DalamudInterface was null, true otherwise
OpenDalamudSettingsTo
bool
Opens the Settings window with optional search term.
bool OpenDalamudSettingsTo(
    SettingsOpenKind openTo = SettingsOpenKind.General,
    string? searchText = null
)
openTo
SettingsOpenKind
default:"General"
The tab to open the settings to
searchText
string?
default:"null"
Optional search text to input in the search box
Returns: false if the DalamudInterface was null, true otherwise
OpenDeveloperMenu
bool
Opens the dev menu bar.
bool OpenDeveloperMenu()
Returns: false if the DalamudInterface was null, true otherwise

Plugin Information

GetPlugin
IExposedPlugin?
Gets the plugin that the given assembly or context is part of.
IExposedPlugin? GetPlugin(Assembly assembly)
IExposedPlugin? GetPlugin(AssemblyLoadContext context)
assembly
Assembly
The assembly to check
context
AssemblyLoadContext
The context to check
Returns: The plugin the assembly/context belongs to, or null if it’s a shared assembly or the information cannot be determined
GetDalamudVersion
IDalamudVersionInfo
Gets information about the version of Dalamud this plugin is loaded into.
IDalamudVersionInfo GetDalamudVersion()
Returns: Class containing version information

Configuration Management

SavePluginConfig
void
Saves a plugin configuration (inheriting IPluginConfiguration).
void SavePluginConfig(IPluginConfiguration? currentConfig)
currentConfig
IPluginConfiguration?
The current configuration to save
GetPluginConfig
IPluginConfiguration?
Gets a previously saved plugin configuration.
IPluginConfiguration? GetPluginConfig()
Returns: A previously saved config or null if none was saved before
GetPluginConfigDirectory
string
Gets the config directory path.
string GetPluginConfigDirectory()
Returns: Directory path: AppData/XIVLauncher/pluginConfig/PluginInternalName
GetPluginLocDirectory
string
Gets the localization directory path.
string GetPluginLocDirectory()
Returns: Directory path: AppData/XIVLauncher/pluginConfig/PluginInternalName/loc

Data Sharing

GetOrCreateData
T
Gets or creates shared data with the specified tag.
T GetOrCreateData<T>(string tag, Func<T> dataGenerator) where T : class
tag
string
The unique identifier for the shared data
dataGenerator
Func<T>
Function to generate the data if it doesn’t exist
Returns: The shared data instance
TryGetData
bool
Attempts to get shared data with the specified tag.
bool TryGetData<T>(string tag, [NotNullWhen(true)] out T? data) where T : class
tag
string
The unique identifier for the shared data
data
T?
Output parameter for the retrieved data
Returns: true if data was found, false otherwise
GetData
T?
Gets shared data with the specified tag.
T? GetData<T>(string tag) where T : class
tag
string
The unique identifier for the shared data
Returns: The shared data instance or null if not found
RelinquishData
void
Removes shared data with the specified tag.
void RelinquishData(string tag)
tag
string
The unique identifier for the shared data to remove

IPC (Inter-Plugin Communication)

GetIpcProvider
ICallGateProvider<...>
Gets an IPC provider for publishing functionality to other plugins.
ICallGateProvider<TRet> GetIpcProvider<TRet>(string name)
ICallGateProvider<T1, TRet> GetIpcProvider<T1, TRet>(string name)
ICallGateProvider<T1, T2, TRet> GetIpcProvider<T1, T2, TRet>(string name)
// ... up to 8 type parameters
name
string
The name of the IPC registration
Type Parameters:
  • T1-T8 - Parameter types for the IPC call
  • TRet - Return type (use object if unused)
Returns: An IPC provider instanceThrows: IpcTypeMismatchError when requested types don’t match previously registered types
GetIpcSubscriber
ICallGateSubscriber<...>
Gets an IPC subscriber for consuming functionality from other plugins.
ICallGateSubscriber<TRet> GetIpcSubscriber<TRet>(string name)
ICallGateSubscriber<T1, TRet> GetIpcSubscriber<T1, TRet>(string name)
ICallGateSubscriber<T1, T2, TRet> GetIpcSubscriber<T1, T2, TRet>(string name)
// ... up to 8 type parameters
name
string
The name of the IPC registration
Type Parameters:
  • T1-T8 - Parameter types for the IPC call
  • TRet - Return type (use object if unused)
Returns: An IPC subscriber instance

Dependency Injection

Create
T?
Creates a new object with dependency injection.
T? Create<T>(params object[] scopedObjects) where T : class
scopedObjects
object[]
Additional objects to inject
Returns: The created and initialized instance, or null on failure
CreateAsync
Task<T>
Asynchronously creates a new object with dependency injection.
Task<T> CreateAsync<T>(params object[] scopedObjects) where T : class
scopedObjects
object[]
Additional objects to inject
Returns: A task representing the created and initialized instance
Inject
bool
Injects services into properties on an existing object instance.
bool Inject(object instance, params object[] scopedObjects)
instance
object
The instance to inject services into
scopedObjects
object[]
Additional objects to inject
Returns: Whether the injection succeeded
InjectAsync
Task
Asynchronously injects services into properties on an existing object instance.
Task InjectAsync(object instance, params object[] scopedObjects)
instance
object
The instance to inject services into
scopedObjects
object[]
Additional objects to inject
Returns: A task representing the status of the operation

Usage Example

using Dalamud.Plugin;

public class MyPlugin : IDalamudPlugin
{
    private IDalamudPluginInterface pluginInterface;

    public MyPlugin(IDalamudPluginInterface pluginInterface)
    {
        this.pluginInterface = pluginInterface;

        // Subscribe to events
        pluginInterface.LanguageChanged += OnLanguageChanged;
        pluginInterface.ActivePluginsChanged += OnActivePluginsChanged;

        // Access plugin info
        var reason = pluginInterface.Reason;
        var internalName = pluginInterface.InternalName;
        
        // Use UI builder
        pluginInterface.UiBuilder.Draw += DrawUI;
    }

    private void OnLanguageChanged(string langCode)
    {
        // Handle language change
    }

    private void OnActivePluginsChanged(IActivePluginsChangedEventArgs args)
    {
        // Handle plugin list changes
    }

    private void DrawUI()
    {
        // Draw ImGui UI
    }

    public void Dispose()
    {
        pluginInterface.LanguageChanged -= OnLanguageChanged;
        pluginInterface.ActivePluginsChanged -= OnActivePluginsChanged;
        pluginInterface.UiBuilder.Draw -= DrawUI;
    }
}

Build docs developers (and LLMs) love