@@ -33,7 +33,7 @@ public class EventHandlers
3333 {
3434 private Plugin plugin ;
3535 private Gamemode CurrentGamemode ;
36- private bool FriendlyFireDefault ;
36+ private bool resetFriendlyFire ;
3737 System . Random rand = new System . Random ( ) ;
3838
3939 public EventHandlers ( Plugin plugin ) => this . plugin = plugin ;
@@ -65,8 +65,8 @@ private IEnumerator<float> DelayedRoundEnd( float delay )
6565 #region Gamemodes
6666 public IEnumerator < float > DodgeBall ( )
6767 {
68- FriendlyFireDefault = ServerConsole . FriendlyFire ;
69- ServerConsole . FriendlyFire = true ;
68+ resetFriendlyFire = Server . FriendlyFire ;
69+ Server . FriendlyFire = true ;
7070 yield return Timing . WaitForSeconds ( 3f ) ;
7171
7272 foreach ( Player ply in Player . List )
@@ -166,8 +166,8 @@ public IEnumerator<float> NightOfTheLivingNerd()
166166 public IEnumerator < float > Randomizer ( )
167167 {
168168 List < Player > PlyList = new List < Player > ( ) ;
169- FriendlyFireDefault = ServerConsole . FriendlyFire ;
170- ServerConsole . FriendlyFire = true ;
169+ resetFriendlyFire = Server . FriendlyFire ;
170+ Server . FriendlyFire = true ;
171171 yield return Timing . WaitForSeconds ( 3f ) ;
172172
173173 RoleTypeId [ ] roles = new RoleTypeId [ ] {
@@ -303,7 +303,16 @@ public void OnRoundStart()
303303 Timing . RunCoroutine ( DelayedRoundEnd ( 900 ) , "DelayedRoundEnd" ) ;
304304 }
305305 }
306-
306+
307+ public void OnWaitingForPlayers ( )
308+ {
309+ if ( resetFriendlyFire )
310+ {
311+ Server . FriendlyFire = false ;
312+ resetFriendlyFire = false ;
313+ }
314+ }
315+
307316 public void OnRoundEnding ( EndingRoundEventArgs ev )
308317 {
309318 // Prevents randomizer round from ending if everyone is on the same team
@@ -327,7 +336,6 @@ public void OnRoundEnd( RoundEndedEventArgs ev )
327336 {
328337 Map . Broadcast ( 6 , string . Format ( plugin . Config . EndText , Plugin . GetGamemodeName ( CurrentGamemode ) ) ) ;
329338 CurrentGamemode = 0 ;
330- ServerConsole . FriendlyFire = FriendlyFireDefault ;
331339 Timing . KillCoroutines ( "DelayedRoundEnd" ) ;
332340 }
333341 }
0 commit comments