Fix 3000 errors

This commit is contained in:
DrSmugleaf
2021-12-05 18:09:01 +01:00
parent 2bfec7ec62
commit 2a3b7d809d
569 changed files with 2979 additions and 3280 deletions

View File

@@ -19,14 +19,13 @@ namespace Content.Server.Chat.Commands
public void Execute(IConsoleShell shell, string argStr, string[] args)
{
var player = shell.Player as IPlayerSession;
if (player == null)
if (shell.Player is not IPlayerSession player)
{
shell.WriteLine("This command cannot be run from the server.");
return;
}
if (player.Status != SessionStatus.InGame || !player.AttachedEntityUid.HasValue)
if (player.Status != SessionStatus.InGame || !player.AttachedEntity.HasValue)
return;
if (args.Length < 1)
@@ -38,9 +37,8 @@ namespace Content.Server.Chat.Commands
var chat = IoCManager.Resolve<IChatManager>();
var chatSanitizer = IoCManager.Resolve<IChatSanitizationManager>();
var playerEntity = player.AttachedEntity;
if (playerEntity == null)
if (player.AttachedEntity is not {Valid: true} playerEntity)
{
shell.WriteLine("You don't have an entity!");
return;
@@ -58,7 +56,7 @@ namespace Content.Server.Chat.Commands
return;
}
if (mindComponent.OwnedEntity == null)
if (mindComponent.OwnedEntity == default)
{
shell.WriteError("You don't have an entity!");
return;