using System.Threading.Channels; using Dalamud.IoC; using Dalamud.Plugin; using Dalamud.Plugin.Services; using XivCommon; namespace QuestMap { // ReSharper disable once ClassNeverInstantiated.Global internal class Plugin : IDalamudPlugin { internal static string Name => "Quest Map"; [PluginService] internal DalamudPluginInterface Interface { get; init; } = null!; [PluginService] internal IClientState ClientState { get; init; } = null!; [PluginService] internal ICommandManager CommandManager { get; init; } = null!; [PluginService] internal IDataManager DataManager { get; init; } = null!; [PluginService] internal IGameGui GameGui { get; init; } = null!; [PluginService] internal ITextureProvider TextureProvider { get; init; } = null!; internal XivCommonBase Common { get; } internal Configuration Config { get; } internal Quests Quests { get; } internal PluginUi Ui { get; } private Commands Commands { get; } public Plugin(DalamudPluginInterface pi) { pi.Inject(this); // not sure why [PluginInterface] above aren't initialized by dalamud, but they're null this.Common = new XivCommonBase(this.Interface); this.Config = this.Interface.GetPluginConfig() as Configuration ?? new Configuration(); var graphChannel = Channel.CreateUnbounded(); this.Quests = new Quests(this, graphChannel.Writer); this.Ui = new PluginUi(this, graphChannel.Reader); this.Commands = new Commands(this); } public void Dispose() { this.Commands.Dispose(); this.Ui.Dispose(); this.Common.Dispose(); } internal void SaveConfig() { this.Interface.SavePluginConfig(this.Config); } } }