diff --git a/LightlessSync/Plugin.cs b/LightlessSync/Plugin.cs index 3529735..24f1745 100644 --- a/LightlessSync/Plugin.cs +++ b/LightlessSync/Plugin.cs @@ -147,7 +147,7 @@ public sealed class Plugin : IDalamudPlugin collection.AddSingleton(); collection.AddSingleton(); collection.AddSingleton(addonLifecycle); - collection.AddSingleton(p => new ContextMenu(contextMenu, pluginInterface, gameData, p.GetRequiredService>(), p.GetRequiredService(), p.GetRequiredService(), objectTable)); + collection.AddSingleton(p => new ContextMenu(contextMenu, pluginInterface, gameData, p.GetRequiredService>(), p.GetRequiredService(), p.GetRequiredService(), objectTable, p.GetRequiredService())); collection.AddSingleton((s) => new IpcCallerPenumbra(s.GetRequiredService>(), pluginInterface, s.GetRequiredService(), s.GetRequiredService(), s.GetRequiredService())); collection.AddSingleton((s) => new IpcCallerGlamourer(s.GetRequiredService>(), pluginInterface, diff --git a/LightlessSync/UI/ContextMenu.cs b/LightlessSync/UI/ContextMenu.cs index 1e1cfc3..4a4ed62 100644 --- a/LightlessSync/UI/ContextMenu.cs +++ b/LightlessSync/UI/ContextMenu.cs @@ -3,6 +3,7 @@ using Dalamud.Game.ClientState.Objects.Types; using Dalamud.Game.Gui.ContextMenu; using Dalamud.Plugin; using Dalamud.Plugin.Services; +using LightlessSync.LightlessConfiguration; using LightlessSync.Services; using LightlessSync.Utils; using LightlessSync.WebAPI; @@ -19,6 +20,7 @@ internal class ContextMenu : IHostedService private readonly IDataManager _gameData; private readonly ILogger _logger; private readonly DalamudUtilService _dalamudUtil; + private readonly LightlessConfigService _configService; private readonly ApiController _apiController; private readonly IObjectTable _objectTable; @@ -37,7 +39,8 @@ internal class ContextMenu : IHostedService ILogger logger, DalamudUtilService dalamudUtil, ApiController apiController, - IObjectTable objectTable) + IObjectTable objectTable, + LightlessConfigService configService) { _contextMenu = contextMenu; _pluginInterface = pluginInterface; @@ -46,6 +49,7 @@ internal class ContextMenu : IHostedService _dalamudUtil = dalamudUtil; _apiController = apiController; _objectTable = objectTable; + _configService = configService; } public Task StartAsync(CancellationToken cancellationToken) @@ -90,14 +94,17 @@ internal class ContextMenu : IHostedService if (!IsWorldValid(world)) return; - args.AddMenuItem(new MenuItem + if (_configService.Current.BroadcastEnabled) { - Name = "Send Pair Request", - PrefixChar = 'L', - UseDefaultPrefix = false, - PrefixColor = 708, - OnClicked = async _ => await HandleSelection(args) - }); + args.AddMenuItem(new MenuItem + { + Name = "Send Pair Request", + PrefixChar = 'L', + UseDefaultPrefix = false, + PrefixColor = 708, + OnClicked = async _ => await HandleSelection(args) + }); + } } private async Task HandleSelection(IMenuArgs args)