Improve commands help code.

This commit is contained in:
Aireil 2020-12-08 09:43:40 +01:00
parent 96c9ba0af3
commit 8a0de78ccb

View file

@ -229,14 +229,13 @@ namespace Dalamud.Plugin
x => x.Definition.InternalName == x => x.Definition.InternalName ==
pluginDefinition.InternalName); pluginDefinition.InternalName);
if (this.dalamud.CommandManager.Commands.Any(x => x.Value.LoaderAssemblyName == installedPlugin.Definition?.InternalName)) { var commands = this.dalamud.CommandManager.Commands.Where(x => x.Value.LoaderAssemblyName == installedPlugin.Definition?.InternalName && x.Value.ShowInHelp);
if (commands.Any()) {
ImGui.Dummy(new Vector2(10, 10) * ImGui.GetIO().FontGlobalScale); ImGui.Dummy(new Vector2(10, 10) * ImGui.GetIO().FontGlobalScale);
foreach (var command in this.dalamud.CommandManager.Commands) { foreach (var command in commands) {
if (command.Value.LoaderAssemblyName == installedPlugin.Definition.InternalName && command.Value.ShowInHelp) {
ImGui.Text($"{command.Key} → {command.Value.HelpMessage}"); ImGui.Text($"{command.Key} → {command.Value.HelpMessage}");
} }
} }
}
if (ImGui.Button(Loc.Localize("InstallerDisable", "Disable"))) if (ImGui.Button(Loc.Localize("InstallerDisable", "Disable")))
try { try {