var ratioRequired = _cfg.GetCVar(CCVars.VoteRestartRequiredRatio);
if (total > 0 && votesYes / (float) total >= ratioRequired)
{
- _adminLogger.Add(LogType.Vote, LogImpact.Medium, $"Restart vote succeeded: {votesYes}/{votesNo}");
- _chatManager.DispatchServerAnnouncement(Loc.GetString("ui-vote-restart-succeeded"));
- var roundEnd = _entityManager.EntitySysManager.GetEntitySystem<RoundEndSystem>();
- roundEnd.EndRound();
+ // Check if an admin is online, and ignore the passed vote if the cvar is enabled
+ if (_cfg.GetCVar(CCVars.VoteRestartNotAllowedWhenAdminOnline) && _adminMgr.ActiveAdmins.Count() != 0)
+ {
+ _adminLogger.Add(LogType.Vote, LogImpact.Medium, $"Restart vote attempted to pass, but an admin was online. {votesYes}/{votesNo}");
+ }
+ else // If the cvar is disabled or there's no admins on, proceed as normal
+ {
+ _adminLogger.Add(LogType.Vote, LogImpact.Medium, $"Restart vote succeeded: {votesYes}/{votesNo}");
+ _chatManager.DispatchServerAnnouncement(Loc.GetString("ui-vote-restart-succeeded"));
+ var roundEnd = _entityManager.EntitySysManager.GetEntitySystem<RoundEndSystem>();
+ roundEnd.EndRound();
+ }
}
else
{
if (voteType != null && _standardVoteTimeout.TryGetValue(voteType.Value, out timeSpan))
return false;
- // No, seriously, stop spamming the restart vote!
- if (voteType == StandardVoteType.Restart && _cfg.GetCVar(CCVars.VoteRestartNotAllowedWhenAdminOnline) && _adminMgr.ActiveAdmins.Count() != 0)
- return false;
-
// If only one Preset available thats not really a vote
// Still allow vote if availbable one is different from current one
if (voteType == StandardVoteType.Preset)
CVarDef.Create("vote.restart_required_ratio", 0.85f, CVar.SERVERONLY);
/// <summary>
- /// Whether or not to restrict the restart vote when there's online admins.
+ /// Whether or not to prevent the restart vote from having any effect when there is an online admin
/// </summary>
public static readonly CVarDef<bool> VoteRestartNotAllowedWhenAdminOnline =
CVarDef.Create("vote.restart_not_allowed_when_admin_online", true, CVar.SERVERONLY);