Pair request button only shows when lightfinder is on

This commit is contained in:
CakeAndBanana
2025-09-29 19:44:36 +02:00
parent 8f7f07311f
commit f74cd01a32
2 changed files with 16 additions and 9 deletions

View File

@@ -147,7 +147,7 @@ public sealed class Plugin : IDalamudPlugin
collection.AddSingleton<RedrawManager>(); collection.AddSingleton<RedrawManager>();
collection.AddSingleton<BroadcastService>(); collection.AddSingleton<BroadcastService>();
collection.AddSingleton(addonLifecycle); collection.AddSingleton(addonLifecycle);
collection.AddSingleton(p => new ContextMenu(contextMenu, pluginInterface, gameData, p.GetRequiredService<ILogger<ContextMenu>>(), p.GetRequiredService<DalamudUtilService>(), p.GetRequiredService<ApiController>(), objectTable)); collection.AddSingleton(p => new ContextMenu(contextMenu, pluginInterface, gameData, p.GetRequiredService<ILogger<ContextMenu>>(), p.GetRequiredService<DalamudUtilService>(), p.GetRequiredService<ApiController>(), objectTable, p.GetRequiredService<LightlessConfigService>()));
collection.AddSingleton((s) => new IpcCallerPenumbra(s.GetRequiredService<ILogger<IpcCallerPenumbra>>(), pluginInterface, collection.AddSingleton((s) => new IpcCallerPenumbra(s.GetRequiredService<ILogger<IpcCallerPenumbra>>(), pluginInterface,
s.GetRequiredService<DalamudUtilService>(), s.GetRequiredService<LightlessMediator>(), s.GetRequiredService<RedrawManager>())); s.GetRequiredService<DalamudUtilService>(), s.GetRequiredService<LightlessMediator>(), s.GetRequiredService<RedrawManager>()));
collection.AddSingleton((s) => new IpcCallerGlamourer(s.GetRequiredService<ILogger<IpcCallerGlamourer>>(), pluginInterface, collection.AddSingleton((s) => new IpcCallerGlamourer(s.GetRequiredService<ILogger<IpcCallerGlamourer>>(), pluginInterface,

View File

@@ -3,6 +3,7 @@ using Dalamud.Game.ClientState.Objects.Types;
using Dalamud.Game.Gui.ContextMenu; using Dalamud.Game.Gui.ContextMenu;
using Dalamud.Plugin; using Dalamud.Plugin;
using Dalamud.Plugin.Services; using Dalamud.Plugin.Services;
using LightlessSync.LightlessConfiguration;
using LightlessSync.Services; using LightlessSync.Services;
using LightlessSync.Utils; using LightlessSync.Utils;
using LightlessSync.WebAPI; using LightlessSync.WebAPI;
@@ -19,6 +20,7 @@ internal class ContextMenu : IHostedService
private readonly IDataManager _gameData; private readonly IDataManager _gameData;
private readonly ILogger<ContextMenu> _logger; private readonly ILogger<ContextMenu> _logger;
private readonly DalamudUtilService _dalamudUtil; private readonly DalamudUtilService _dalamudUtil;
private readonly LightlessConfigService _configService;
private readonly ApiController _apiController; private readonly ApiController _apiController;
private readonly IObjectTable _objectTable; private readonly IObjectTable _objectTable;
@@ -37,7 +39,8 @@ internal class ContextMenu : IHostedService
ILogger<ContextMenu> logger, ILogger<ContextMenu> logger,
DalamudUtilService dalamudUtil, DalamudUtilService dalamudUtil,
ApiController apiController, ApiController apiController,
IObjectTable objectTable) IObjectTable objectTable,
LightlessConfigService configService)
{ {
_contextMenu = contextMenu; _contextMenu = contextMenu;
_pluginInterface = pluginInterface; _pluginInterface = pluginInterface;
@@ -46,6 +49,7 @@ internal class ContextMenu : IHostedService
_dalamudUtil = dalamudUtil; _dalamudUtil = dalamudUtil;
_apiController = apiController; _apiController = apiController;
_objectTable = objectTable; _objectTable = objectTable;
_configService = configService;
} }
public Task StartAsync(CancellationToken cancellationToken) public Task StartAsync(CancellationToken cancellationToken)
@@ -90,6 +94,8 @@ internal class ContextMenu : IHostedService
if (!IsWorldValid(world)) if (!IsWorldValid(world))
return; return;
if (_configService.Current.BroadcastEnabled)
{
args.AddMenuItem(new MenuItem args.AddMenuItem(new MenuItem
{ {
Name = "Send Pair Request", Name = "Send Pair Request",
@@ -99,6 +105,7 @@ internal class ContextMenu : IHostedService
OnClicked = async _ => await HandleSelection(args) OnClicked = async _ => await HandleSelection(args)
}); });
} }
}
private async Task HandleSelection(IMenuArgs args) private async Task HandleSelection(IMenuArgs args)
{ {