mirror of
https://github.com/xivdev/Penumbra.git
synced 2025-12-13 20:24:17 +01:00
Run command registration on framework.
This commit is contained in:
parent
348da38879
commit
c958935f40
2 changed files with 12 additions and 9 deletions
|
|
@ -1,6 +1,7 @@
|
||||||
using System;
|
using System;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Runtime.CompilerServices;
|
using System.Runtime.CompilerServices;
|
||||||
|
using Dalamud.Game;
|
||||||
using Dalamud.Game.Command;
|
using Dalamud.Game.Command;
|
||||||
using Dalamud.Game.Text.SeStringHandling;
|
using Dalamud.Game.Text.SeStringHandling;
|
||||||
using ImGuiNET;
|
using ImGuiNET;
|
||||||
|
|
@ -66,7 +67,8 @@ public class CommandHandler : IDisposable
|
||||||
private readonly Mod.Manager _modManager;
|
private readonly Mod.Manager _modManager;
|
||||||
private readonly ModCollection.Manager _collectionManager;
|
private readonly ModCollection.Manager _collectionManager;
|
||||||
|
|
||||||
public CommandHandler( CommandManager commandManager, ObjectReloader objectReloader, Configuration config, Penumbra penumbra, ConfigWindow configWindow, Mod.Manager modManager,
|
public CommandHandler( Framework framework, CommandManager commandManager, ObjectReloader objectReloader, Configuration config, Penumbra penumbra, ConfigWindow configWindow,
|
||||||
|
Mod.Manager modManager,
|
||||||
ModCollection.Manager collectionManager, ActorManager actors )
|
ModCollection.Manager collectionManager, ActorManager actors )
|
||||||
{
|
{
|
||||||
_commandManager = commandManager;
|
_commandManager = commandManager;
|
||||||
|
|
@ -77,17 +79,18 @@ public class CommandHandler : IDisposable
|
||||||
_modManager = modManager;
|
_modManager = modManager;
|
||||||
_collectionManager = collectionManager;
|
_collectionManager = collectionManager;
|
||||||
_actors = actors;
|
_actors = actors;
|
||||||
_commandManager.AddHandler( CommandName, new CommandInfo( OnCommand )
|
framework.RunOnFrameworkThread( () =>
|
||||||
{
|
{
|
||||||
HelpMessage = "Without arguments, toggles the main window. Use /penumbra help to get further command help.",
|
_commandManager.AddHandler( CommandName, new CommandInfo( OnCommand )
|
||||||
ShowInHelp = true,
|
{
|
||||||
|
HelpMessage = "Without arguments, toggles the main window. Use /penumbra help to get further command help.",
|
||||||
|
ShowInHelp = true,
|
||||||
|
} );
|
||||||
} );
|
} );
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Dispose()
|
public void Dispose()
|
||||||
{
|
=> _commandManager.RemoveHandler( CommandName );
|
||||||
_commandManager.RemoveHandler( CommandName );
|
|
||||||
}
|
|
||||||
|
|
||||||
private void OnCommand( string command, string arguments )
|
private void OnCommand( string command, string arguments )
|
||||||
{
|
{
|
||||||
|
|
@ -586,7 +589,7 @@ public class CommandHandler : IDisposable
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void Print( Func<SeString> text )
|
private static void Print( Func< SeString > text )
|
||||||
{
|
{
|
||||||
if( Penumbra.Config.PrintSuccessfulCommandsToChat )
|
if( Penumbra.Config.PrintSuccessfulCommandsToChat )
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -186,7 +186,7 @@ public class Penumbra : IDalamudPlugin
|
||||||
};
|
};
|
||||||
var btn = new LaunchButton( cfg );
|
var btn = new LaunchButton( cfg );
|
||||||
var system = new WindowSystem( Name );
|
var system = new WindowSystem( Name );
|
||||||
var cmd = new CommandHandler( Dalamud.Commands, ObjectReloader, Config, this, cfg, ModManager, CollectionManager, Actors );
|
var cmd = new CommandHandler( Dalamud.Framework, Dalamud.Commands, ObjectReloader, Config, this, cfg, ModManager, CollectionManager, Actors );
|
||||||
system.AddWindow( cfg );
|
system.AddWindow( cfg );
|
||||||
system.AddWindow( cfg.ModEditPopup );
|
system.AddWindow( cfg.ModEditPopup );
|
||||||
system.AddWindow( changelog );
|
system.AddWindow( changelog );
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue