mirror of
https://github.com/goatcorp/Dalamud.git
synced 2026-01-01 05:13:40 +01:00
Set CommandInfo InternalName when adding to CommandManager via PluginScopedService
This commit is contained in:
parent
34617cf377
commit
5d06949185
3 changed files with 13 additions and 4 deletions
|
|
@ -15,7 +15,6 @@ public sealed class CommandInfo
|
||||||
public CommandInfo(HandlerDelegate handler)
|
public CommandInfo(HandlerDelegate handler)
|
||||||
{
|
{
|
||||||
this.Handler = handler;
|
this.Handler = handler;
|
||||||
this.LoaderAssemblyName = Assembly.GetCallingAssembly()?.GetName()?.Name;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
|
||||||
|
|
@ -9,6 +9,7 @@ using Dalamud.Game.Text.SeStringHandling;
|
||||||
using Dalamud.IoC;
|
using Dalamud.IoC;
|
||||||
using Dalamud.IoC.Internal;
|
using Dalamud.IoC.Internal;
|
||||||
using Dalamud.Logging.Internal;
|
using Dalamud.Logging.Internal;
|
||||||
|
using Dalamud.Plugin.Internal.Types;
|
||||||
using Dalamud.Plugin.Services;
|
using Dalamud.Plugin.Services;
|
||||||
|
|
||||||
namespace Dalamud.Game.Command;
|
namespace Dalamud.Game.Command;
|
||||||
|
|
@ -177,6 +178,16 @@ internal class CommandManagerPluginScoped : IDisposable, IServiceType, ICommandM
|
||||||
private readonly CommandManager commandManagerService = Service<CommandManager>.Get();
|
private readonly CommandManager commandManagerService = Service<CommandManager>.Get();
|
||||||
|
|
||||||
private readonly List<string> pluginRegisteredCommands = new();
|
private readonly List<string> pluginRegisteredCommands = new();
|
||||||
|
private readonly LocalPlugin pluginInfo;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Initializes a new instance of the <see cref="CommandManagerPluginScoped"/> class.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="localPlugin">Info for the plugin that requests this service.</param>
|
||||||
|
public CommandManagerPluginScoped(LocalPlugin localPlugin)
|
||||||
|
{
|
||||||
|
this.pluginInfo = localPlugin;
|
||||||
|
}
|
||||||
|
|
||||||
/// <inheritdoc/>
|
/// <inheritdoc/>
|
||||||
public ReadOnlyDictionary<string, CommandInfo> Commands => this.commandManagerService.Commands;
|
public ReadOnlyDictionary<string, CommandInfo> Commands => this.commandManagerService.Commands;
|
||||||
|
|
@ -205,6 +216,7 @@ internal class CommandManagerPluginScoped : IDisposable, IServiceType, ICommandM
|
||||||
{
|
{
|
||||||
if (!this.pluginRegisteredCommands.Contains(command))
|
if (!this.pluginRegisteredCommands.Contains(command))
|
||||||
{
|
{
|
||||||
|
info.LoaderAssemblyName = this.pluginInfo.InternalName;
|
||||||
if (this.commandManagerService.AddHandler(command, info))
|
if (this.commandManagerService.AddHandler(command, info))
|
||||||
{
|
{
|
||||||
this.pluginRegisteredCommands.Add(command);
|
this.pluginRegisteredCommands.Add(command);
|
||||||
|
|
|
||||||
|
|
@ -15,7 +15,6 @@ using Dalamud.Game.Command;
|
||||||
using Dalamud.Interface.Colors;
|
using Dalamud.Interface.Colors;
|
||||||
using Dalamud.Interface.Components;
|
using Dalamud.Interface.Components;
|
||||||
using Dalamud.Interface.Internal.Notifications;
|
using Dalamud.Interface.Internal.Notifications;
|
||||||
using Dalamud.Interface.Style;
|
|
||||||
using Dalamud.Interface.Utility;
|
using Dalamud.Interface.Utility;
|
||||||
using Dalamud.Interface.Utility.Raii;
|
using Dalamud.Interface.Utility.Raii;
|
||||||
using Dalamud.Interface.Windowing;
|
using Dalamud.Interface.Windowing;
|
||||||
|
|
@ -2227,8 +2226,7 @@ internal class PluginInstallerWindow : Window, IDisposable
|
||||||
{
|
{
|
||||||
var commands = commandManager.Commands
|
var commands = commandManager.Commands
|
||||||
.Where(cInfo =>
|
.Where(cInfo =>
|
||||||
cInfo.Value != null &&
|
cInfo.Value is { ShowInHelp: true } &&
|
||||||
cInfo.Value.ShowInHelp &&
|
|
||||||
cInfo.Value.LoaderAssemblyName == plugin.Manifest.InternalName)
|
cInfo.Value.LoaderAssemblyName == plugin.Manifest.InternalName)
|
||||||
.ToArray();
|
.ToArray();
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue