You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
You only have to include WHAT YOU WANT. You even don't need to include the DalamudPluginInterface if you don't use it. Add them to static properties in your base class, pass them around, however you want to access the various API classes. The scratch constructor above is all the various possibilities that you can currently include. Any classes that have a [PluginInterface] attribute are available as parameters in your constructor.
If you would like to restrict the version of your dependency, i.e. you're worried about ClientState breaking, you should structure your parameters as such. If the API class version changes due to breaking updates, your plugin will gracefully not load, rather than break in unforeseen ways in-game.
public ScratchPlugin(
...
[RequiredVersion("1.0")] ClientState clientState,
...)
...in properties
You can do the same for public, private, static or instance properties.
You can inject into and create your own objects via DI.
varinstance= pluginInterface.Create<MySubsystem>();if(!pluginInterface.Inject(otherInstance))
Log.Error("Could not satisfy requirements for otherInstance");[...]
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
Old and busted
New hotness
...in constructors
You only have to include WHAT YOU WANT. You even don't need to include the DalamudPluginInterface if you don't use it. Add them to static properties in your base class, pass them around, however you want to access the various API classes. The scratch constructor above is all the various possibilities that you can currently include. Any classes that have a
[PluginInterface]
attribute are available as parameters in your constructor.If you would like to restrict the version of your dependency, i.e. you're worried about ClientState breaking, you should structure your parameters as such. If the API class version changes due to breaking updates, your plugin will gracefully not load, rather than break in unforeseen ways in-game.
...in properties
You can do the same for public, private, static or instance properties.
...for your own types and objects
You can inject into and create your own objects via DI.
Beta Was this translation helpful? Give feedback.
All reactions