Skip to main content

Class DalamudPluginInterface

This class acts as an interface to various objects needed to interact with Dalamud and the game.

Assembly: Dalamud.dll
View Source
Declaration
public sealed class DalamudPluginInterface : IDisposable

Implements:
System.IDisposable

Properties

Reason

Gets the reason this plugin was loaded.

View Source
Declaration
public PluginLoadReason Reason { get; }

IsAutoUpdateComplete

Gets a value indicating whether or not auto-updates have already completed this session.

View Source
Declaration
public bool IsAutoUpdateComplete { get; }

SourceRepository

Gets the repository from which this plugin was installed.

If a plugin was installed from the official/main repository, this will return the value of Dalamud.Plugin.Internal.Types.Manifest.SpecialPluginSource.MainRepo. Developer plugins will return the value of Dalamud.Plugin.Internal.Types.Manifest.SpecialPluginSource.DevPlugin.

View Source
Declaration
public string SourceRepository { get; }

InternalName

Gets the current internal plugin name.

View Source
Declaration
public string InternalName { get; }

Manifest

Gets the plugin's manifest.

View Source
Declaration
public IPluginManifest Manifest { get; }

IsDev

Gets a value indicating whether this is a dev plugin.

View Source
Declaration
public bool IsDev { get; }

IsTesting

Gets a value indicating whether this is a testing release of a plugin.

View Source
Declaration
public bool IsTesting { get; }

LoadTime

Gets the time that this plugin was loaded.

View Source
Declaration
public DateTime LoadTime { get; }

LoadTimeUTC

Gets the UTC time that this plugin was loaded.

View Source
Declaration
public DateTime LoadTimeUTC { get; }

LoadTimeDelta

Gets the timespan delta from when this plugin was loaded.

View Source
Declaration
public TimeSpan LoadTimeDelta { get; }

DalamudAssetDirectory

Gets the directory Dalamud assets are stored in.

View Source
Declaration
public DirectoryInfo DalamudAssetDirectory { get; }

AssemblyLocation

Gets the location of your plugin assembly.

View Source
Declaration
public FileInfo AssemblyLocation { get; }

ConfigDirectory

Gets the directory your plugin configurations are stored in.

View Source
Declaration
public DirectoryInfo ConfigDirectory { get; }

ConfigFile

Gets the config file of your plugin.

View Source
Declaration
public FileInfo ConfigFile { get; }

UiBuilder

Gets the Dalamud.Plugin.DalamudPluginInterface.UiBuilder instance which allows you to draw UI into the game via ImGui draw calls.

View Source
Declaration
public UiBuilder UiBuilder { get; }

IsDevMenuOpen

Gets a value indicating whether Dalamud is running in Debug mode or the /xldev menu is open. This can occur on release builds.

View Source
Declaration
public bool IsDevMenuOpen { get; }

IsDebugging

Gets a value indicating whether a debugger is attached.

View Source
Declaration
public bool IsDebugging { get; }

UiLanguage

Gets the current UI language in two-letter iso format.

View Source
Declaration
public string UiLanguage { get; }

Sanitizer

Gets serializer class with functions to remove special characters from strings.

View Source
Declaration
public ISanitizer Sanitizer { get; }

GeneralChatType

Gets the chat type used by default for plugin messages.

View Source
Declaration
public XivChatType GeneralChatType { get; }

InstalledPlugins

Gets a list of installed plugins along with their current state.

View Source
Declaration
public IEnumerable<InstalledPluginState> InstalledPlugins { get; }

Methods

OpenPluginInstaller()

Opens the Dalamud.Interface.Internal.Windows.PluginInstaller.PluginInstallerWindow with the plugin name set as search target.

View Source
Declaration
public bool OpenPluginInstaller()
Returns

System.Boolean: Returns false if the DalamudInterface was null.### GetOrCreateData<T>(string, Func<T>) If a data cache for <code class="paramref">tag</code> exists, return the data. Otherwise, call the function <code class="paramref">dataGenerator</code> to create data and store it as a new cache. In either case, the calling assembly will be added to the current consumers on success.

