@@ -24,38 +24,20 @@ public static void EWChatActivity(string sMessage, string sColor, Item ItemTest,
2424
2525 if ( ! ( AbilityTest == null || ItemTest . Chat || AbilityTest . Chat_Uses ) ) return ;
2626
27- Task . Run ( ( ) =>
28- {
29- Parallel . ForEach ( EW . g_EWPlayer , ( pair ) =>
30- {
31- Server . NextFrame ( ( ) =>
32- {
33- if ( ! ( pair . Key is { IsValid : true , IsBot : false , IsHLTV : false } ) || ! EW . g_EWPlayer . ContainsKey ( pair . Key ) ) return ;
34-
35- if ( Cvar . TeamOnly && pair . Key . TeamNum > 1 && ItemTest . Team != pair . Key . TeamNum && ( ! AdminManager . PlayerHasPermissions ( pair . Key , "@css/ew_chat" ) || Cvar . AdminChat == 2 || ( Cvar . AdminChat == 1 && AbilityTest != null ) ) ) return ;
36-
37- using ( new WithTemporaryCulture ( pair . Key . GetLanguage ( ) ) )
38- {
39- pair . Key . PrintToChat ( EWChatMessage ( $ "{ PlayerInfo ( pair . Key , sPlayerInfoFormat ) } { sColor } { EntWatchSharp . Strlocalizer [ sMessage ] } { ItemTest . Color } { ItemTest . Name } { ( ( AbilityTest != null && ! string . IsNullOrEmpty ( AbilityTest . Name ) ) ? $ " ({ AbilityTest . Name } )" : "" ) } ") ) ;
40- }
41- } ) ;
42- } ) ;
43- } ) ;
44-
45- /*Utilities.GetPlayers().Where(p => p is { IsValid: true, IsBot: false, IsHLTV: false }).ToList().ForEach(pl =>
27+ foreach ( var pair in EW . g_EWPlayer )
4628 {
4729 Server . NextFrame ( ( ) =>
4830 {
49- if (!pl. IsValid || !EW.g_EWPlayer.ContainsKey(pl )) return;
31+ if ( ! ( pair . Key is { IsValid : true , IsBot : false , IsHLTV : false } ) || ! EW . g_EWPlayer . ContainsKey ( pair . Key ) ) return ;
5032
51- if (Cvar.TeamOnly && pl. TeamNum > 1 && ItemTest.Team != pl. TeamNum && (!AdminManager.PlayerHasPermissions(pl , "@css/ew_chat") || Cvar.AdminChat == 2 || (Cvar.AdminChat == 1 && AbilityTest != null))) return;
33+ if ( Cvar . TeamOnly && pair . Key . TeamNum > 1 && ItemTest . Team != pair . Key . TeamNum && ( ! AdminManager . PlayerHasPermissions ( pair . Key , "@css/ew_chat" ) || Cvar . AdminChat == 2 || ( Cvar . AdminChat == 1 && AbilityTest != null ) ) ) return ;
5234
53- using (new WithTemporaryCulture(pl .GetLanguage()))
35+ using ( new WithTemporaryCulture ( pair . Key . GetLanguage ( ) ) )
5436 {
55- pl. PrintToChat(EWChatMessage($"{PlayerInfo(pl , sPlayerInfoFormat)} {sColor}{EntWatchSharp.Strlocalizer[sMessage]} {ItemTest.Color}{ItemTest.Name}{((AbilityTest != null && !string.IsNullOrEmpty(AbilityTest.Name)) ? $" ({AbilityTest.Name})" : "")}"));
37+ pair . Key . PrintToChat ( EWChatMessage ( $ "{ PlayerInfo ( pair . Key , sPlayerInfoFormat ) } { sColor } { EntWatchSharp . Strlocalizer [ sMessage ] } { ItemTest . Color } { ItemTest . Name } { ( ( AbilityTest != null && ! string . IsNullOrEmpty ( AbilityTest . Name ) ) ? $ " ({ AbilityTest . Name } )" : "" ) } ") ) ;
5638 }
5739 } ) ;
58- });*/
40+ }
5941 }
6042 public static void EWChatAdminBan ( string [ ] sPIF_admin , string [ ] sPIF_player , string sReason , bool bAction )
6143 {
@@ -73,32 +55,18 @@ public static void EWChatAdminBan(string[] sPIF_admin, string[] sPIF_player, str
7355 LogManager . AdminAction ( "Chat.Admin.Reason" , EW . g_Scheme . color_warning , sReason ) ;
7456 } ) ;
7557
76- Task . Run ( ( ) =>
77- {
78- Parallel . ForEach ( EW . g_EWPlayer , ( pair ) =>
79- {
80- Server . NextFrame ( ( ) =>
81- {
82- if ( ! ( pair . Key is { IsValid : true , IsBot : false , IsHLTV : false } ) ) return ;
83- using ( new WithTemporaryCulture ( pair . Key . GetLanguage ( ) ) )
84- {
85- pair . Key . PrintToChat ( EWChatMessage ( EntWatchSharp . Strlocalizer [ bAction ? "Chat.Admin.Restricted" : "Chat.Admin.Unrestricted" , EW . g_Scheme . color_warning , PlayerInfo ( pair . Key , sPIF_admin ) , bAction ? EW . g_Scheme . color_disabled : EW . g_Scheme . color_enabled , PlayerInfo ( pair . Key , sPIF_player ) ] ) ) ;
86- pair . Key . PrintToChat ( EWChatMessage ( EntWatchSharp . Strlocalizer [ "Chat.Admin.Reason" , EW . g_Scheme . color_warning , sReason ] ) ) ;
87- }
88- } ) ;
89- } ) ;
90- } ) ;
91- /*Utilities.GetPlayers().Where(p => p is { IsValid: true, IsBot: false, IsHLTV: false }).ToList().ForEach(pl =>
58+ foreach ( var pair in EW . g_EWPlayer )
9259 {
9360 Server . NextFrame ( ( ) =>
9461 {
95- using (new WithTemporaryCulture(pl.GetLanguage()))
62+ if ( ! ( pair . Key is { IsValid : true , IsBot : false , IsHLTV : false } ) ) return ;
63+ using ( new WithTemporaryCulture ( pair . Key . GetLanguage ( ) ) )
9664 {
97- pl. PrintToChat(EWChatMessage(EntWatchSharp.Strlocalizer[bAction ? "Chat.Admin.Restricted" : "Chat.Admin.Unrestricted", EW.g_Scheme.color_warning, PlayerInfo(pl , sPIF_admin), bAction ? EW.g_Scheme.color_disabled : EW.g_Scheme.color_enabled, PlayerInfo(pl , sPIF_player)]));
98- pl .PrintToChat(EWChatMessage(EntWatchSharp.Strlocalizer["Chat.Admin.Reason", EW.g_Scheme.color_warning, sReason]));
65+ pair . Key . PrintToChat ( EWChatMessage ( EntWatchSharp . Strlocalizer [ bAction ? "Chat.Admin.Restricted" : "Chat.Admin.Unrestricted" , EW . g_Scheme . color_warning , PlayerInfo ( pair . Key , sPIF_admin ) , bAction ? EW . g_Scheme . color_disabled : EW . g_Scheme . color_enabled , PlayerInfo ( pair . Key , sPIF_player ) ] ) ) ;
66+ pair . Key . PrintToChat ( EWChatMessage ( EntWatchSharp . Strlocalizer [ "Chat.Admin.Reason" , EW . g_Scheme . color_warning , sReason ] ) ) ;
9967 }
10068 } ) ;
101- });*/
69+ }
10270 } ) ;
10371 }
10472 public static void EWChatAdminSpawn ( string [ ] sPIF_admin , string [ ] sPIF_receiver , string sItem )
@@ -115,30 +83,17 @@ public static void EWChatAdminSpawn(string[] sPIF_admin, string[] sPIF_receiver,
11583 LogManager . AdminAction ( "Reply.Spawn.Notify" , sPIF_admin [ 3 ] , sItem , sPIF_receiver [ 3 ] ) ;
11684 } ) ;
11785
118- Task . Run ( ( ) =>
119- {
120- Parallel . ForEach ( EW . g_EWPlayer , ( pair ) =>
121- {
122- Server . NextFrame ( ( ) =>
123- {
124- if ( ! ( pair . Key is { IsValid : true , IsBot : false , IsHLTV : false } ) ) return ;
125- using ( new WithTemporaryCulture ( pair . Key . GetLanguage ( ) ) )
126- {
127- pair . Key . PrintToChat ( EWChatMessage ( EntWatchSharp . Strlocalizer [ "Reply.Spawn.Notify" , PlayerInfo ( pair . Key , sPIF_admin ) , sItem , PlayerInfo ( pair . Key , sPIF_receiver ) ] ) ) ;
128- }
129- } ) ;
130- } ) ;
131- } ) ;
132- /*Utilities.GetPlayers().Where(p => p is { IsValid: true, IsBot: false, IsHLTV: false }).ToList().ForEach(pl =>
86+ foreach ( var pair in EW . g_EWPlayer )
13387 {
13488 Server . NextFrame ( ( ) =>
13589 {
136- using (new WithTemporaryCulture(pl.GetLanguage()))
90+ if ( ! ( pair . Key is { IsValid : true , IsBot : false , IsHLTV : false } ) ) return ;
91+ using ( new WithTemporaryCulture ( pair . Key . GetLanguage ( ) ) )
13792 {
138- pl. PrintToChat(EWChatMessage(EntWatchSharp.Strlocalizer["Reply.Spawn.Notify", PlayerInfo(pl , sPIF_admin), sItem, PlayerInfo(pl , sPIF_receiver)]));
93+ pair . Key . PrintToChat ( EWChatMessage ( EntWatchSharp . Strlocalizer [ "Reply.Spawn.Notify" , PlayerInfo ( pair . Key , sPIF_admin ) , sItem , PlayerInfo ( pair . Key , sPIF_receiver ) ] ) ) ;
13994 }
14095 } ) ;
141- });*/
96+ }
14297 } ) ;
14398 }
14499 public static void EWChatAdminTransfer ( string [ ] sPIF_admin , string [ ] sPIF_receiver , string sItem , string [ ] sPIF_target )
@@ -154,31 +109,18 @@ public static void EWChatAdminTransfer(string[] sPIF_admin, string[] sPIF_receiv
154109 {
155110 LogManager . AdminAction ( "Reply.Transfer.Notify" , sPIF_admin [ 3 ] , sItem , sPIF_target [ 3 ] , sPIF_receiver [ 3 ] ) ;
156111 } ) ;
157-
158- Task . Run ( ( ) =>
159- {
160- Parallel . ForEach ( EW . g_EWPlayer , ( pair ) =>
161- {
162- Server . NextFrame ( ( ) =>
163- {
164- if ( ! ( pair . Key is { IsValid : true , IsBot : false , IsHLTV : false } ) ) return ;
165- using ( new WithTemporaryCulture ( pair . Key . GetLanguage ( ) ) )
166- {
167- pair . Key . PrintToChat ( EWChatMessage ( EntWatchSharp . Strlocalizer [ "Reply.Transfer.Notify" , PlayerInfo ( pair . Key , sPIF_admin ) , sItem , PlayerInfo ( pair . Key , sPIF_target ) , PlayerInfo ( pair . Key , sPIF_receiver ) ] ) ) ;
168- }
169- } ) ;
170- } ) ;
171- } ) ;
172- /*Utilities.GetPlayers().Where(p => p is { IsValid: true, IsBot: false, IsHLTV: false }).ToList().ForEach(pl =>
112+
113+ foreach ( var pair in EW . g_EWPlayer )
173114 {
174115 Server . NextFrame ( ( ) =>
175116 {
176- using (new WithTemporaryCulture(pl.GetLanguage()))
117+ if ( ! ( pair . Key is { IsValid : true , IsBot : false , IsHLTV : false } ) ) return ;
118+ using ( new WithTemporaryCulture ( pair . Key . GetLanguage ( ) ) )
177119 {
178- pl. PrintToChat(EWChatMessage(EntWatchSharp.Strlocalizer["Reply.Transfer.Notify", PlayerInfo(pl , sPIF_admin), sItem, PlayerInfo(pl , sPIF_target), PlayerInfo(pl , sPIF_receiver)]));
120+ pair . Key . PrintToChat ( EWChatMessage ( EntWatchSharp . Strlocalizer [ "Reply.Transfer.Notify" , PlayerInfo ( pair . Key , sPIF_admin ) , sItem , PlayerInfo ( pair . Key , sPIF_target ) , PlayerInfo ( pair . Key , sPIF_receiver ) ] ) ) ;
179121 }
180122 } ) ;
181- });*/
123+ }
182124 } ) ;
183125 }
184126
@@ -216,30 +158,17 @@ public static void CvarChangeNotify(string sCvarName, string sCvarValue, bool bC
216158
217159 if ( bClientNotify )
218160 {
219- Task . Run ( ( ) =>
220- {
221- Parallel . ForEach ( EW . g_EWPlayer , ( pair ) =>
222- {
223- Server . NextFrame ( ( ) =>
224- {
225- if ( ! ( pair . Key is { IsValid : true , IsBot : false , IsHLTV : false } ) ) return ;
226- using ( new WithTemporaryCulture ( pair . Key . GetLanguage ( ) ) )
227- {
228- pair . Key . PrintToChat ( EWChatMessage ( $ "{ EW . g_Scheme . color_warning } { EntWatchSharp . Strlocalizer [ "Cvar.Notify" , sCvarName , sCvarValue ] } ") ) ;
229- }
230- } ) ;
231- } ) ;
232- } ) ;
233- /*Utilities.GetPlayers().Where(p => p is { IsValid: true, IsBot: false, IsHLTV: false }).ToList().ForEach(pl =>
161+ foreach ( var pair in EW . g_EWPlayer )
234162 {
235163 Server . NextFrame ( ( ) =>
236164 {
237- using (new WithTemporaryCulture(pl.GetLanguage()))
165+ if ( ! ( pair . Key is { IsValid : true , IsBot : false , IsHLTV : false } ) ) return ;
166+ using ( new WithTemporaryCulture ( pair . Key . GetLanguage ( ) ) )
238167 {
239- pl .PrintToChat(EWChatMessage($"{EW.g_Scheme.color_warning}{EntWatchSharp.Strlocalizer["Cvar.Notify", sCvarName, sCvarValue]}"));
168+ pair . Key . PrintToChat ( EWChatMessage ( $ "{ EW . g_Scheme . color_warning } { EntWatchSharp . Strlocalizer [ "Cvar.Notify" , sCvarName , sCvarValue ] } ") ) ;
240169 }
241170 } ) ;
242- });*/
171+ }
243172 }
244173 }
245174
0 commit comments