diff --git a/TextBoxStyler/Commands.cs b/TextBoxStyler/Commands.cs index 6c3dcdd..9fa9e12 100755 --- a/TextBoxStyler/Commands.cs +++ b/TextBoxStyler/Commands.cs @@ -10,13 +10,13 @@ namespace TextBoxStyler { internal Commands(Plugin plugin) { this.Plugin = plugin; - this.Plugin.Interface.CommandManager.AddHandler(CommandName, new CommandInfo(this.OnCommand) { + this.Plugin.CommandManager.AddHandler(CommandName, new CommandInfo(this.OnCommand) { HelpMessage = $"Opens the settings for {this.Plugin.Name}", }); } public void Dispose() { - this.Plugin.Interface.CommandManager.RemoveHandler(CommandName); + this.Plugin.CommandManager.RemoveHandler(CommandName); } private void OnCommand(string command, string args) { diff --git a/TextBoxStyler/FodyWeavers.xml b/TextBoxStyler/FodyWeavers.xml deleted file mode 100755 index e5727bf..0000000 --- a/TextBoxStyler/FodyWeavers.xml +++ /dev/null @@ -1,3 +0,0 @@ - - - diff --git a/TextBoxStyler/Plugin.cs b/TextBoxStyler/Plugin.cs index b78cae4..3500cd0 100755 --- a/TextBoxStyler/Plugin.cs +++ b/TextBoxStyler/Plugin.cs @@ -1,19 +1,24 @@ -using Dalamud.Plugin; +using Dalamud.Game.Command; +using Dalamud.IoC; +using Dalamud.Plugin; namespace TextBoxStyler { // ReSharper disable once ClassNeverInstantiated.Global public class Plugin : IDalamudPlugin { public string Name => "Text Box Styler"; - internal DalamudPluginInterface Interface { get; private set; } = null!; - internal PluginConfiguration Config { get; private set; } = null!; - internal PluginUi Ui { get; private set; } = null!; - private Styler Styler { get; set; } = null!; - private Commands Commands { get; set; } = null!; + [PluginService] + internal DalamudPluginInterface Interface { get; private init; } = null!; - public void Initialize(DalamudPluginInterface pluginInterface) { - this.Interface = pluginInterface; + [PluginService] + internal CommandManager CommandManager { get; private init; } = null!; + internal PluginConfiguration Config { get; } + internal PluginUi Ui { get; } + private Styler Styler { get; } + private Commands Commands { get; } + + public Plugin() { this.Config = this.Interface.GetPluginConfig() as PluginConfiguration ?? new PluginConfiguration(); this.Config.Initialise(this); diff --git a/TextBoxStyler/PluginUi.cs b/TextBoxStyler/PluginUi.cs index 27b935b..2c3e738 100755 --- a/TextBoxStyler/PluginUi.cs +++ b/TextBoxStyler/PluginUi.cs @@ -18,16 +18,16 @@ namespace TextBoxStyler { internal PluginUi(Plugin plugin) { this.Plugin = plugin; - this.Plugin.Interface.UiBuilder.OnBuildUi += this.Draw; - this.Plugin.Interface.UiBuilder.OnOpenConfigUi += this.ToggleConfig; + this.Plugin.Interface.UiBuilder.Draw += this.Draw; + this.Plugin.Interface.UiBuilder.OpenConfigUi += this.ToggleConfig; } public void Dispose() { - this.Plugin.Interface.UiBuilder.OnOpenConfigUi -= this.ToggleConfig; - this.Plugin.Interface.UiBuilder.OnBuildUi -= this.Draw; + this.Plugin.Interface.UiBuilder.OpenConfigUi -= this.ToggleConfig; + this.Plugin.Interface.UiBuilder.Draw -= this.Draw; } - internal void ToggleConfig(object? sender = null, EventArgs? e = null) { + internal void ToggleConfig() { this.DrawUi = !this.DrawUi; } diff --git a/TextBoxStyler/Styler.cs b/TextBoxStyler/Styler.cs index 89cb9e2..10483d8 100755 --- a/TextBoxStyler/Styler.cs +++ b/TextBoxStyler/Styler.cs @@ -10,7 +10,7 @@ namespace TextBoxStyler { public Styler(Plugin plugin) { this.Plugin = plugin; - this.Common = new XivCommonBase(this.Plugin.Interface, Hooks.Talk | Hooks.BattleTalk); + this.Common = new XivCommonBase(Hooks.Talk | Hooks.BattleTalk); this.Common.Functions.Talk.OnTalk += this.StyleTalk; this.Common.Functions.BattleTalk.OnBattleTalk += this.StyleBattleTalk; diff --git a/TextBoxStyler/TextBoxStyler.csproj b/TextBoxStyler/TextBoxStyler.csproj index 1e90546..1825c73 100755 --- a/TextBoxStyler/TextBoxStyler.csproj +++ b/TextBoxStyler/TextBoxStyler.csproj @@ -1,10 +1,12 @@ - net48 + net5-windows 1.1.0 latest enable + false + true @@ -23,10 +25,8 @@ - - - - + +