File tree Expand file tree Collapse file tree 5 files changed +18
-8
lines changed
Expand file tree Collapse file tree 5 files changed +18
-8
lines changed Original file line number Diff line number Diff line change 11using CounterStrikeSharp . API . Core ;
22using CounterStrikeSharp . API . Core . Attributes ;
33using CustomCommands . Interfaces ;
4- using CustomCommands . Services ;
54using Microsoft . Extensions . Logging ;
65
76namespace CustomCommands ;
@@ -10,7 +9,7 @@ namespace CustomCommands;
109public partial class CustomCommands : BasePlugin , IPluginConfig < CustomCommandsConfig >
1110{
1211 public override string ModuleName => "CustomCommands" ;
13- public override string ModuleVersion => "1.0.9 " ;
12+ public override string ModuleVersion => "1.1.0 " ;
1413 public override string ModuleAuthor => "HerrMagic" ;
1514 public override string ModuleDescription => "Create your own commands per config" ;
1615
@@ -60,6 +59,8 @@ public override void Load(bool hotReload)
6059
6160 if ( comms != null )
6261 {
62+ PluginGlobals . CustomCommands = comms ;
63+
6364 comms = RegisterCommands . CheckForDuplicateCommands ( comms ) ;
6465 // Add commands from the JSON file to the server
6566 foreach ( var com in comms )
Original file line number Diff line number Diff line change @@ -8,4 +8,5 @@ public interface IPluginGlobals
88 CenterServerElement centerServerOn { get ; set ; }
99 CustomCommandsConfig Config { get ; set ; }
1010 List < CooldownTimer > CooldownTimer { get ; set ; }
11+ List < Commands > CustomCommands { get ; set ; }
1112}
Original file line number Diff line number Diff line change @@ -8,4 +8,5 @@ public class PluginGlobals : IPluginGlobals
88 public CenterServerElement centerServerOn { get ; set ; } = new ( ) ;
99 public CustomCommandsConfig Config { get ; set ; } = new ( ) ;
1010 public List < CooldownTimer > CooldownTimer { get ; set ; } = new ( ) ;
11+ public List < Commands > CustomCommands { get ; set ; } = new ( ) ;
1112}
Original file line number Diff line number Diff line change @@ -37,17 +37,23 @@ public void AddCommands(Commands com)
3737 {
3838 if ( player == null ) return ;
3939
40- if ( com . Permission . PermissionList . Count > 0 && com . Permission != null )
41- if ( ! PluginUtilities . RequiresPermissions ( player , com . Permission ) )
40+ var command = com ;
41+ if ( info . ArgCount > 0 )
42+ {
43+ command = PluginGlobals . CustomCommands . Find ( x => x . Command . Contains ( aliases [ i ] ) ) ?? com ;
44+ }
45+
46+ if ( command . Permission . PermissionList . Count > 0 && command . Permission != null )
47+ if ( ! PluginUtilities . RequiresPermissions ( player , command . Permission ) )
4248 return ;
4349
44- if ( CooldownManager . IsCommandOnCooldown ( player , com ) ) return ;
50+ if ( CooldownManager . IsCommandOnCooldown ( player , command ) ) return ;
4551
46- CooldownManager . SetCooldown ( player , com ) ;
52+ CooldownManager . SetCooldown ( player , command ) ;
4753
48- MessageManager . SendMessage ( player , com ) ;
54+ MessageManager . SendMessage ( player , command ) ;
4955
50- PluginUtilities . ExecuteServerCommands ( com , player ) ;
56+ PluginUtilities . ExecuteServerCommands ( command , player ) ;
5157 } ) ;
5258 }
5359 }
Original file line number Diff line number Diff line change 55* [ ] check if the string pattern check works
66* [ ] check cooldown funktion for normal int and than object
77* [ ] check if padleft color tag works now
8+ * [ ] check if command args works
You can’t perform that action at this time.
0 commit comments