View Source
Declaration
public T GetOrCreateData<T>(string tag, Func<T> dataGenerator) where T : class
Returns

<T>: Either the existing data for <code class="paramref">tag</code> or the data generated by <code class="paramref">dataGenerator</code>.

Parameters
TypeNameDescription
System.StringtagThe name for the data cache.
System.Func<<T>>dataGeneratorThe function that generates the data if it does not already exist.
Type Parameters
NameDescription
TThe type of the stored data - needs to be a reference type that is shared through Dalamud itself, not loaded by the plugin.
Exceptions

Dalamud.Plugin.Ipc.Exceptions.DataCacheTypeMismatchError
Thrown if a cache for <code class="paramref">tag</code> exists, but contains data of a type not assignable to <code class="typeparamref">T>></code>. Dalamud.Plugin.Ipc.Exceptions.DataCacheValueNullError
Thrown if the stored data for a cache is null. Dalamud.Plugin.Ipc.Exceptions.DataCacheCreationError
Thrown if <code class="paramref">dataGenerator</code> throws an exception or returns null.

RelinquishData(string)

Notifies the DataShare that the calling assembly no longer uses the data stored for <code class="paramref">tag</code> (or uses it one time fewer). If no assembly uses the data anymore, the cache will be removed from the data share and if it is an IDisposable, Dispose will be called on it.

View Source
Declaration
public void RelinquishData(string tag)
Parameters
TypeNameDescription
System.StringtagThe name for the data cache.

TryGetData<T>(string, out T?)

Obtain the data for the given <code class="paramref">tag</code>, if it exists and has the correct type. Add the calling assembly to the current consumers if true is returned.

View Source
Declaration
public bool TryGetData<T>(string tag, out T? data) where T : class
Returns

System.Boolean: True if the requested data exists and is assignable to the requested type.

Parameters
TypeNameDescription
System.StringtagThe name for the data cache.
<T>dataThe requested data on success, null otherwise.
Type Parameters
NameDescription
TThe type of the stored data - needs to be a reference type that is shared through Dalamud itself, not loaded by the plugin.

GetData<T>(string)

Obtain the data for the given <code class="paramref">tag</code>, if it exists and has the correct type. Add the calling assembly to the current consumers if non-null is returned.

View Source
Declaration
public T? GetData<T>(string tag) where T : class
Returns

<T>: The requested data.

Parameters
TypeNameDescription
System.StringtagThe name for the data cache.
Type Parameters
NameDescription
TThe type of the stored data - needs to be a reference type that is shared through Dalamud itself, not loaded by the plugin.
Exceptions

System.Collections.Generic.KeyNotFoundException
Thrown if <code class="paramref">tag</code> is not registered. Dalamud.Plugin.Ipc.Exceptions.DataCacheTypeMismatchError
Thrown if a cache for <code class="paramref">tag</code> exists, but contains data of a type not assignable to <code class="typeparamref">T>></code>. Dalamud.Plugin.Ipc.Exceptions.DataCacheValueNullError
Thrown if the stored data for a cache is null.

GetIpcProvider<TRet>(string)

Gets an IPC provider.

View Source
Declaration
public ICallGateProvider<TRet> GetIpcProvider<TRet>(string name)
Returns

Dalamud.Plugin.Ipc.ICallGateProvider<TRet>: An IPC provider.

Parameters
TypeNameDescription
System.StringnameThe name of the IPC registration.
Type Parameters
NameDescription
TRetThe return type for funcs. Use object if this is unused.
Exceptions

Dalamud.Plugin.Ipc.Exceptions.IpcTypeMismatchError
This is thrown when the requested types do not match the previously registered types are different.

GetIpcProvider<T1, TRet>(string)

This class facilitates inter-plugin communication.

View Source
Declaration
public ICallGateProvider<T1, TRet> GetIpcProvider<T1, TRet>(string name)
Returns

Dalamud.Plugin.Ipc.ICallGateProvider<TRet>

