@@ -91,7 +91,8 @@ private void AddCommands(Commands com)
9191 if ( ! RequiresPermissions ( player , com . Permission ) )
9292 return ;
9393
94- TriggerMessage ( player , com ) ;
94+ SendMessage ( player , com ) ;
95+
9596 ExecuteServerCommands ( com ) ;
9697 } ) ;
9798 }
@@ -129,7 +130,8 @@ private void ExecuteServerCommands(Commands cmd)
129130 Server . ExecuteCommand ( serverCommand ) ;
130131 }
131132 }
132- private void TriggerMessage ( CCSPlayerController player , Commands cmd )
133+
134+ private void SendMessage ( CCSPlayerController player , Commands cmd )
133135 {
134136 switch ( cmd . PrintTo )
135137 {
@@ -161,6 +163,7 @@ private void TriggerMessage(CCSPlayerController player, Commands cmd)
161163 break ;
162164 }
163165 }
166+
164167 private string [ ] WrappedLine ( dynamic input )
165168 {
166169 List < string > output = new List < string > ( ) ;
@@ -194,76 +197,4 @@ private string[] WrappedLine(dynamic input)
194197
195198 return output . ToArray ( ) ;
196199 }
197-
198- private string [ ] ReplaceTags ( string [ ] input , CCSPlayerController player )
199- {
200- string [ ] output = new string [ input . Length ] ;
201-
202- for ( int i = 0 ; i < input . Length ; i ++ )
203- {
204- output [ i ] = ReplaceMessageTags ( input [ i ] , player ) ;
205- output [ i ] = ReplaceColorTags ( output [ i ] ) ;
206- }
207-
208- return output ;
209- }
210-
211- private string ReplaceMessageTags ( string input , CCSPlayerController player )
212- {
213- SteamID steamId = new SteamID ( player . SteamID ) ;
214-
215- Dictionary < string , string > replacements = new ( )
216- {
217- { "{PREFIX}" , PrefixCache ?? "<PREFIX not found>" } ,
218- { "{MAP}" , NativeAPI . GetMapName ( ) ?? "<MAP not found>" } ,
219- { "{TIME}" , DateTime . Now . ToString ( "HH:mm:ss" ) ?? "<TIME not found>" } ,
220- { "{DATE}" , DateTime . Now . ToString ( "dd.MM.yyyy" ) ?? "<DATE not found>" } ,
221- { "{PLAYERNAME}" , player . PlayerName ?? "<PLAYERNAME not found>" } ,
222- { "{STEAMID2}" , steamId . SteamId2 ?? "<STEAMID2 not found>" } ,
223- { "{STEAMID3}" , steamId . SteamId3 ?? "<STEAMID3 not found>" } ,
224- { "{STEAMID32}" , steamId . SteamId32 . ToString ( ) ?? "<STEAMID32 not found>" } ,
225- { "{STEAMID64}" , steamId . SteamId64 . ToString ( ) ?? "<STEAMID64 not found>" } ,
226- { "{SERVERNAME}" , ConVar . Find ( "hostname" ) ! . StringValue ?? "<SERVERNAME not found>" } ,
227- { "{IP}" , ConVar . Find ( "ip" ) ! . StringValue ?? "<IP not found>" } ,
228- { "{PORT}" , ConVar . Find ( "hostport" ) ! . GetPrimitiveValue < int > ( ) . ToString ( ) ?? "<PORT not found>" } ,
229- { "{MAXPLAYERS}" , Server . MaxPlayers . ToString ( ) ?? "<MAXPLAYERS not found>" } ,
230- { "{PLAYERS}" ,
231- Utilities . GetPlayers ( ) . Count ( u => u . PlayerPawn . Value != null && u . PlayerPawn . Value . IsValid ) . ToString ( ) ?? "<PLAYERS not found>" }
232- } ;
233-
234- foreach ( var pair in replacements )
235- input = input . Replace ( pair . Key , pair . Value ) ;
236-
237- return input ;
238- }
239-
240- private string ReplaceColorTags ( string input )
241- {
242- Dictionary < string , string > replacements = new ( )
243- {
244- { "{DEFAULT}" , "\u0001 " } ,
245- { "{WHITE}" , "\u0001 " } ,
246- { "{DARKRED}" , "\u0002 " } ,
247- { "{RED}" , "\x03 " } ,
248- { "{LIGHTRED}" , "\u000f " } ,
249- { "{GREEN}" , "\u0004 " } ,
250- { "{LIME}" , "\u0006 " } ,
251- { "{OLIVE}" , "\u0005 " } ,
252- { "{ORANGE}" , "\u0010 " } ,
253- { "{GOLD}" , "\u0010 " } ,
254- { "{YELLOW}" , "\t " } ,
255- { "{BLUE}" , "\v " } ,
256- { "{DARKBLUE}" , "\f " } ,
257- { "{LIGHTPURPLE}" , "\u0003 " } ,
258- { "{PURPLE}" , "\u000e " } ,
259- { "{SILVER}" , $ "{ ChatColors . Silver } "} ,
260- { "{BLUEGREY}" , "\x0A " } ,
261- { "{GREY}" , "\x08 " } ,
262- } ;
263-
264- foreach ( var pair in replacements )
265- input = input . Replace ( pair . Key , pair . Value ) ;
266-
267- return input ;
268- }
269200}
0 commit comments