Overview
PluginLoadReason is a flags enumeration that indicates why a plugin was loaded. This can be accessed through the IDalamudPluginInterface.Reason property.
Enum Definition
Values
The reason for loading this plugin is unknown or could not be determined.
This plugin was loaded because it was installed through the plugin installer.This occurs when a user manually installs a plugin from the plugin installer window.
This plugin was loaded because it was just updated.This occurs when a plugin is reloaded after being updated to a new version.
This plugin was loaded because it was told to reload.This occurs when a plugin is manually reloaded, typically during development or troubleshooting.
This plugin was loaded because the game was started or Dalamud was reinjected.This is the most common load reason, occurring when plugins are loaded at game startup.
Usage
SincePluginLoadReason is decorated with the [Flags] attribute, multiple reasons can be combined using bitwise operations.
Accessing the Load Reason
Checking Multiple Flags
Common Scenarios
First-Time Installation
When a user installs your plugin for the first time:After Update
When your plugin is loaded after being updated:Normal Game Launch
When the game starts normally:Development/Testing
When reloading during development:Best Practices
- Use the load reason to provide appropriate user feedback or initialization
- Consider showing changelogs or welcome messages based on the load reason
- Avoid performing expensive operations on every load reason - optimize for
Bootwhich is most common - Handle the
Unknowncase gracefully as a fallback
Related Types
- IDalamudPluginInterface - Provides access to the
Reasonproperty - IDalamudPlugin - Base plugin interface