feat(commands): consolidate /hellion and /clearhellion in Plugin.SetupCommands

/hellion routes through one handler with three subcommands: empty arg
toggles the main window, "settings" toggles the settings stub (full
settings UI lands later), "reset" calls ThemeRegistry.SwitchSilent on the
default slug so a broken custom theme can be unloaded without a settings
UI. /clearhellion now lives next to /hellion instead of inside the chat
window. ChatLogWindow loses its old register/unregister pair so the two
slash-commands stop double-binding.
This commit is contained in:
2026-05-23 20:08:09 +02:00
parent 576cd6dafd
commit ec02a5f381
2 changed files with 35 additions and 17 deletions
+35 -6
View File
@@ -95,6 +95,7 @@ public sealed class Plugin : IAsyncDalamudPlugin
// Phase-2 services are constructed in LoadAsync; null! shape is kept // Phase-2 services are constructed in LoadAsync; null! shape is kept
// consistent across all properties for clarity. // consistent across all properties for clarity.
internal Ui.Windows.MainWindow MainWindow { get; private set; } = null!;
public SettingsWindow SettingsWindow { get; private set; } = null!; public SettingsWindow SettingsWindow { get; private set; } = null!;
public ChatLogWindow ChatLogWindow { get; private set; } = null!; public ChatLogWindow ChatLogWindow { get; private set; } = null!;
public DbViewer DbViewer { get; private set; } = null!; public DbViewer DbViewer { get; private set; } = null!;
@@ -134,6 +135,7 @@ public sealed class Plugin : IAsyncDalamudPlugin
// Wrapper cached so TearDown can detach the live instance instead of // Wrapper cached so TearDown can detach the live instance instead of
// re-registering with identical args (v1.4.9 ISSUE-1 cleanup). // re-registering with identical args (v1.4.9 ISSUE-1 cleanup).
private CommandWrapper? _hellionSettingsCmd; private CommandWrapper? _hellionSettingsCmd;
private CommandWrapper? _clearHellionCmd;
private CommandWrapper? _hellionViewCmd; private CommandWrapper? _hellionViewCmd;
private CommandWrapper? _hellionDebuggerCmd; private CommandWrapper? _hellionDebuggerCmd;
#if DEBUG #if DEBUG
@@ -293,6 +295,7 @@ public sealed class Plugin : IAsyncDalamudPlugin
MessageManager = _host.Services.GetRequiredService<MessageManager>(); MessageManager = _host.Services.GetRequiredService<MessageManager>();
AutoTellTabsService = _host.Services.GetRequiredService<AutoTellTabsService>(); AutoTellTabsService = _host.Services.GetRequiredService<AutoTellTabsService>();
MainWindow = _host.Services.GetRequiredService<Ui.Windows.MainWindow>();
ChatLogWindow = _host.Services.GetRequiredService<ChatLogWindow>(); ChatLogWindow = _host.Services.GetRequiredService<ChatLogWindow>();
SettingsWindow = _host.Services.GetRequiredService<SettingsWindow>(); SettingsWindow = _host.Services.GetRequiredService<SettingsWindow>();
DbViewer = _host.Services.GetRequiredService<DbViewer>(); DbViewer = _host.Services.GetRequiredService<DbViewer>();
@@ -744,14 +747,15 @@ public sealed class Plugin : IAsyncDalamudPlugin
// have working entry points before they're constructed. // have working entry points before they're constructed.
private void SetupCommands() private void SetupCommands()
{ {
// ChatLogWindow.cs:128 already registers /hellion (ToggleChat). The
// description-arg here keeps the Dalamud help list populated.
_hellionSettingsCmd = Commands.Register( _hellionSettingsCmd = Commands.Register(
"/hellion", "/hellion",
"Perform various actions with Hellion Chat." "Toggle Hellion Chat. /hellion settings opens settings, /hellion reset restores the default theme."
); );
_hellionSettingsCmd.Execute += OnHellionSettingsCommand; _hellionSettingsCmd.Execute += OnHellionSettingsCommand;
_clearHellionCmd = Commands.Register("/clearhellion", "Clear the active Hellion Chat tab.");
_clearHellionCmd.Execute += OnClearHellionCommand;
_hellionViewCmd = Commands.Register( _hellionViewCmd = Commands.Register(
"/hellionView", "/hellionView",
"Get access to your message history, with simple filter options.", "Get access to your message history, with simple filter options.",
@@ -788,6 +792,12 @@ public sealed class Plugin : IAsyncDalamudPlugin
_hellionSettingsCmd = null; _hellionSettingsCmd = null;
} }
if (_clearHellionCmd is not null)
{
_clearHellionCmd.Execute -= OnClearHellionCommand;
_clearHellionCmd = null;
}
if (_hellionViewCmd is not null) if (_hellionViewCmd is not null)
{ {
_hellionViewCmd.Execute -= OnHellionViewCommand; _hellionViewCmd.Execute -= OnHellionViewCommand;
@@ -810,10 +820,29 @@ public sealed class Plugin : IAsyncDalamudPlugin
private void OnHellionSettingsCommand(string command, string arguments) private void OnHellionSettingsCommand(string command, string arguments)
{ {
// /hellion with args is intentionally a no-op (matches pre-v1.4.9 var arg = arguments.Trim();
// Settings.cs:76-80 behaviour). if (string.IsNullOrEmpty(arg))
if (string.IsNullOrWhiteSpace(arguments)) {
MainWindow.Toggle();
return;
}
if (arg.Equals("settings", StringComparison.OrdinalIgnoreCase))
{
SettingsWindow.Toggle(); SettingsWindow.Toggle();
return;
}
if (arg.Equals("reset", StringComparison.OrdinalIgnoreCase))
{
// Recovery path documented in the v2.x master spec — drops a
// broken custom theme out of the loader cache without touching
// the user's JSON on disk.
ThemeRegistry.SwitchSilent(Themes.ThemeRegistry.DefaultSlug);
}
}
private void OnClearHellionCommand(string command, string arguments)
{
MainWindow.ActiveTab?.Clear();
} }
private void OnOpenConfigUi() => SettingsWindow.Toggle(); private void OnOpenConfigUi() => SettingsWindow.Toggle();
-11
View File
@@ -42,8 +42,6 @@ public sealed class ChatLogWindow : Window
internal Plugin Plugin { get; } internal Plugin Plugin { get; }
private readonly CommandWrapper _clearHellionCommand;
private readonly CommandWrapper _hellionCommand;
private readonly SymbolPicker _symbolPicker; private readonly SymbolPicker _symbolPicker;
internal bool ScreenshotMode; internal bool ScreenshotMode;
@@ -142,13 +140,6 @@ public sealed class ChatLogWindow : Window
// Cache wrapper instances so Dispose can detach the same event objects // Cache wrapper instances so Dispose can detach the same event objects
// without going through Register() again. // without going through Register() again.
_clearHellionCommand = Plugin.Commands.Register(
"/clearhellion",
"Clear the Hellion Chat log"
);
_hellionCommand = Plugin.Commands.Register("/hellion");
_clearHellionCommand.Execute += ClearLog;
_hellionCommand.Execute += ToggleChat;
_symbolPicker = new SymbolPicker(); _symbolPicker = new SymbolPicker();
@@ -181,8 +172,6 @@ public sealed class ChatLogWindow : Window
); );
Plugin.ClientState.Logout -= Logout; Plugin.ClientState.Logout -= Logout;
Plugin.ClientState.Login -= Login; Plugin.ClientState.Login -= Login;
_hellionCommand.Execute -= ToggleChat;
_clearHellionCommand.Execute -= ClearLog;
} }
private void Logout(int _, int __) private void Logout(int _, int __)