@@ -288,17 +288,16 @@ private async Task VotingAsync(CancellationToken stoppingToken, bool manualVote
288288 }
289289
290290 if ( _configuration . VoteEnabled || manualVote )
291- _entryCarManager . BroadcastPacket ( new ChatMessage { SessionId = 255 , Message = "Vote for next track:" } ) ;
291+ _entryCarManager . BroadcastChat ( "Vote for next track:" ) ;
292292
293293 // Add "Stay on current track"
294294 if ( _configuration . IncludeStayOnTrackVote )
295295 {
296296 _availablePresets . Add ( new PresetChoice { Preset = last . Type , Votes = 0 } ) ;
297297 if ( _configuration . VoteEnabled || manualVote )
298- _entryCarManager . BroadcastPacket ( new ChatMessage
299- { SessionId = 255 , Message = $ " /vt 0 - Stay on current track." } ) ;
300-
301-
298+ {
299+ _entryCarManager . BroadcastChat ( " /vt 0 - Stay on current track." ) ;
300+ }
302301 }
303302 for ( int i = _availablePresets . Count ; i < _configuration . VoteChoices ; i ++ )
304303 {
@@ -309,8 +308,9 @@ private async Task VotingAsync(CancellationToken stoppingToken, bool manualVote
309308 presetsLeft . Remove ( nextPreset ) ;
310309
311310 if ( _configuration . VoteEnabled || manualVote )
312- _entryCarManager . BroadcastPacket ( new ChatMessage
313- { SessionId = 255 , Message = $ " /vt { i } - { nextPreset . Name } " } ) ;
311+ {
312+ _entryCarManager . BroadcastChat ( $ " /vt { i } - { nextPreset . Name } ") ;
313+ }
314314 }
315315
316316 // Wait for the vote to finish
@@ -327,23 +327,14 @@ private async Task VotingAsync(CancellationToken stoppingToken, bool manualVote
327327
328328 if ( last . Type ! . Equals ( winner . Preset ! ) || ( maxVotes == 0 && ! _configuration . ChangePresetWithoutVotes ) )
329329 {
330- _entryCarManager . BroadcastPacket ( new ChatMessage
331- {
332- SessionId = 255 ,
333- Message = $ "Track vote ended. Staying on track for { _configuration . VotingIntervalMinutes } more minutes."
334- } ) ;
330+ _entryCarManager . BroadcastChat ( $ "Track vote ended. Staying on track for { _configuration . VotingIntervalMinutes } more minutes.") ;
335331 }
336332 else
337333 {
338- _entryCarManager . BroadcastPacket ( new ChatMessage
339- { SessionId = 255 , Message = $ "Track vote ended. Next track: { winner . Preset ! . Name } - { winner . Votes } votes" } ) ;
340- _entryCarManager . BroadcastPacket ( new ChatMessage
341- {
342- SessionId = 255 ,
343- Message = $ "Track will change in { ( _configuration . DelayTransitionDurationSeconds < 60 ?
334+ _entryCarManager . BroadcastChat ( $ "Track vote ended. Next track: { winner . Preset ! . Name } - { winner . Votes } votes") ;
335+ _entryCarManager . BroadcastChat ( $ "Track will change in { ( _configuration . DelayTransitionDurationSeconds < 60 ?
344336 $ "{ _configuration . DelayTransitionDurationSeconds } second(s)" :
345- $ "{ ( int ) Math . Ceiling ( _configuration . DelayTransitionDurationSeconds / 60.0 ) } minute(s)") } ."
346- } ) ;
337+ $ "{ ( int ) Math . Ceiling ( _configuration . DelayTransitionDurationSeconds / 60.0 ) } minute(s)") } ." ) ;
347338
348339 // Delay the preset switch by configured time delay
349340 await Task . Delay ( _configuration . DelayTransitionDurationMilliseconds , stoppingToken ) ;
@@ -362,15 +353,10 @@ private async Task AdminPreset(PresetData preset)
362353 {
363354 if ( preset . Type ! . Equals ( preset . UpcomingType ! ) ) return ;
364355 Log . Information ( "Next preset: {Preset}" , preset . UpcomingType ! . Name ) ;
365- _entryCarManager . BroadcastPacket ( new ChatMessage
366- { SessionId = 255 , Message = $ "Next track: { preset . UpcomingType ! . Name } " } ) ;
367- _entryCarManager . BroadcastPacket ( new ChatMessage
368- {
369- SessionId = 255 ,
370- Message = $ "Track will change in { ( _configuration . DelayTransitionDurationSeconds < 60 ?
356+ _entryCarManager . BroadcastChat ( $ "Next track: { preset . UpcomingType ! . Name } ") ;
357+ _entryCarManager . BroadcastChat ( $ "Track will change in { ( _configuration . DelayTransitionDurationSeconds < 60 ?
371358 $ "{ _configuration . DelayTransitionDurationSeconds } second(s)" :
372- $ "{ ( int ) Math . Ceiling ( _configuration . DelayTransitionDurationSeconds / 60.0 ) } minute(s)") } ."
373- } ) ;
359+ $ "{ ( int ) Math . Ceiling ( _configuration . DelayTransitionDurationSeconds / 60.0 ) } minute(s)") } ." ) ;
374360
375361 // Delay the preset switch by configured time delay
376362 await Task . Delay ( _configuration . DelayTransitionDurationMilliseconds ) ;
0 commit comments