Parameters
TypeName
System.Stringname
Type Parameters
  • T1
  • TRet

GetIpcProvider<T1, T2, TRet>(string)

This class facilitates inter-plugin communication.

View Source
Declaration
public ICallGateProvider<T1, T2, TRet> GetIpcProvider<T1, T2, TRet>(string name)
Returns

Dalamud.Plugin.Ipc.ICallGateProvider<TRet>

Parameters
TypeName
System.Stringname
Type Parameters
  • T1
  • T2
  • TRet

GetIpcProvider<T1, T2, T3, TRet>(string)

This class facilitates inter-plugin communication.

View Source
Declaration
public ICallGateProvider<T1, T2, T3, TRet> GetIpcProvider<T1, T2, T3, TRet>(string name)
Returns

Dalamud.Plugin.Ipc.ICallGateProvider<TRet>

Parameters
TypeName
System.Stringname
Type Parameters
  • T1
  • T2
  • T3
  • TRet

GetIpcProvider<T1, T2, T3, T4, TRet>(string)

This class facilitates inter-plugin communication.

View Source
Declaration
public ICallGateProvider<T1, T2, T3, T4, TRet> GetIpcProvider<T1, T2, T3, T4, TRet>(string name)
Returns

Dalamud.Plugin.Ipc.ICallGateProvider<TRet>

Parameters
TypeName
System.Stringname
Type Parameters
  • T1
  • T2
  • T3
  • T4
  • TRet

GetIpcProvider<T1, T2, T3, T4, T5, TRet>(string)

This class facilitates inter-plugin communication.

View Source
Declaration
public ICallGateProvider<T1, T2, T3, T4, T5, TRet> GetIpcProvider<T1, T2, T3, T4, T5, TRet>(string name)
Returns

Dalamud.Plugin.Ipc.ICallGateProvider<TRet>

Parameters
TypeName
System.Stringname
Type Parameters
  • T1
  • T2
  • T3
  • T4
  • T5
  • TRet

GetIpcProvider<T1, T2, T3, T4, T5, T6, TRet>(string)

This class facilitates inter-plugin communication.

View Source
Declaration
public ICallGateProvider<T1, T2, T3, T4, T5, T6, TRet> GetIpcProvider<T1, T2, T3, T4, T5, T6, TRet>(string name)
Returns

Dalamud.Plugin.Ipc.ICallGateProvider<TRet>

Parameters
TypeName
System.Stringname
Type Parameters
  • T1
  • T2
  • T3
  • T4
  • T5
  • T6
  • TRet

GetIpcProvider<T1, T2, T3, T4, T5, T6, T7, TRet>(string)

This class facilitates inter-plugin communication.

View Source
Declaration
public ICallGateProvider<T1, T2, T3, T4, T5, T6, T7, TRet> GetIpcProvider<T1, T2, T3, T4, T5, T6, T7, TRet>(string name)
Returns

Dalamud.Plugin.Ipc.ICallGateProvider<TRet>

Parameters
TypeName
System.Stringname
Type Parameters
  • T1
  • T2
  • T3
  • T4
  • T5
  • T6
  • T7
  • TRet

GetIpcProvider<T1, T2, T3, T4, T5, T6, T7, T8, TRet>(string)

This class facilitates inter-plugin communication.

View Source
Declaration
public ICallGateProvider<T1, T2, T3, T4, T5, T6, T7, T8, TRet> GetIpcProvider<T1, T2, T3, T4, T5, T6, T7, T8, TRet>(string name)
Returns

Dalamud.Plugin.Ipc.ICallGateProvider<TRet>

Parameters
TypeName
System.Stringname
Type Parameters
  • T1
  • T2
  • T3
  • T4
  • T5
  • T6
  • T7
  • T8
  • TRet

GetIpcSubscriber<TRet>(string)

Gets an IPC subscriber.

View Source
Declaration
public ICallGateSubscriber<TRet> GetIpcSubscriber<TRet>(string name)
Returns

