Enable nullability in Content.Server (#3685)

This commit is contained in:
DrSmugleaf
2021-03-16 15:50:20 +01:00
committed by GitHub
parent 90fec0ed24
commit a5ade526b7
306 changed files with 1616 additions and 1441 deletions

View File

@@ -29,7 +29,7 @@ namespace Content.Server.GameTicking.GameRules
[Dependency] private readonly IGameTicker _gameTicker = default!;
[Dependency] private readonly IConfigurationManager _cfg = default!;
private CancellationTokenSource _checkTimerCancel;
private CancellationTokenSource? _checkTimerCancel;
public override void Added()
{
@@ -59,12 +59,12 @@ namespace Content.Server.GameTicking.GameRules
if (!_cfg.GetCVar(CCVars.GameLobbyEnableWin))
return;
IPlayerSession winner = null;
IPlayerSession? winner = null;
foreach (var playerSession in _playerManager.GetAllPlayers())
{
var playerEntity = playerSession.AttachedEntity;
if (playerEntity == null
|| !playerEntity.TryGetComponent(out IMobStateComponent state))
|| !playerEntity.TryGetComponent(out IMobStateComponent? state))
{
continue;
}
@@ -94,7 +94,7 @@ namespace Content.Server.GameTicking.GameRules
Timer.Spawn(TimeSpan.FromSeconds(restartDelay), () => _gameTicker.RestartRound());
}
private void PlayerManagerOnPlayerStatusChanged(object sender, SessionStatusEventArgs e)
private void PlayerManagerOnPlayerStatusChanged(object? sender, SessionStatusEventArgs e)
{
if (e.NewStatus == SessionStatus.Disconnected)
{

View File

@@ -86,7 +86,7 @@ namespace Content.Server.GameTicking.GameRules
foreach (var playerSession in _playerManager.GetAllPlayers())
{
if (playerSession.AttachedEntity == null
|| !playerSession.AttachedEntity.TryGetComponent(out IMobStateComponent mobState)
|| !playerSession.AttachedEntity.TryGetComponent(out IMobStateComponent? mobState)
|| !playerSession.AttachedEntity.HasComponent<SuspicionRoleComponent>())
{
continue;