Skip to content

Commit 91105c1

Browse files
streamline framework bridge
1 parent 2e5ca04 commit 91105c1

2 files changed

Lines changed: 14 additions & 12 deletions

File tree

Code/Helpers/FrameworkBridge.cs

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -34,17 +34,17 @@ public void Load()
3434
{
3535
_handles.Add(Timing.RunCoroutine(Await(framework)));
3636
}
37+
}
3738

38-
Timing.CallDelayed(3f, () =>
39-
{
40-
Timing.KillCoroutines(_handles.ToArray());
41-
_handles.Clear();
42-
Logger.Info(Found.Count == 0
43-
? "No supported framework was found, no additional methods were added."
44-
: $"SER has added methods for {Found.Count} supported framework(s): " +
45-
$"{Found.Select(f => f.Type.ToString()).JoinStrings(", ")}"
46-
);
47-
});
39+
public void Finish()
40+
{
41+
Timing.KillCoroutines(_handles.ToArray());
42+
_handles.Clear();
43+
Logger.Info(Found.Count == 0
44+
? "No supported framework was found, no additional methods were added."
45+
: $"SER has added methods for {Found.Count} supported framework(s): " +
46+
$"{Found.Select(f => f.Type.ToString()).JoinStrings(", ")}"
47+
);
4848
}
4949

5050
private IEnumerator<float> Await(Framework framework)

Code/Plugin/MainPlugin.cs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ public override void Enable()
112112
fBridge.Load();
113113
SendLogo();
114114

115-
Events.ServerEvents.WaitingForPlayers += OnServerFullyInit;
115+
Events.ServerEvents.WaitingForPlayers += () => OnServerFullyInit(fBridge);
116116
Events.ServerEvents.RoundRestarted += Disable;
117117
Events.PlayerEvents.Joined += OnJoined;
118118

@@ -125,7 +125,7 @@ public override void Disable()
125125
SetPlayerDataMethod.PlayerData.Clear();
126126
}
127127

128-
private void OnServerFullyInit()
128+
private void OnServerFullyInit(FrameworkBridge frameworkBridge)
129129
{
130130
if (!Config.SendInitMessage) return;
131131

@@ -140,6 +140,8 @@ private void OnServerFullyInit()
140140
""",
141141
ConsoleColor.Cyan
142142
);
143+
144+
Timing.CallDelayed(2f, frameworkBridge.Finish);
143145
}
144146

145147
private static void SendLogo()

0 commit comments

Comments
 (0)