Dalamud.Plugin.Ipc.ICallGateSubscriber<TRet>: An IPC subscriber.

Parameters
TypeNameDescription
System.StringnameThe name of the IPC registration.
Type Parameters
NameDescription
TRetThe return type for funcs. Use object if this is unused.

GetIpcSubscriber<T1, TRet>(string)

This class facilitates inter-plugin communication.

View Source
Declaration
public ICallGateSubscriber<T1, TRet> GetIpcSubscriber<T1, TRet>(string name)
Returns

Dalamud.Plugin.Ipc.ICallGateSubscriber<TRet>

Parameters
TypeName
System.Stringname
Type Parameters
  • T1
  • TRet

GetIpcSubscriber<T1, T2, TRet>(string)

This class facilitates inter-plugin communication.

View Source
Declaration
public ICallGateSubscriber<T1, T2, TRet> GetIpcSubscriber<T1, T2, TRet>(string name)
Returns

Dalamud.Plugin.Ipc.ICallGateSubscriber<TRet>

Parameters
TypeName
System.Stringname
Type Parameters
  • T1
  • T2
  • TRet

GetIpcSubscriber<T1, T2, T3, TRet>(string)

This class facilitates inter-plugin communication.

View Source
Declaration
public ICallGateSubscriber<T1, T2, T3, TRet> GetIpcSubscriber<T1, T2, T3, TRet>(string name)
Returns

Dalamud.Plugin.Ipc.ICallGateSubscriber<TRet>

Parameters
TypeName
System.Stringname
Type Parameters
  • T1
  • T2
  • T3
  • TRet

GetIpcSubscriber<T1, T2, T3, T4, TRet>(string)

This class facilitates inter-plugin communication.

View Source
Declaration
public ICallGateSubscriber<T1, T2, T3, T4, TRet> GetIpcSubscriber<T1, T2, T3, T4, TRet>(string name)
Returns

Dalamud.Plugin.Ipc.ICallGateSubscriber<TRet>

Parameters
TypeName
System.Stringname
Type Parameters
  • T1
  • T2
  • T3
  • T4
  • TRet

GetIpcSubscriber<T1, T2, T3, T4, T5, TRet>(string)

This class facilitates inter-plugin communication.

View Source
Declaration
public ICallGateSubscriber<T1, T2, T3, T4, T5, TRet> GetIpcSubscriber<T1, T2, T3, T4, T5, TRet>(string name)
Returns

Dalamud.Plugin.Ipc.ICallGateSubscriber<TRet>

Parameters
TypeName
System.Stringname
Type Parameters
  • T1
  • T2
  • T3
  • T4
  • T5
  • TRet

GetIpcSubscriber<T1, T2, T3, T4, T5, T6, TRet>(string)

This class facilitates inter-plugin communication.

View Source
Declaration
public ICallGateSubscriber<T1, T2, T3, T4, T5, T6, TRet> GetIpcSubscriber<T1, T2, T3, T4, T5, T6, TRet>(string name)
Returns

Dalamud.Plugin.Ipc.ICallGateSubscriber<TRet>

Parameters
TypeName
System.Stringname
Type Parameters
  • T1
  • T2
  • T3
  • T4
  • T5
  • T6
  • TRet

GetIpcSubscriber<T1, T2, T3, T4, T5, T6, T7, TRet>(string)

This class facilitates inter-plugin communication.

View Source
Declaration
public ICallGateSubscriber<T1, T2, T3, T4, T5, T6, T7, TRet> GetIpcSubscriber<T1, T2, T3, T4, T5, T6, T7, TRet>(string name)
Returns

Dalamud.Plugin.Ipc.ICallGateSubscriber<TRet>

Parameters
TypeName
System.Stringname
Type Parameters
  • T1
  • T2
  • T3
  • T4
  • T5
  • T6
  • T7
  • TRet

GetIpcSubscriber<T1, T2, T3, T4, T5, T6, T7, T8, TRet>(string)

This class facilitates inter-plugin communication.

