@@ -103,9 +103,18 @@ private bool KeybindsProvider_OnKeyDown(string arg)
103103 }
104104 else
105105 {
106+ // We need to make sure some key combinations make it into the game no matter what
106107 Task . Run ( async ( ) =>
107108 {
108- await task ;
109+ var result = await task ;
110+
111+ if ( ! result )
112+ {
113+ Enabled = false ;
114+ keybindsProvider . PressKey ( arg ) ;
115+ await Task . Delay ( 200 ) ;
116+ }
117+
109118 Enabled = true ;
110119 } ) ;
111120 }
@@ -119,10 +128,7 @@ private void ExecuteCustomChat(CustomChatSetting customChatSetting, string input
119128 {
120129 logger . LogInformation ( $ "Keybind detected: { customChatSetting . Key } ! Executing the custom chat command '{ customChatSetting . ChatCommand } '") ;
121130
122- var task = mediator . Send ( new CustomChatCommand ( customChatSetting . ChatCommand ) ) ;
123-
124- GetKeybindTask ( customChatSetting . Key , input , task ) ;
125- returnTask = task ;
131+ returnTask = mediator . Send ( new CustomChatCommand ( customChatSetting . ChatCommand ) ) ;
126132 }
127133 }
128134
@@ -135,7 +141,6 @@ private void ExecuteKeybind<TCommand>(string keybind, string input, ref Task<boo
135141
136142 var task = mediator . Send ( new TCommand ( ) ) ;
137143
138- GetKeybindTask ( keybind , input , task ) ;
139144 if ( returnTask == null )
140145 {
141146 returnTask = task ;
@@ -152,24 +157,6 @@ private void ExecuteKeybind<TCommand>(string keybind, string input, ref Task<boo
152157 }
153158 }
154159
155- private void GetKeybindTask ( string keybind , string input , Task < bool > task )
156- {
157- // We need to make sure some key combinations make it into the game no matter what
158- if ( task != null && input == keybind )
159- {
160- Task . Run ( async ( ) =>
161- {
162- if ( ! await task )
163- {
164- Enabled = false ;
165- keybindsProvider . PressKey ( keybind ) ;
166- await Task . Delay ( 200 ) ;
167- Enabled = true ;
168- }
169- } ) ;
170- }
171- }
172-
173160 public void Dispose ( )
174161 {
175162 Dispose ( true ) ;
0 commit comments