Skip to content

Commit 2492424

Browse files
committed
bug: dont send ready up unless were acutally waiting for ready system
1 parent 3a229e0 commit 2492424

File tree

3 files changed

+16
-6
lines changed

3 files changed

+16
-6
lines changed

src/FiveStack.Events/PlayerConnected.cs

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -99,11 +99,14 @@ public HookResult OnPlayerJoinTeam(EventPlayerTeam @event, GameEventInfo info)
9999

100100
CCSPlayerController player = @event.Userid;
101101

102-
_gameServer.Message(
103-
HudDestination.Chat,
104-
$" {ChatColors.Default}type {ChatColors.Green}{CommandUtility.PublicChatTrigger}r {ChatColors.Default}to be marked as ready for the match",
105-
@event.Userid
106-
);
102+
if (_readySystem.IsWaitingForReady())
103+
{
104+
_gameServer.Message(
105+
HudDestination.Chat,
106+
$" {ChatColors.Default}type {ChatColors.Green}{CommandUtility.PublicChatTrigger}r {ChatColors.Default}to be marked as ready for the match",
107+
@event.Userid
108+
);
109+
}
107110

108111
_gameServer.Message(
109112
HudDestination.Chat,

src/FiveStack.Services/ReadySystem.cs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,11 @@ public void ResetReady()
5858
_readyPlayers.Clear();
5959
}
6060

61+
public bool IsWaitingForReady()
62+
{
63+
return _readyStatusTimer != null;
64+
}
65+
6166
public void ToggleReady(CCSPlayerController player)
6267
{
6368
if (player.UserId == null)

src/FiveStackPlugin.cs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,13 @@ public partial class FiveStackPlugin : BasePlugin
1313
private readonly GameDemos _gameDemos;
1414
private readonly GameServer _gameServer;
1515
private readonly MatchEvents _matchEvents;
16+
private readonly ReadySystem _readySystem;
1617
private readonly TimeoutSystem _timeoutSystem;
1718
private readonly MatchService _matchService;
1819
private readonly SurrenderSystem _surrenderSystem;
1920
private readonly ILogger<FiveStackPlugin> _logger;
2021
private readonly GameBackUpRounds _gameBackupRounds;
2122
private readonly EnvironmentService _environmentService;
22-
2323
public override string ModuleName => "FiveStack";
2424
public override string ModuleVersion => "__RELEASE_VERSION__";
2525
public override string ModuleAuthor => "5Stack.gg";
@@ -30,6 +30,7 @@ public FiveStackPlugin(
3030
GameServer gameServer,
3131
MatchEvents matchEvents,
3232
MatchService matchService,
33+
ReadySystem readySystem,
3334
TimeoutSystem timeoutSystem,
3435
ILogger<FiveStackPlugin> logger,
3536
SurrenderSystem surrenderSystem,
@@ -41,6 +42,7 @@ EnvironmentService environmentService
4142
_gameDemos = matchDemos;
4243
_gameServer = gameServer;
4344
_matchEvents = matchEvents;
45+
_readySystem = readySystem;
4446
_matchService = matchService;
4547
_timeoutSystem = timeoutSystem;
4648
_surrenderSystem = surrenderSystem;

0 commit comments

Comments
 (0)