View Source
Declaration
public ICallGateSubscriber<T1, T2, T3, T4, T5, T6, T7, T8, TRet> GetIpcSubscriber<T1, T2, T3, T4, T5, T6, T7, T8, TRet>(string name)
Returns

Dalamud.Plugin.Ipc.ICallGateSubscriber<TRet>

Parameters
TypeName
System.Stringname
Type Parameters
  • T1
  • T2
  • T3
  • T4
  • T5
  • T6
  • T7
  • T8
  • TRet

SavePluginConfig(IPluginConfiguration?)

Save a plugin configuration(inheriting IPluginConfiguration).

View Source
Declaration
public void SavePluginConfig(IPluginConfiguration? currentConfig)
Parameters
TypeNameDescription
Dalamud.Configuration.IPluginConfigurationcurrentConfigThe current configuration.

GetPluginConfig()

Get a previously saved plugin configuration or null if none was saved before.

View Source
Declaration
public IPluginConfiguration? GetPluginConfig()
Returns

Dalamud.Configuration.IPluginConfiguration: A previously saved config or null if none was saved before.### GetPluginConfigDirectory() Get the config directory.

View Source
Declaration
public string GetPluginConfigDirectory()
Returns

System.String: directory with path of AppData/XIVLauncher/pluginConfig/PluginInternalName.### GetPluginLocDirectory() Get the loc directory.

View Source
Declaration
public string GetPluginLocDirectory()
Returns

System.String: directory with path of AppData/XIVLauncher/pluginConfig/PluginInternalName/loc.### AddChatLinkHandler(uint, Action<uint, SeString>) Register a chat link handler.

View Source
Declaration
public DalamudLinkPayload AddChatLinkHandler(uint commandId, Action<uint, SeString> commandAction)
Returns

Dalamud.Game.Text.SeStringHandling.Payloads.DalamudLinkPayload: Returns an SeString payload for the link.

Parameters
TypeNameDescription
System.UInt32commandIdThe ID of the command.
System.Action<System.UInt32,Dalamud.Game.Text.SeStringHandling.SeString>commandActionThe action to be executed.

RemoveChatLinkHandler(uint)

Remove a chat link handler.

View Source
Declaration
public void RemoveChatLinkHandler(uint commandId)
Parameters
TypeNameDescription
System.UInt32commandIdThe ID of the command.

RemoveChatLinkHandler()

Removes all chat link handlers registered by the plugin.

View Source
Declaration
public void RemoveChatLinkHandler()

Create<T>(params object[])

Create a new object of the provided type using its default constructor, then inject objects and properties.

View Source
Declaration
public T? Create<T>(params object[] scopedObjects) where T : class
Returns

<T>: The created and initialized type.

Parameters
TypeNameDescription
System.Object[]scopedObjectsObjects to inject additionally.
Type Parameters
NameDescription
TThe type to create.

Inject(object, params object[])

Inject services into properties on the provided object instance.

View Source
Declaration
public bool Inject(object instance, params object[] scopedObjects)
Returns

System.Boolean: Whether or not the injection succeeded.

Parameters
TypeNameDescription
System.ObjectinstanceThe instance to inject services into.
System.Object[]scopedObjectsObjects to inject additionally.

Dispose()

This function will do nothing. Dalamud will dispose this object on plugin unload.

View Source
Declaration
[Obsolete("This function will do nothing. Dalamud will dispose this object on plugin unload.", true)]
public void Dispose()

Events

LanguageChanged

Event that gets fired when loc is changed

View Source
Declaration
public event DalamudPluginInterface.LanguageChangedDelegate LanguageChanged
Event Type

Dalamud.Plugin.DalamudPluginInterface.LanguageChangedDelegate

ActivePluginsChanged

Event that is fired when the active list of plugins is changed.

View Source
Declaration
public event DalamudPluginInterface.ActivePluginsChangedDelegate ActivePluginsChanged
Event Type

Dalamud.Plugin.DalamudPluginInterface.ActivePluginsChangedDelegate

Implements

  • System.IDisposable